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

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

[Wesnoth-cvs-commits] wesnoth/src game_config.cpp game_config.hpp pla...


From: Jon Daniel
Subject: [Wesnoth-cvs-commits] wesnoth/src game_config.cpp game_config.hpp pla...
Date: Sat, 05 Mar 2005 10:39:19 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Jon Daniel <address@hidden>     05/03/05 15:39:18

Modified files:
        src            : game_config.cpp game_config.hpp playturn.cpp 
                         replay.cpp 

Log message:
        Applied patch #3788 from ott adding a new ignore_replay_errors command

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.cpp.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.hpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.337&tr2=1.338&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.93&tr2=1.94&r1=text&r2=text

Patches:
Index: wesnoth/src/game_config.cpp
diff -u wesnoth/src/game_config.cpp:1.92 wesnoth/src/game_config.cpp:1.93
--- wesnoth/src/game_config.cpp:1.92    Thu Nov 18 22:00:12 2004
+++ wesnoth/src/game_config.cpp Sat Mar  5 15:39:17 2005
@@ -1,4 +1,4 @@
-/* $Id: game_config.cpp,v 1.92 2004/11/18 22:00:12 ydirson Exp $ */
+/* $Id: game_config.cpp,v 1.93 2005/03/05 15:39:17 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -31,7 +31,7 @@
        int kill_experience = 8;
        int leadership_bonus = 25;
        const std::string version = VERSION;
-       bool debug = false, editor = false;
+       bool debug = false, editor = false, ignore_replay_errors = false;
 
        std::string game_icon = "wesnoth-icon.png", game_title, game_logo, 
title_music;
        int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, 
title_buttons_y = 0, title_buttons_padding = 0,
Index: wesnoth/src/game_config.hpp
diff -u wesnoth/src/game_config.hpp:1.25 wesnoth/src/game_config.hpp:1.26
--- wesnoth/src/game_config.hpp:1.25    Wed Sep 22 00:05:33 2004
+++ wesnoth/src/game_config.hpp Sat Mar  5 15:39:18 2005
@@ -1,4 +1,4 @@
-/* $Id: game_config.hpp,v 1.25 2004/09/22 00:05:33 cedricd Exp $ */
+/* $Id: game_config.hpp,v 1.26 2005/03/05 15:39:18 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,7 +32,7 @@
        extern int leadership_bonus;
        extern const std::string version;
 
-       extern bool debug, editor;
+       extern bool debug, editor, ignore_replay_errors;
 
        extern std::string path;
 
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.337 wesnoth/src/playturn.cpp:1.338
--- wesnoth/src/playturn.cpp:1.337      Sat Mar  5 10:54:25 2005
+++ wesnoth/src/playturn.cpp    Sat Mar  5 15:39:18 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.337 2005/03/05 10:54:25 silene Exp $ */
+/* $Id: playturn.cpp,v 1.338 2005/03/05 15:39:18 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2414,6 +2414,8 @@
                throw end_level_exception(QUIT);
        } else if(cmd == "debug") {
                game_config::debug = (data != "off") ? true : false;
+       } else if(cmd == "ignore_replay_errors") {
+               game_config::ignore_replay_errors = (data != "off") ? true : 
false;
        } else if(cmd == "n" && game_config::debug) {
                throw end_level_exception(VICTORY);
        } else if(game_config::debug && cmd == "unit") {
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.93 wesnoth/src/replay.cpp:1.94
--- wesnoth/src/replay.cpp:1.93 Sat Mar  5 10:54:25 2005
+++ wesnoth/src/replay.cpp      Sat Mar  5 15:39:18 2005
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.93 2005/03/05 10:54:25 silene Exp $ */
+/* $Id: replay.cpp,v 1.94 2005/03/05 15:39:18 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -76,7 +76,7 @@
                                }
                        }
 
-                       throw replay::error();
+                       if (!game_config::ignore_replay_errors) throw 
replay::error();
                }
 
                const config::child_list& items = cfg.get_children("unit");
@@ -88,7 +88,7 @@
                                       << (**i)["type"] << "' (side " << 
(**i)["side"] << ") at "
                                       << (**i)["x"] << ',' << (**i)["y"]
                                       << " but there is no local record of 
it\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        config cfg;
@@ -108,7 +108,7 @@
 
                        if(!is_ok) {
                                ERR_NW << "(SYNC VERIFICATION FAILED)\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
                }
 
@@ -641,7 +641,7 @@
                if(advancing_units.empty() == false) {
                        if(cfg == NULL) {
                                ERR_NW << "promotion expected, but none 
found\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        //if there is a promotion, we process it and go onto 
the next command
@@ -714,7 +714,7 @@
                                ERR_NW << "recruitment index is illegal: " << 
val
                                       << " while this side only has " << 
recruits.size()
                                       << " units available for recruitment\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        std::set<std::string>::const_iterator itor = 
recruits.begin();
@@ -722,20 +722,20 @@
                        const std::map<std::string,unit_type>::const_iterator 
u_type = gameinfo.unit_types.find(*itor);
                        if(u_type == gameinfo.unit_types.end()) {
                                ERR_NW << "recruiting illegal unit: '" << *itor 
<< "'\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        unit new_unit(&(u_type->second),team_num,true);
                        const std::string& res = 
recruit_unit(map,team_num,units,new_unit,loc);
                        if(!res.empty()) {
                                ERR_NW << "cannot recruit unit: " << res << 
"\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        if(u_type->second.cost() > current_team.gold()) {
                                ERR_NW << "unit '" << u_type->second.name() << 
"' is too expensive to recruit: "
                                       << u_type->second.cost() << "/" << 
current_team.gold() << "\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        statistics::recruit_unit(new_unit);
@@ -748,7 +748,7 @@
                        player_info* player = 
state_of_game.get_player(current_team.save_id());
                        if(player == NULL) {
                                ERR_NW << "illegal recall\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        
std::sort(player->available_units.begin(),player->available_units.end(),compare_unit_values());
@@ -765,7 +765,7 @@
                                
current_team.spend_gold(game_config::recall_cost);
                        } else {
                                ERR_NW << "illegal recall\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
                        fix_shroud = true;
                }
@@ -774,7 +774,7 @@
                        player_info* const player = 
state_of_game.get_player(current_team.save_id());
                        if(player == NULL) {
                                ERR_NW << "illegal disband\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        
std::sort(player->available_units.begin(),player->available_units.end(),compare_unit_values());
@@ -785,7 +785,7 @@
                                
player->available_units.erase(player->available_units.begin()+val);
                        } else {
                                ERR_NW << "illegal disband\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
                }
 
@@ -796,7 +796,7 @@
 
                        if(destination == NULL || source == NULL) {
                                ERR_NW << "no destination/source found in 
movement\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        const gamemap::location src(*source);
@@ -806,13 +806,13 @@
                        if(u != units.end()) {
                                ERR_NW << "destination already occupied: "
                                       << dst << '\n';
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
                        u = units.find(src);
                        if(u == units.end()) {
                                ERR_NW << "unfound location for source of 
movement: "
                                       << src << '-' << dst << '\n';
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        const bool ignore_zocs = 
u->second.type().is_skirmisher();
@@ -832,7 +832,7 @@
 
                                ERR_NW << "src cannot get to dst: " << 
current_unit.movement_left() << ' '
                                       << paths_list.routes.size() << ' ' << 
src << '-' << dst << '\n';
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        rt->second.steps.push_back(dst);
@@ -879,7 +879,7 @@
 
                        if(destination == NULL || source == NULL) {
                                ERR_NW << "no destination/source found in 
attack\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        const gamemap::location src(*source);
@@ -891,19 +891,19 @@
                        std::map<gamemap::location,unit>::iterator u = 
units.find(src);
                        if(u == units.end()) {
                                ERR_NW << "unfound location for source of 
attack\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        if(size_t(weapon_num) >= u->second.attacks().size()) {
                                ERR_NW << "illegal weapon type in attack\n";
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        std::map<gamemap::location,unit>::const_iterator tgt = 
units.find(dst);
 
                        if(tgt == units.end()) {
                                ERR_NW << "unfound defender for attack: " << 
src << " -> " << dst << '\n';
-                               throw replay::error();
+                               if (!game_config::ignore_replay_errors) throw 
replay::error();
                        }
 
                        game_events::fire("attack",src,dst);
@@ -934,7 +934,7 @@
                        fix_shroud = true;
                } else {
                        ERR_NW << "unrecognized action\n";
-                       throw replay::error();
+                       if (!game_config::ignore_replay_errors) throw 
replay::error();
                }
 
                //Check if we should refresh the shroud, and redraw the 
minimap/map tiles.




reply via email to

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