diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp index d3f531a..e7178f8 100644 --- a/source/code/ReadKeyboard.cpp +++ b/source/code/ReadKeyboard.cpp @@ -135,6 +135,7 @@ bool ReadKeyboard::ReadKey(SDLKey keyPressed) return true; } char charToPut; + if(keyPressed) switch (keyPressed) { case SDLK_a: diff --git a/source/code/editor/editorMain.cpp b/source/code/editor/editorMain.cpp index d7312e4..2c3d831 100644 --- a/source/code/editor/editorMain.cpp +++ b/source/code/editor/editorMain.cpp @@ -17,7 +17,7 @@ Copyright (C) 2007 Poul Sander Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Poul Sander - Rævehøjvej 36, V. 1111 + R�veh�jvej 36, V. 1111 2800 Kgs. Lyngby DENMARK blockattack@poulsander.com @@ -161,3 +161,8 @@ void theEditor::click(int x, int y) (&(buttons[i]))->click(x,y); } } + +int main() { + theEditor te; + te.drawButtons(); +} \ No newline at end of file diff --git a/source/code/editor/editorMain.hpp b/source/code/editor/editorMain.hpp index d015093..9f51540 100644 --- a/source/code/editor/editorMain.hpp +++ b/source/code/editor/editorMain.hpp @@ -17,7 +17,7 @@ Copyright (C) 2007 Poul Sander Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Poul Sander - Rævehøjvej 36, V. 1111 + R�veh�jvej 36, V. 1111 2800 Kgs. Lyngby DENMARK blockattack@poulsander.com @@ -94,8 +94,8 @@ class theEditor theEditor(); - void drawButtons(); + virtual void drawButtons(); - void click(int x, int y); + virtual void click(int x, int y); }; diff --git a/source/code/highscore.cpp b/source/code/highscore.cpp index c151649..b7fda7d 100644 --- a/source/code/highscore.cpp +++ b/source/code/highscore.cpp @@ -17,7 +17,7 @@ Copyright (C) 2005 Poul Sander Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Poul Sander - Rævehøjvej 36, V. 1111 + R�veh�jvej 36, V. 1111 2800 Kgs. Lyngby DENMARK blockattack@poulsander.com @@ -72,15 +72,9 @@ Highscore::Highscore(int type) string filename2 = "timetrial.dat"; #endif ourType = type; - if (type == 1) filename = (char*)malloc(filename1.length()+1); - if (type == 2) filename = (char*)malloc(filename2.length()+1); - if (filename == NULL){ - cout << "Out of memory" << endl; - exit(1); - } - if (type == 1) memcpy(filename,filename1.c_str(),filename1.length()+1); - if (type == 2) memcpy(filename,filename2.c_str(),filename2.length()+1); - ifstream scorefile(filename, ios::binary); + if (type == 1) filename = filename1; + if (type == 2) filename = filename2; + ifstream scorefile(filename.c_str(), ios::binary); if (scorefile) { for (int i = 0; i(&tabel[i].score),sizeof(int)); } outfile.close(); - free(filename); } bool Highscore::isHighScore(int newScore) diff --git a/source/code/highscore.h b/source/code/highscore.h index d157fb2..e25ce53 100644 --- a/source/code/highscore.h +++ b/source/code/highscore.h @@ -17,7 +17,7 @@ Copyright (C) 2005 Poul Sander Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Poul Sander - Rævehøjvej 36, V. 1111 + R�veh�jvej 36, V. 1111 2800 Kgs. Lyngby DENMARK blockattack@poulsander.com @@ -52,7 +52,7 @@ class Highscore { private: record tabel[top]; - char* filename; + string filename; int ourType; //This is ugly, remove me, plz! void writeFile(); public: diff --git a/source/code/main.cpp b/source/code/main.cpp index 8284d78..470783c 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -119,16 +119,15 @@ void closeAllMenus() } - -SDL_Surface * IMG_Load2(char* path) +SDL_Surface * IMG_Load2(string path) { - if (!PHYSFS_exists(path)) + if (!PHYSFS_exists(path.c_str())) { cout << "File not in blockattack.data: " << path << endl; return NULL; //file doesn't exist } - PHYSFS_file* myfile = PHYSFS_openRead(path); + PHYSFS_file* myfile = PHYSFS_openRead(path.c_str()); // Get the lenght of the file unsigned int m_size = PHYSFS_fileLength(myfile); @@ -234,15 +233,15 @@ void loadTheme(string themeName) }*/ -Mix_Music * Mix_LoadMUS2(char* path) +Mix_Music * Mix_LoadMUS2(string path) { - if (!PHYSFS_exists(path)) + if (!PHYSFS_exists(path.c_str())) { cout << "File not in blockattack.data: " << path << endl; return NULL; //file doesn't exist } - PHYSFS_file* myfile = PHYSFS_openRead(path); + PHYSFS_file* myfile = PHYSFS_openRead(path.c_str()); // Get the lenght of the file unsigned int m_size = PHYSFS_fileLength(myfile); @@ -332,13 +331,13 @@ Mix_Chunk * Mix_LoadWAV2(char* path) //Load all image files to memory static int InitImages() { - if (!((backgroundImage = IMG_Load2((char*)"gfx/background.png")) - && (background = IMG_Load2((char*)"gfx/blackBackGround.png")) - && (bNewGame = IMG_Load2((char*)"gfx/bNewGame.png")) - && (b1player = IMG_Load2((char*)"gfx/bOnePlayer.png")) - && (b2players = IMG_Load2((char*)"gfx/bTwoPlayers.png")) - && (bVsMode = IMG_Load2((char*)"gfx/bVsGame.png")) - && (bVsModeConfig = IMG_Load2((char*)"gfx/bVsGameConfig.png")) + if (!((backgroundImage = IMG_Load2("gfx/background.png")) + && (background = IMG_Load2("gfx/blackBackGround.png")) + && (bNewGame = IMG_Load2("gfx/bNewGame.png")) + && (b1player = IMG_Load2("gfx/bOnePlayer.png")) + && (b2players = IMG_Load2("gfx/bTwoPlayers.png")) + && (bVsMode = IMG_Load2("gfx/bVsGame.png")) + && (bVsModeConfig = IMG_Load2("gfx/bVsGameConfig.png")) && (bPuzzle = IMG_Load2((char*)"gfx/bPuzzle.png")) && (bStageClear = IMG_Load2((char*)"gfx/bStageClear.png")) && (bTimeTrial = IMG_Load2((char*)"gfx/bTimeTrial.png")) @@ -3660,7 +3659,7 @@ int main(int argc, char *argv[]) //Load default theme loadTheme(Config::getInstance()->getString("themename")); //Now sets the icon: - SDL_Surface *icon = IMG_Load2((char*)"gfx/icon.png"); + SDL_Surface *icon = IMG_Load2("gfx/icon.png"); SDL_WM_SetIcon(icon,NULL); //SDL_FreeSurface(icon);