]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Settings.cpp
The console key is now easy to configure. (the option will only be shown in debug...
[lugaru.git] / Source / Settings.cpp
index 52ecbebb4eac4266bcb05ce942156d400d651f07..ef3cebe22e9f5ead286eff1659636a12d9d2fd93 100644 (file)
@@ -40,6 +40,7 @@ void DefaultSettings(Game &game) {
        game.drawkey=SDLK_e;
        game.throwkey=SDLK_q;
        game.attackkey=MOUSEBUTTON1;
+       game.consolekey=SDLK_BACKQUOTE;
        game.chatkey=SDLK_t;
 }
 
@@ -122,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";
@@ -151,7 +154,7 @@ bool LoadSettings(Game &game) {
                // 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);
+               //~ 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);
@@ -246,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);