From dc00f691ca2ad6ed4283dacfcf767eee57a0d238 Mon Sep 17 00:00:00 2001 From: albertzeyer Date: Wed, 22 Jul 2009 22:12:16 +0000 Subject: [PATCH] more fixes git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@110 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- src/include/declarations.h | 4 ++-- src/menu.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/include/declarations.h b/src/include/declarations.h index c05f12015..eba9dd909 100644 --- a/src/include/declarations.h +++ b/src/include/declarations.h @@ -70,14 +70,14 @@ typedef struct stControl stLevelControl levelcontrol; } stControl; -typedef struct stGameData +struct stGameData { std::string DataDirectory; short Episode; std::string Name; std::string FileList[MAX_NUMBER_OF_FILES]; stGameData() : Episode(0) {} -} stGameData; +}; typedef struct stResources diff --git a/src/menu.cpp b/src/menu.cpp index c3a35ce15..be2dfaa47 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -72,12 +72,10 @@ short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game) { getline (gamescfg,line); - if(strncmp(line.data(),"[",strlen("[")) == 0) + if(line != "" && line[0] == '[') { - stGameData *NewGameData; - pCKP->numGames++; - NewGameData = new stGameData[pCKP->numGames]; + stGameData* NewGameData = new stGameData[pCKP->numGames]; for(int i = 0; i < pCKP->numGames-1; ++i) NewGameData[i] = pCKP->GameData[i]; @@ -85,15 +83,15 @@ short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game) pCKP->GameData = NewGameData; } - if(strncmp(line.data(),"Name=",strlen("Name=")) == 0) + if(strncmp(line.c_str(),"Name=",strlen("Name=")) == 0) { pCKP->GameData[pCKP->numGames-1].Name = line.substr(strlen("Name=")); } - if(strncmp(line.data(),"Episode=",strlen("Episode=")) == 0) + if(strncmp(line.c_str(),"Episode=",strlen("Episode=")) == 0) { - sscanf(line.data(),"Episode=%hd", &(pCKP->GameData[pCKP->numGames-1].Episode)); + sscanf(line.c_str(),"Episode=%hd", &(pCKP->GameData[pCKP->numGames-1].Episode)); } - if(strncmp(line.data(),"Path=",strlen("Path=")) == 0) + if(strncmp(line.c_str(),"Path=",strlen("Path=")) == 0) { unsigned short l = strlen("Path="); pCKP->GameData[pCKP->numGames-1].DataDirectory = line.substr(l);