X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSettings.cpp;h=ef3cebe22e9f5ead286eff1659636a12d9d2fd93;hb=8afdcba610cded0e54b85069ba051268b29669a6;hp=71b7581bd77ce6683c386e20a582a8100ba79e77;hpb=56623d20eeb3e38bcc30e9a8fd02ab3bf4f7f994;p=lugaru.git diff --git a/Source/Settings.cpp b/Source/Settings.cpp index 71b7581..ef3cebe 100644 --- a/Source/Settings.cpp +++ b/Source/Settings.cpp @@ -40,10 +40,17 @@ void DefaultSettings(Game &game) { game.drawkey=SDLK_e; game.throwkey=SDLK_q; game.attackkey=MOUSEBUTTON1; + game.consolekey=SDLK_BACKQUOTE; game.chatkey=SDLK_t; } void SaveSettings(Game &game) { + if(game.newdetail<0) game.newdetail=0; + if(game.newdetail>2) game.newdetail=2; + if(game.newscreenwidth>3000) game.newscreenwidth=screenwidth; + if(game.newscreenwidth<0) game.newscreenwidth=screenwidth; + if(game.newscreenheight>3000) game.newscreenheight=screenheight; + if(game.newscreenheight<0) game.newscreenheight=screenheight; ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << game.newscreenwidth; @@ -116,6 +123,8 @@ void SaveSettings(Game &game) { opstream << Input::keyToChar(game.throwkey); opstream << "\nAttack key:\n"; opstream << Input::keyToChar(game.attackkey); + opstream << "\nConsole key:\n"; + opstream << Input::keyToChar(game.consolekey); opstream << "\nChat key:\n"; opstream << Input::keyToChar(game.chatkey); opstream << "\nDamage bar:\n"; @@ -141,11 +150,11 @@ bool LoadSettings(Game &game) { printf("Loading config\n"); while(!ipstream.eof()) { ipstream.getline( setting, sizeof(setting) ); - printf("setting : %s\n",setting); // skip blank lines // assume lines starting with spaces are all blank if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t') continue; + //~ printf("setting : %s\n",setting); if ( ipstream.eof() || ipstream.fail() ) { fprintf(stderr, "Error reading config file: Got setting name '%s', but value can't be read\n", setting); @@ -240,6 +249,9 @@ bool LoadSettings(Game &game) { } else if ( !strncmp(setting, "Attack key", 10) ) { ipstream.getline( string, sizeof(string) ); game.attackkey = Input::CharToKey(string); + } else if ( !strncmp(setting, "Console key", 11) ) { + ipstream.getline( string, sizeof(string) ); + game.consolekey = Input::CharToKey(string); } else if ( !strncmp(setting, "Chat key", 8) ) { ipstream.getline( string, sizeof(string) ); game.chatkey = Input::CharToKey(string);