| 31 | |
| 32 | |
| 33 | bool cMapSerializer::Load(void) |
| 34 | { |
| 35 | AString Data = cFile::ReadWholeFile(FILE_IO_PREFIX + m_Path); |
| 36 | if (Data.empty()) |
| 37 | { |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | AString Uncompressed; |
| 42 | int res = UncompressStringGZIP(Data.data(), Data.size(), Uncompressed); |
| 43 | |
| 44 | if (res != Z_OK) |
| 45 | { |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | // Parse the NBT data: |
| 50 | cParsedNBT NBT(Uncompressed.data(), Uncompressed.size()); |
| 51 | if (!NBT.IsValid()) |
| 52 | { |
| 53 | // NBT Parsing failed |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | return LoadMapFromNBT(NBT); |
| 58 | } |
| 59 | |
| 60 | |
| 61 |
no test coverage detected