Difference between revisions of "Converting from the old map format"From Globulation2
Latest revision as of 15:42, 2 October 2009Converting maps from 0.8.23 or previous to 0.9.0 formatAs of 0.9.0, Globulation 2 uses a new map format. this means any maps made in and used in any version prior to 0.9.0 no longer works. To convert these to the new format, first get an unchanged version of Alpha 23 Globulation 2 source code and make the following changes:
/// Save transitional map data. This is temporary map information that is saved by /// the alpha 23 patch for transfering between map formats void saveTransitional();
void Map::saveTransitional() { std::string fileName = glob2NameToFilename("maps", "output", ""); OutputStream *stream = new BinaryOutputStream(Toolkit::getFileManager()->openOutputStreamBackend(fileName)); // We write what's inside the map: stream->write(undermap, size, "undermap"); for (size_t i=0; i<size ;i++) { stream->writeUint16(cases[i].terrain, "terrain"); stream->write(&(cases[i].ressource), 4, "ressource"); stream->writeUint16(cases[i].scriptAreas, "scriptAreas"); stream->writeUint8(cases[i].canRessourcesGrow, "canRessourcesGrow"); } //Save area names for(int n=0; n<9; ++n) { stream->writeEnterSection(n); stream->writeText(getAreaName(n), "areaname"); stream->writeLeaveSection(); } delete stream; }
case SDLK_i : if(pressed) performAction(globalContainer->settings.editor_keyboard_shortcuts["hkey"]); break;
case SDLK_i : if(pressed) game.map.saveTransitional(); renderMiniMap(); break;
| ||||||||||||||||||||||||||||||||||