[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp actions.hpp team.cpp te...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp actions.hpp team.cpp te... |
Date: |
Sun, 18 Sep 2005 19:32:24 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/09/18 23:32:24
Modified files:
src : actions.cpp actions.hpp team.cpp team.hpp
Log message:
fix to make capture events mutating like other events
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.242&tr2=1.243&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.hpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.cpp.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.hpp.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.242 wesnoth/src/actions.cpp:1.243
--- wesnoth/src/actions.cpp:1.242 Tue Sep 13 19:34:56 2005
+++ wesnoth/src/actions.cpp Sun Sep 18 23:32:23 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.242 2005/09/13 19:34:56 gruikya Exp $ */
+/* $Id: actions.cpp,v 1.243 2005/09/18 23:32:23 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -1106,11 +1106,11 @@
return -1;
}
-void get_village(const gamemap::location& loc, std::vector<team>& teams,
+bool get_village(const gamemap::location& loc, std::vector<team>& teams,
size_t team_num, const unit_map& units)
{
if(team_num < teams.size() && teams[team_num].owns_village(loc)) {
- return;
+ return false;
}
const bool has_leader = find_leader(units,int(team_num+1)) !=
units.end();
@@ -1125,12 +1125,14 @@
}
if(team_num >= teams.size()) {
- return;
+ return false;
}
if(has_leader) {
- teams[team_num].get_village(loc);
- }
+ return teams[team_num].get_village(loc);
+ }
+
+ return false;
}
unit_map::iterator find_leader(unit_map& units, int side)
@@ -1901,20 +1903,22 @@
if(move_recorder != NULL) {
move_recorder->add_movement(steps.front(),steps.back());
}
+
+ bool event_mutated = false;
int orig_village_owner = -1;
if(map.is_village(steps.back())) {
orig_village_owner = village_owner(steps.back(),teams);
- if (size_t(orig_village_owner) != team_num) {
+ if(size_t(orig_village_owner) != team_num) {
ui->second.set_movement(0);
- get_village(steps.back(),teams,team_num,units);
+ event_mutated =
get_village(steps.back(),teams,team_num,units);
}
}
- bool event_mutated = false;
- if (game_events::fire("moveto",steps.back()))
- event_mutated = true;
+ if(game_events::fire("moveto",steps.back())) {
+ event_mutated = true;
+ }
if(undo_stack != NULL) {
if(event_mutated || should_clear_stack) {
Index: wesnoth/src/actions.hpp
diff -u wesnoth/src/actions.hpp:1.54 wesnoth/src/actions.hpp:1.55
--- wesnoth/src/actions.hpp:1.54 Mon Sep 12 21:36:04 2005
+++ wesnoth/src/actions.hpp Sun Sep 18 23:32:23 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.hpp,v 1.54 2005/09/12 21:36:04 gruikya Exp $ */
+/* $Id: actions.hpp,v 1.55 2005/09/18 23:32:23 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -109,8 +109,8 @@
int village_owner(const gamemap::location& loc, const std::vector<team>&
teams);
//makes it so the village at the given location is owned by the given
-//0-based team number
-void get_village(const gamemap::location& loc, std::vector<team>& teams,
+//0-based team number. Returns true if getting the village triggered a
mutating event
+bool get_village(const gamemap::location& loc, std::vector<team>& teams,
size_t team_num, const unit_map& units);
//given the 1-based side, will find the leader of that side,
Index: wesnoth/src/team.cpp
diff -u wesnoth/src/team.cpp:1.92 wesnoth/src/team.cpp:1.93
--- wesnoth/src/team.cpp:1.92 Sat Sep 17 21:11:41 2005
+++ wesnoth/src/team.cpp Sun Sep 18 23:32:23 2005
@@ -1,4 +1,4 @@
-/* $Id: team.cpp,v 1.92 2005/09/17 21:11:41 darthfool Exp $ */
+/* $Id: team.cpp,v 1.93 2005/09/18 23:32:23 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -316,10 +316,10 @@
cfg["shroud_data"] = shroud_.write();
}
-void team::get_village(const gamemap::location& loc)
+bool team::get_village(const gamemap::location& loc)
{
villages_.insert(loc);
- game_events::fire("capture",loc);
+ return game_events::fire("capture",loc);
}
void team::lose_village(const gamemap::location& loc)
Index: wesnoth/src/team.hpp
diff -u wesnoth/src/team.hpp:1.60 wesnoth/src/team.hpp:1.61
--- wesnoth/src/team.hpp:1.60 Sat Jul 2 21:37:19 2005
+++ wesnoth/src/team.hpp Sun Sep 18 23:32:23 2005
@@ -1,4 +1,4 @@
-/* $Id: team.hpp,v 1.60 2005/07/02 21:37:19 ott Exp $ */
+/* $Id: team.hpp,v 1.61 2005/09/18 23:32:23 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -107,7 +107,7 @@
void write(config& cfg) const;
- void get_village(const gamemap::location&);
+ bool get_village(const gamemap::location&);
void lose_village(const gamemap::location&);
void clear_villages();
const std::set<gamemap::location>& villages() const;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp actions.hpp team.cpp te...,
David White <=