[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp |
Date: |
Sun, 29 May 2005 23:21:01 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/05/30 03:21:01
Modified files:
src : actions.cpp
Log message:
made 'recall' WML tag work even if the leader isn't on a keep
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.223&tr2=1.224&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.223 wesnoth/src/actions.cpp:1.224
--- wesnoth/src/actions.cpp:1.223 Mon May 30 01:53:56 2005
+++ wesnoth/src/actions.cpp Mon May 30 03:21:01 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.223 2005/05/30 01:53:56 Sirp Exp $ */
+/* $Id: actions.cpp,v 1.224 2005/05/30 03:21:01 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -96,7 +96,7 @@
typedef std::map<gamemap::location,unit> units_map;
//find the unit that can recruit
- units_map::const_iterator u;
+ units_map::const_iterator u = units.end();
for(u = units.begin(); u != units.end(); ++u) {
if(u->second.can_recruit() && u->second.side() == side) {
@@ -104,10 +104,13 @@
}
}
- if(u == units.end())
- return _("You don't have a leader to recruit with.");
+ if(u == units.end() && (need_castle ||
!map.on_board(recruit_location))) {
+ return _("You don't have a leader to recruit with.");
+ }
+
+ wassert(u != units.end() || !need_castle);
- if(map.is_keep(u->first) == false) {
+ if(need_castle && map.is_keep(u->first) == false) {
LOG_NG << "Leader not on start: leader is on " << u->first <<
'\n';
return _("You must have your leader on a keep to recruit or
recall units.");
}
@@ -116,13 +119,16 @@
castle_cost_calculator calc(map);
const paths::route& rt = a_star_search(u->first,
recruit_location, 100.0, &calc, map.x(), map.y());
if(rt.steps.empty() || units.find(recruit_location) !=
units.end() ||
- !map.is_castle(recruit_location))
- recruit_location = gamemap::location();
+ !map.is_castle(recruit_location)) {
+ recruit_location = gamemap::location();
+ }
}
if(!map.on_board(recruit_location)) {
recruit_location = find_vacant_tile(map,units,u->first,
need_castle ? VACANT_CASTLE
: VACANT_ANY);
+ } else if(units.count(recruit_location) == 1) {
+ recruit_location =
find_vacant_tile(map,units,recruit_location,VACANT_ANY);
}
if(!map.on_board(recruit_location)) {
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/10
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, John McNabb, 2005/05/13
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/13
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/13
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/13
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/14
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, ott, 2005/05/16
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp, David White, 2005/05/29
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp,
David White <=