Beispiel #1
0
bool Map::Load(std::string filename) {
	FILE *f = fopen(filename.c_str(), "rb");
	if(f) {
		uint32 version;
		if(fread(&version, sizeof(version), 1, f) != 1) {
			fclose(f);
			return false;
		}
		
		if(version == 0x01000000) {
			bool v = LoadV1(f);
			fclose(f);
			return v;
		} else if(version == 0x02000000) {
			bool v = LoadV2(f);
			fclose(f);
			return v;
		} else {
			fclose(f);
			return false;
		}
	}
	
	return false;
}
Beispiel #2
0
bool Map::Load(std::string filename, bool force_mmf_overwrite)
{
	if (LoadMMF(filename, force_mmf_overwrite)) {
		Log.Out(Logs::General, Logs::Status, "Loaded .MMF Map File in place of '%s'", filename.c_str());
		return true;
	}
#else
bool Map::Load(std::string filename)
{
#endif /*USE_MAP_MMFS*/

	FILE *f = fopen(filename.c_str(), "rb");
	if(f) {
		uint32 version;
		if(fread(&version, sizeof(version), 1, f) != 1) {
			fclose(f);
			return false;
		}
		
		if(version == 0x01000000) {
			Log.Out(Logs::General, Logs::Status, "Loaded V1 Map File :: '%s'", filename.c_str());
			bool v = LoadV1(f);
			fclose(f);

#ifdef USE_MAP_MMFS
			if (v)
				return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/

			return v;
		} else if(version == 0x02000000) {
			Log.Out(Logs::General, Logs::Status, "Loaded V2 Map File :: '%s'", filename.c_str());
			bool v = LoadV2(f);
			fclose(f);

#ifdef USE_MAP_MMFS
			if (v)
				return SaveMMF(filename, force_mmf_overwrite);
#endif /*USE_MAP_MMFS*/

			return v;
		} else {
			fclose(f);
			return false;
		}
	}
	
	return false;
}