Whiteboard: validate planned actions of the viewer side...

...after any move, attack or recruit.
This commit is contained in:
Gabriel Morin 2010-07-30 04:12:18 +00:00
parent ad7f0e9e9d
commit 6b4e0fe4d0
3 changed files with 15 additions and 0 deletions

View file

@ -39,6 +39,7 @@
#include "wml_exception.hpp"
#include "formula_string_utils.hpp"
#include "tod_manager.hpp"
#include "whiteboard/manager.hpp"
#include <boost/bind.hpp>
@ -485,6 +486,8 @@ void place_recruit(const unit &u, const map_location &recruit_location,
cfg["checksum"] = checksum;
set_random_results(cfg);
}
resources::whiteboard->on_gamestate_change();
}
map_location under_leadership(const unit_map& units,
@ -1181,6 +1184,7 @@ void attack_unit(const map_location &attacker, const map_location &defender,
{
attack dummy(attacker, defender, attack_with, defend_with, update_display);
dummy.perform();
resources::whiteboard->on_gamestate_change();
}
attack::attack(const map_location &attacker, const map_location &defender,
@ -1973,6 +1977,8 @@ void advance_unit(map_location loc, const std::string &advance_to)
resources::units->replace(loc, new_unit);
LOG_NG << "firing post_advance event at " << loc << "\n";
game_events::fire("post_advance",loc);
resources::whiteboard->on_gamestate_change();
}
int combat_modifier(const map_location &loc,
@ -2558,6 +2564,8 @@ size_t move_unit(move_unit_spectator *move_spectator,
assert(steps.size() <= route.size());
resources::whiteboard->on_gamestate_change();
return steps.size();
}

View file

@ -305,6 +305,12 @@ void manager::on_mouseover_change(const map_location& hex)
}
}
void manager::on_gamestate_change()
{
DBG_WB << "Manager received gamestate change notification, validating actions.\n";
validate_viewer_actions();
}
void manager::create_temp_move()
{
route_.reset();

View file

@ -65,6 +65,7 @@ public:
void on_mouseover_change(const map_location& hex);
void on_select_hex(){}
void on_deselect_hex(){ erase_temp_move();}
void on_gamestate_change();
side_actions_ptr viewer_actions() const;
side_actions_ptr current_side_actions() const;