Free and Open Source real time strategy game with a new take on micro-management

Converting from the old map format

From Globulation2

Revision as of 05:40, 29 July 2007 by K776 (talk | contribs)
Jump to: navigation, search

Converting maps from 0.8.23 or previous to 0.9.0 format

As 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:

  • In Map.h, at line 100, add the following line:
/// Save transitional map data. This is temporary map information that is saved by
/// the alpha 23 patch for transfering between map formats
void saveTransitional();
  • In Map.cpp, at line 1246, add the following lines:
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;
}
  • In MapEdit.cpp, at line 1782, change
case SDLK_i :
	if(pressed)
		performAction(globalContainer->settings.editor_keyboard_shortcuts["hkey"]);
	break;
to
case SDLK_i :
	if(pressed)
		game.map.saveTransitional();
		renderMiniMap();
	break;


Now, load up the map you wish to convert in the Alpha 23 version in the Map Editor. Hit "I" (you won't see anything happen, but something did). Now, create a new map of exactly the same size in the new Globulation 2. In the Map Editor, Hit "I", and the terrain features will be loaded. Simply place buildings and units and you are ready to go.

Misc