Created
July 6, 2013 05:15
-
-
Save kahrl/5938740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mapgen.cpp b/src/mapgen.cpp | |
index 905e80e..29a2e23 100644 | |
--- a/src/mapgen.cpp | |
+++ b/src/mapgen.cpp | |
@@ -659,8 +659,9 @@ void DecoSchematic::placeStructure(Map *map, v3s16 p) { | |
bool DecoSchematic::loadSchematicFile() { | |
std::ifstream is(filename.c_str(), std::ios_base::binary); | |
- u32 signature = readU32(is); | |
- if (signature != 'MTSM') { | |
+ char signature[4] = {0}; | |
+ is.read(signature, 4); | |
+ if (memcmp(signature, "MTSM", 4) != 0) { | |
errorstream << "loadSchematicFile: invalid schematic " | |
"file" << std::endl; | |
return false; | |
@@ -719,7 +720,7 @@ bool DecoSchematic::loadSchematicFile() { | |
void DecoSchematic::saveSchematicFile(INodeDefManager *ndef) { | |
std::ofstream os(filename.c_str(), std::ios_base::binary); | |
- writeU32(os, 'MTSM'); // signature | |
+ os << "MTSM"; // signature | |
writeU16(os, 1); // version | |
writeV3S16(os, size); // schematic size | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment