Author: tschmitz
Date: Thu Jul 21 21:10:30 2011
New Revision: 50366
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50366&view=rev
Log:
Cleanup from previous commit. Fixed bugs.
Modified:
trunk/src/mouse_events.cpp
trunk/src/playsingle_controller.cpp
trunk/src/whiteboard/recall.cpp
trunk/src/whiteboard/recruit.cpp
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=50366&r1=50365&r2=50366&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Thu Jul 21 21:10:30 2011
@@ -226,36 +226,29 @@
dest = new_hex;
dest_un = find_unit(new_hex);
}
+
+ if(dest == selected_hex_ || dest_un != units_.end()) {
+ current_route_.steps.clear();
+ gui().set_route(NULL);
+ resources::whiteboard->erase_temp_move();
+ }
+ else if (!current_paths_.destinations.empty() &&
+ map_.on_board(selected_hex_) &&
map_.on_board(new_hex))
+ {
+ if (selected_unit != units_.end() &&
!selected_unit->incapacitated()) {
+ // Show the route from selected unit to
mouseover hex
+ current_route_ =
get_route(&*selected_unit, dest, waypoints_, viewing_team());
+
+ { wb::scoped_real_unit_map raii;
+
resources::whiteboard->create_temp_move();
+ }
+
+ if(!browse) {
+
gui().set_route(¤t_route_);
+ }
+ }
+ }
} // end planned unit map scope
-
- if(dest == selected_hex_ || dest_un != units_.end()) {
- current_route_.steps.clear();
- gui().set_route(NULL);
- resources::whiteboard->erase_temp_move();
- }
- else if (!current_paths_.destinations.empty() &&
- map_.on_board(selected_hex_) &&
map_.on_board(new_hex))
- {
- if (selected_unit != units_.end() &&
!selected_unit->incapacitated()) {
-
- // Show the route from selected unit to
mouseover hex
- // the movement_reset is active only if it's
not the unit's turn
- // Note: we should activate the whiteboard's
planned unit map only after this is done,
- // since the future state includes changes to
the units' movement points
- unit_movement_resetter
move_reset(*selected_unit,
- selected_unit->side() !=
side_num_);
-
- { wb::scoped_planned_unit_map future; //< start
planned unit map scope
- current_route_ =
get_route(&*selected_unit, dest, waypoints_, viewing_team());
- } // end planned unit map scope
-
- resources::whiteboard->create_temp_move();
-
- if(!browse) {
- gui().set_route(¤t_route_);
- }
- }
- }
unit* un;
{ // start planned unit map scope
@@ -675,14 +668,6 @@
next_unit_ = u->get_location();
{
- // if it's not the unit's turn, we reset its moves
- // and we restore them before the "select" event is
raised
- // Ensure the planned unit map is reapplied afterwards,
otherwise it screws up the future state
- { // start enforced real unit map scope
- wb::scoped_real_unit_map real_unit_map;
- unit_movement_resetter move_reset(*u, u->side()
!= side_num_);
- } // end enforced real unit map scope
-
current_paths_ = pathfind::paths(map_, units_, hex,
teams_,
false, true, viewing_team(), path_turns_);
}
Modified: trunk/src/playsingle_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=50366&r1=50365&r2=50366&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Thu Jul 21 21:10:30 2011
@@ -245,10 +245,10 @@
void playsingle_controller::whiteboard_suppose_dead()
{
- unit_map::iterator curr_unit;
+ unit* curr_unit;
map_location loc;
{ wb::scoped_planned_unit_map raii;
- curr_unit = menu_handler_.current_unit();
+ curr_unit = &*menu_handler_.current_unit();
loc = curr_unit->get_location();
}
whiteboard_manager_->save_suppose_dead(*curr_unit,loc);
Modified: trunk/src/whiteboard/recall.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/recall.cpp?rev=50366&r1=50365&r2=50366&view=diff
==============================================================================
--- trunk/src/whiteboard/recall.cpp (original)
+++ trunk/src/whiteboard/recall.cpp Thu Jul 21 21:10:30 2011
@@ -91,6 +91,9 @@
void recall::init()
{
+ temp_unit_->set_movement(0);
+ temp_unit_->set_attacks(0);
+
fake_unit_->set_location(recall_hex_);
fake_unit_->set_movement(0);
fake_unit_->set_attacks(0);
Modified: trunk/src/whiteboard/recruit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/recruit.cpp?rev=50366&r1=50365&r2=50366&view=diff
==============================================================================
--- trunk/src/whiteboard/recruit.cpp (original)
+++ trunk/src/whiteboard/recruit.cpp Thu Jul 21 21:10:30 2011
@@ -170,7 +170,10 @@
int side_num = team_index() + 1;
//real_unit = false needed to avoid generating random traits and
causing OOS
bool real_unit = false;
- return new unit(type, side_num, real_unit);
+ unit* result = new unit(type, side_num, real_unit);
+ result->set_movement(0);
+ result->set_attacks(0);
+ return result;
}
config recruit::to_config() const
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits