glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[glob2-devel] Switching maps from the old format to the new


From: Bradley Arsenault
Subject: [glob2-devel] Switching maps from the old format to the new
Date: Mon, 14 May 2007 23:04:44 -0400

Here is how to switch the maps from the old format to the new one
(remember that the format is still unstable, but this procedure
doesn't change for people testing the expiremental code).

1) Take a copy of alpha 23 (or the master works right now) and apply
the following changes:
 a) In Map.h, add the following lines after "void
save(GAGCore::OutputStream *stream);"
        
        /// Save transitional map data. This is temporary map information
that is saved by
        /// the alpha 23 patch for transfering between map formats
        void saveTransitional();

 b) In Map.cpp, add the following lines after the same save function,
exactly 1246 lines down after the "}"

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;
}

c) In MapEdit.cpp, at line 1782 change:

                case SDLK_i :
                        if(pressed)
                        {
                                
performAction(globalContainer->settings.editor_keyboard_shortcuts["ikey"]);
                                break;

to:
                case SDLK_i :
                        if(pressed)
                        {
                                
performAction(globalContainer->settings.editor_keyboard_shortcuts["ikey"]);
                                game.map.saveTransitional();
                        }
                        break;



Thats all! Load a map with the alpha 23 compiled copy, hit i to save
the changes. Nothing will appear to happen. Load my branch, make a new
map (must be the same size), hit i, and the map will be loaded. Doing
this is allot like copying and pasting.



--
Really. I'm not lieing. Bradley Arsenault.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]