wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth data/game.cfg data/units/Cuttle_Fish.cf...


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth data/game.cfg data/units/Cuttle_Fish.cf...
Date: Sun, 29 Aug 2004 19:33:12 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/08/29 23:28:26

Modified files:
        data           : game.cfg 
        data/units     : Cuttle_Fish.cfg Sea_Serpent.cfg 
        src            : dialogs.cpp hotkeys.cpp multiplayer_connect.cpp 
                         playturn.cpp 
        src/widgets    : combo.cpp combo.hpp 

Log message:
        made it so that saving with illegal characters in the filename will 
fail elegantly with an error message

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/game.cfg.diff?tr1=1.109&tr2=1.110&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/units/Cuttle_Fish.cfg.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/units/Sea_Serpent.cfg.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/hotkeys.cpp.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.258&tr2=1.259&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.cpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.hpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text

Patches:
Index: wesnoth/data/game.cfg
diff -u wesnoth/data/game.cfg:1.109 wesnoth/data/game.cfg:1.110
--- wesnoth/data/game.cfg:1.109 Fri Aug 27 12:03:41 2004
+++ wesnoth/data/game.cfg       Sun Aug 29 23:28:26 2004
@@ -858,6 +858,49 @@
        [/movetype]
 
        [movetype]
+       name=deepsea
+               [movement costs]
+               deep water=1
+               shallow water=2
+               swamp water=2
+               grassland=4
+               sand=4
+               forest=5
+               hills=5
+               mountains=100
+               village=2
+               castle=1
+               cave=3
+               tundra=2
+               cavewall=100
+               [/movement costs]
+
+               [defense]
+               deep water=30
+               shallow water=40
+               swamp water=40
+               grassland=70
+               sand=70
+               forest=70
+               hills=70
+               mountains=80
+               village=70
+               castle=70
+               tundra=70
+               cave=80
+               [/defense]
+
+               [resistance]
+               blade=80
+               pierce=100
+               impact=70
+               fire=100
+               cold=40
+               holy=80
+               [/resistance]
+       [/movetype]
+
+       [movetype]
        name=swimmer
                [movement costs]
                deep water=1
Index: wesnoth/data/units/Cuttle_Fish.cfg
diff -u wesnoth/data/units/Cuttle_Fish.cfg:1.9 
wesnoth/data/units/Cuttle_Fish.cfg:1.10
--- wesnoth/data/units/Cuttle_Fish.cfg:1.9      Sun Aug 15 20:25:06 2004
+++ wesnoth/data/units/Cuttle_Fish.cfg  Sun Aug 29 23:28:26 2004
@@ -5,7 +5,7 @@
 image=cuttlefish.png
 image_defensive=cuttlefish-defend.png
 hitpoints=52
-movement_type=swimmer
+movement_type=deepsea
 movement=8
 experience=500
 level=2
Index: wesnoth/data/units/Sea_Serpent.cfg
diff -u wesnoth/data/units/Sea_Serpent.cfg:1.7 
wesnoth/data/units/Sea_Serpent.cfg:1.8
--- wesnoth/data/units/Sea_Serpent.cfg:1.7      Sun Aug 29 20:33:01 2004
+++ wesnoth/data/units/Sea_Serpent.cfg  Sun Aug 29 23:28:26 2004
@@ -5,7 +5,7 @@
 image=seaserpent.png
 image_defensive=seaserpent-defend.png
 hitpoints=85
