[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src playturn.cpp playturn.hpp
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src playturn.cpp playturn.hpp |
Date: |
Sun, 29 Aug 2004 21:08:40 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 04/08/30 01:03:59
Modified files:
src : playturn.cpp playturn.hpp
Log message:
made it so that cycling units with 'n' doesn't show enemy invisible
units while it's their turn
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.259&tr2=1.260&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.hpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
Patches:
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.259 wesnoth/src/playturn.cpp:1.260
--- wesnoth/src/playturn.cpp:1.259 Sun Aug 29 23:28:26 2004
+++ wesnoth/src/playturn.cpp Mon Aug 30 01:03:59 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.259 2004/08/29 23:28:26 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.260 2004/08/30 01:03:59 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1072,6 +1072,20 @@
hotkey::execute_command(gui_,cmd,this);
}
+bool turn_info::unit_in_cycle(unit_map::const_iterator it) const
+{
+ if(it->second.side() == team_num_ &&
+ unit_can_move(it->first,units_,map_,teams_) &&
+ it->second.user_end_turn() == false &&
+ !gui_.fogged(it->first.x,it->first.y)) {
+ const bool is_enemy =
current_team().is_enemy(int(gui_.viewing_team()+1));
+ return is_enemy == false ||
it->second.invisible(map_.underlying_terrain(it->first),status_.get_time_of_day().lawful_bonus,it->first,units_,teams_)
== false;
+ }
+
+ return false;
+
+}
+
void turn_info::cycle_units()
{
@@ -1079,10 +1093,7 @@
unit_map::const_iterator yellow_it = units_.end();
if(it != units_.end()) {
for(++it; it != units_.end(); ++it) {
- if(it->second.side() == team_num_ &&
- unit_can_move(it->first,units_,map_,teams_) &&
- it->second.user_end_turn() == false &&
- !gui_.fogged(it->first.x,it->first.y)) {
+ if(unit_in_cycle(it)) {
break;
}
}
@@ -1090,11 +1101,9 @@
if(it == units_.end()) {
for(it = units_.begin(); it != units_.end(); ++it) {
- if(it->second.side() == team_num_ &&
- unit_can_move(it->first,units_,map_,teams_) &&
- it->second.user_end_turn() == false &&
- !gui_.fogged(it->first.x,it->first.y))
+ if(unit_in_cycle(it)) {
break;
+ }
}
}
Index: wesnoth/src/playturn.hpp
diff -u wesnoth/src/playturn.hpp:1.50 wesnoth/src/playturn.hpp:1.51
--- wesnoth/src/playturn.hpp:1.50 Sun Aug 29 11:48:34 2004
+++ wesnoth/src/playturn.hpp Mon Aug 30 01:03:59 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.hpp,v 1.50 2004/08/29 11:48:34 isaaccp Exp $ */
+/* $Id: playturn.hpp,v 1.51 2004/08/30 01:03:59 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -121,6 +121,8 @@
const team& current_team() const { return teams_[team_num_-1]; }
void write_game_snapshot(config& cfg) const;
+
+ bool unit_in_cycle(unit_map::const_iterator it) const;
//overridden from command_executor
virtual void cycle_units();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src playturn.cpp playturn.hpp,
David White <=