attempt to fix whitboard crash during ai turn.

https://gna.org/bugs/?22527
This commit is contained in:
gfgtdf 2016-04-08 00:56:47 +02:00
parent 2d0721185f
commit 2b6442abc2
2 changed files with 3 additions and 1 deletions

View file

@ -52,6 +52,7 @@
#include "team.hpp"
#include "units/unit.hpp"
#include "units/ptr.hpp"
#include "whiteboard/manager.hpp"
namespace ai {
@ -286,6 +287,7 @@ void attack_result::do_execute()
//FIXME: find a way to 'ask' the ai which advancement should be chosen from synced_commands.cpp .
if(!synced_context::is_synced()) //RAII block for set_scontext_synced
{
wb::real_map rm;
//we don't use synced_context::run_in_synced_context because that wouldn't allow us to pass advancements_
resources::recorder->add_synced_command("attack", replay_helper::get_attack(attacker_loc_, defender_loc_, attacker_weapon, defender_weapon, a_->type_id(),
d_->type_id(), a_->level(), d_->level(), resources::tod_manager->turn(),

View file

@ -513,7 +513,7 @@ namespace
void manager::pre_draw()
{
if (can_modify_game_state() && has_actions()) {
if (can_modify_game_state() && has_actions() && unit_map_lock_.unique()) {
move_owners_finder move_finder;
for_each_action(std::ref(move_finder));
units_owning_moves_ = move_finder.get_units_owning_moves();