diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 229a5d03..abd5b62a 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -50,21 +50,12 @@ edlevelclass::edlevelclass() editorclass::editorclass() { - maxwidth=20; - maxheight=20; - //We create a blank map - for (int j = 0; j < 30 * maxwidth; j++) - { - for (int i = 0; i < 40 * maxheight; i++) - { - contents.push_back(0); - } - } + SDL_memset(contents, 0, sizeof(contents)); - for (int i = 0; i < 30 * maxheight; i++) + for (size_t i = 0; i < SDL_arraysize(vmult); i++) { - vmult.push_back(int(i * 40 * maxwidth)); + vmult[i] = i * 40 * maxwidth; } reset(); @@ -1544,57 +1535,6 @@ void editorclass::findstartpoint() } } -void editorclass::saveconvertor() -{ - //In the case of resizing breaking a level, this function can fix it - maxwidth=20; - maxheight=20; - int oldwidth=10, oldheight=10; - - std::vector tempcontents; - for (int j = 0; j < 30 * oldwidth; j++) - { - for (int i = 0; i < 40 * oldheight; i++) - { - tempcontents.push_back(contents[i+(j*40*oldwidth)]); - } - } - - contents.clear(); - for (int j = 0; j < 30 * maxheight; j++) - { - for (int i = 0; i < 40 * maxwidth; i++) - { - contents.push_back(0); - } - } - - for (int j = 0; j < 30 * oldheight; j++) - { - for (int i = 0; i < 40 * oldwidth; i++) - { - contents[i+(j*40*oldwidth)]=tempcontents[i+(j*40*oldwidth)]; - } - } - - tempcontents.clear(); - - for (int i = 0; i < 30 * maxheight; i++) - { - vmult.push_back(int(i * 40 * maxwidth)); - } - - for (int j = 0; j < maxheight; j++) - { - for (int i = 0; i < maxwidth; i++) - { - level[i+(j*maxwidth)].tilecol=(i+j)%6; - } - } - contents.clear(); - -} - int editorclass::findtrinket(int t) { int ttrinket=0; @@ -1884,11 +1824,7 @@ bool editorclass::load(std::string& _path) if(TextString.length()) { std::vector values = split(TextString,','); - //contents.clear(); - for(size_t i = 0; i < contents.size(); i++) - { - contents[i] =0; - } + SDL_memset(contents, 0, sizeof(contents)); int x =0; int y =0; for(size_t i = 0; i < values.size(); i++) diff --git a/desktop_version/src/editor.h b/desktop_version/src/editor.h index dd2a4c83..bf12dcb4 100644 --- a/desktop_version/src/editor.h +++ b/desktop_version/src/editor.h @@ -128,7 +128,6 @@ class editorclass{ void getDirectoryData(); bool getLevelMetaData(std::string& filename, LevelMetaData& _data ); - void saveconvertor(); void reset(); void getlin(const enum textmode mode, const std::string& prompt, std::string* ptr); const int* loadlevel(int rxi, int ryi); @@ -189,12 +188,14 @@ class editorclass{ int getwarpbackground(int rx, int ry); std::vector getLevelDirFileNames( ); - std::vector contents; - std::vector vmult; + static const int maxwidth = 20, maxheight = 20; //Special; the physical max the engine allows + static const int numrooms = maxwidth * maxheight; + int contents[40 * 30 * numrooms]; + int vmult[30 * maxheight]; int numtrinkets(); int numcrewmates(); - edlevelclass level[400]; //Maxwidth*maxheight - int kludgewarpdir[400]; //Also maxwidth*maxheight + edlevelclass level[numrooms]; //Maxwidth*maxheight + int kludgewarpdir[numrooms]; //Also maxwidth*maxheight int notedelay; int oldnotedelay; @@ -236,7 +237,6 @@ class editorclass{ int levmusic; int mapwidth, mapheight; //Actual width and height of stage - int maxwidth, maxheight; //Special; the physical max the engine allows int version;