99{
102
103 switch (result.second)
104 {
106 printf("GRF: Error reading grf header. aborting...\n");
107 return true;
109 printf("GRF: Invalid or unknown grf header format. aborting...\n");
110 printf("GRF: Possible over 2GB in size...\n");
111 return true;
113 printf(
"GRF: Invalid grf version %x. aborting...\n", problematic_grf.
getGRFVersion());
114 return true;
116 printf("GRF: Read error while loading the grf. Aborting...\n");
117 return true;
119 printf("GRF: Magic header was not 'Master of Magic'! Aborting...\n");
120 return true;
122 printf(
"GRF: Incorrect path '%s' given for grf. Aborting...\n", problematic_grf.
getGRFPath().c_str());
123 return true;
125 printf(
"GRF: Error reading header of the given grf '%s'. Aborting...\n", problematic_grf.
getGRFPath().c_str());
126 return true;
128 printf("GRF: Illegal data format, compressed size is greater than expected.\n");
129 return true;
131 default:
132 break;
133 }
134 }
135
137 int size = grf.second.getGRFSize();
138 float kb_size = size / 1024;
139 float mb_size = kb_size / 1024;
140 float gb_size = mb_size / 1024;
141
142 printf("Info: GRF Loaded from '%s'.\n", grf.second.getGRFPath().string().c_str());
143 printf("Info: Total GRF Size - %d B (%0.2f KB or %0.2f MB or %0.2f GB).\n", size, kb_size, mb_size, gb_size);
144 printf("Info: GRF has '%d' Total Compressed Files.\n", grf.second.getTotalFiles());
145 printf("Info: GRF Version %x\n", grf.second.getGRFVersion());
146 printf("Info: GRF file path: '%s'\n", grf.second.getGRFPath().c_str());
147 }
148
149 return false;
150}
@ GRF_LOAD_INCOMPLETE_HEADER
Definition: GRF.hpp:50
@ GRF_LOAD_ILLEGAL_DATA_FORMAT
Definition: GRF.hpp:55
@ GRF_LOAD_OK
Definition: GRF.hpp:48
@ GRF_LOAD_MAGIC_ERROR
Definition: GRF.hpp:51
@ GRF_LOAD_FORMAT_ERROR
Definition: GRF.hpp:52
@ GRF_LOAD_READ_ERROR
Definition: GRF.hpp:56
@ GRF_LOAD_PATH_ERROR
Definition: GRF.hpp:49
@ GRF_LOAD_INVALID_VERSION
Definition: GRF.hpp:53
@ GRF_LOAD_HEADER_READ_ERROR
Definition: GRF.hpp:54
const boost::filesystem::path & getGRFPath() const
Definition: GRF.hpp:105
int getGRFVersion() const
Definition: GRF.hpp:111
GRF & getGRF(uint8_t id)
Definition: MapCache.hpp:194