[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-dev] bug when redoing recall ?
From: |
Yann Dirson |
Subject: |
[Wesnoth-dev] bug when redoing recall ? |
Date: |
Sat, 11 Jun 2005 00:46:01 +0200 |
User-agent: |
Mutt/1.5.6+20040907i |
When looking for something else, I noticed that one call to
recruit_unit() is not checked for failure, when handing "redo" for a
recall. Since I'm not familiar with this part of the code, I prefer
to check with others first...
Index: src/playturn.cpp
===================================================================
RCS file: /cvsroot/wesnoth/wesnoth/src/playturn.cpp,v
retrieving revision 1.381
diff -u -r1.381 playturn.cpp
--- src/playturn.cpp 4 Jun 2005 23:21:06 -0000 1.381
+++ src/playturn.cpp 10 Jun 2005 22:31:50 -0000
@@ -1510,13 +1510,18 @@
unit& un = recall_list[action.recall_pos];
recorder.add_recall(action.recall_pos,action.recall_loc);
-
recruit_unit(map_,team_num_,units_,un,action.recall_loc,&gui_);
- statistics::recall_unit(un);
- team& current_team = teams_[team_num_-1];
- current_team.spend_gold(game_config::recall_cost);
-
recall_list.erase(recall_list.begin()+action.recall_pos);
+ const std::string& msg =
recruit_unit(map_,team_num_,units_,un,action.recall_loc,&gui_);
+ if(msg.empty()) {
+ statistics::recall_unit(un);
+ team& current_team = teams_[team_num_-1];
+ current_team.spend_gold(game_config::recall_cost);
+
recall_list.erase(recall_list.begin()+action.recall_pos);
- gui_.draw_tile(action.recall_loc.x,action.recall_loc.y);
+
gui_.draw_tile(action.recall_loc.x,action.recall_loc.y);
+ } else {
+ recorder.undo();
+ gui::show_dialog(gui_,NULL,"",msg,gui::OK_ONLY);
+ }
}
} else {
// Redo movement action
--
Yann Dirson <address@hidden> |
Debian-related: <address@hidden> | Support Debian GNU/Linux:
| Freedom, Power, Stability, Gratis
http://ydirson.free.fr/ | Check <http://www.debian.org/>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-dev] bug when redoing recall ?,
Yann Dirson <=