-movement_type=swimmer
+movement_type=deepsea
 movement=8
 experience=500
 level=3
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.49 wesnoth/src/dialogs.cpp:1.50
--- wesnoth/src/dialogs.cpp:1.49        Wed Aug 25 02:59:50 2004
+++ wesnoth/src/dialogs.cpp     Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.49 2004/08/25 02:59:50 Sirp Exp $ */
+/* $Id: dialogs.cpp,v 1.50 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -171,7 +171,7 @@
     int overwrite=0;
     int res=0;
     do {
-        res = 
gui::show_dialog(disp,NULL,"",caption,dialog_type,NULL,NULL,message,name);
+        res = 
gui::show_dialog(disp,NULL,_("Save"),caption,dialog_type,NULL,NULL,message,name);
             if (res == 0 && save_game_exists(*name))
                 overwrite = gui::show_dialog(disp,NULL,"",
                     _("Save already exists. Do you want to overwrite it 
?"),gui::YES_NO);
Index: wesnoth/src/hotkeys.cpp
diff -u wesnoth/src/hotkeys.cpp:1.56 wesnoth/src/hotkeys.cpp:1.57
--- wesnoth/src/hotkeys.cpp:1.56        Wed Aug 18 02:51:23 2004
+++ wesnoth/src/hotkeys.cpp     Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: hotkeys.cpp,v 1.56 2004/08/18 02:51:23 Sirp Exp $ */
+/* $Id: hotkeys.cpp,v 1.57 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -355,7 +355,7 @@
 {
        if(event.keysym.sym == SDLK_ESCAPE && disp.in_game()) {
                std::cerr << "escape pressed..showing quit\n";
-               const int res = gui::show_dialog(disp,NULL,"",_("Do you really 
want to quit?"),gui::YES_NO);
+               const int res = gui::show_dialog(disp,NULL,_("Quit"),_("Do you 
really want to quit?"),gui::YES_NO);
                if(res == 0) {
                        throw end_level_exception(QUIT);
                } else {
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.63 
wesnoth/src/multiplayer_connect.cpp:1.64
--- wesnoth/src/multiplayer_connect.cpp:1.63    Thu Aug 26 15:37:48 2004
+++ wesnoth/src/multiplayer_connect.cpp Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.63 2004/08/26 15:37:48 isaaccp Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.64 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -261,7 +261,7 @@
        player_types_.push_back("-----");
        player_types_.push_back(preferences::login());
 
-       //Races
+       //Factions
        const config::child_itors sides = level_->child_range("side");
 
        const config* const era_cfg = cfg_->find_child("era","id",era_);
@@ -360,10 +360,10 @@
                                                  _("Player/Type"),0,0);
        font::draw_text(disp_,rect,14,font::GOOD_COLOUR,
                        
_("Player/Type"),(left+30)+(launch_.width()/2)-(labelr.w/2),top+35);
-       labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Race"),0,0);
+       labelr = 
font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Faction"),0,0);
 
        font::draw_text(disp_,rect,14,font::GOOD_COLOUR,
-                       
_("Race"),(left+145)+(launch_.width()/2)-(labelr.w/2),top+35);
+                       
_("Faction"),(left+145)+(launch_.width()/2)-(labelr.w/2),top+35);
        
        labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Team"),0,0);
 
@@ -491,7 +491,7 @@
                        combos_type_[n].set_selected(3);
                }
 
-               //Player Race
+               //Player Faction
                for (size_t m = 0; m != player_races_.size(); ++m) {
                        if (side["name"] == player_races_[m]) {
                                combos_race_[n].set_selected(m);
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.258 wesnoth/src/playturn.cpp:1.259
--- wesnoth/src/playturn.cpp:1.258      Thu Aug 26 02:50:15 2004
+++ wesnoth/src/playturn.cpp    Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.258 2004/08/26 02:50:15 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.259 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1376,6 +1376,15 @@
        }
 }
 
+namespace {
+
+bool is_illegal_file_char(char c)
+{
+       return c == '/' || c == '\\' || c == ':';
+}
+
+}
+
 void turn_info::save_game(const std::string& message, gui::DIALOG_TYPE 
dialog_type)
 {
        std::stringstream stream;
@@ -1386,15 +1395,23 @@
                label = message;
        }
 
+       
label.erase(std::remove_if(label.begin(),label.end(),is_illegal_file_char),label.end());
+
        const int res = dialog_type == gui::NULL_DIALOG ? 0 : 
dialogs::get_save_name(gui_,message,_("Name:"),&label,dialog_type);
 
+       if(std::count_if(label.begin(),label.end(),is_illegal_file_char)) {
+               gui::show_dialog(gui_,NULL,_("Error"),_("Save names may not 
contain colons, slashes, or backslashes. Please choose a different 
name."),gui::OK_ONLY);
+               save_game(message,dialog_type);
+               return;
+       }
+
        if(res == 0) {
                config snapshot;
                write_game_snapshot(snapshot);
                try {
                        
recorder.save_game(gameinfo_,label,snapshot,state_of_game_.starting_pos);
                        if(dialog_type != gui::NULL_DIALOG) {
-                               gui::show_dialog(gui_,NULL,"",_("The game has 
been saved"), gui::OK_ONLY);
+                               gui::show_dialog(gui_,NULL,_("Error"),_("The 
game has been saved"), gui::OK_ONLY);
                        }
                } catch(gamestatus::save_game_failed& e) {
                        gui::show_dialog(gui_,NULL,"",_("The game could not be 
saved"),gui::MESSAGE);
Index: wesnoth/src/widgets/combo.cpp
diff -u wesnoth/src/widgets/combo.cpp:1.17 wesnoth/src/widgets/combo.cpp:1.18
--- wesnoth/src/widgets/combo.cpp:1.17  Tue Jul 20 11:56:58 2004
+++ wesnoth/src/widgets/combo.cpp       Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: combo.cpp,v 1.17 2004/07/20 11:56:58 gakusho Exp $ */
+/* $Id: combo.cpp,v 1.18 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -38,6 +38,11 @@
        return button_.width();
 }
 
+void combo::set_width(int new_width)
+{
+       button_.set_width(new_width);
+}
+
 int combo::selected() const
 {
        return selected_;
Index: wesnoth/src/widgets/combo.hpp
diff -u wesnoth/src/widgets/combo.hpp:1.16 wesnoth/src/widgets/combo.hpp:1.17
--- wesnoth/src/widgets/combo.hpp:1.16  Tue Jul 20 11:56:58 2004
+++ wesnoth/src/widgets/combo.hpp       Sun Aug 29 23:28:26 2004
@@ -1,4 +1,4 @@
-/* $Id: combo.hpp,v 1.16 2004/07/20 11:56:58 gakusho Exp $ */
+/* $Id: combo.hpp,v 1.17 2004/08/29 23:28:26 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -27,6 +27,7 @@
        void draw();
 
        void set_location(int valx, int valy);
+       void set_width(int new_width);
        void set_selected(int val);
        void set_items(const std::vector<std::string>& items);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]