fix AI not getting rest-healing, leading to replay OOS

This commit is contained in:
András Salamon 2005-08-11 14:42:36 +00:00
parent 6844934041
commit f93fa922ff
4 changed files with 12 additions and 6 deletions

View file

@ -6,6 +6,8 @@ CVS HEAD:
* campaigns
* Eastern Invasion: further revisions for Weldyn Under Attack
* fixed fonts sometimes not being found
* fixed campaign dialog with no campaigns trying forever to download (#14078)
* fixed AI units not getting rest-healing, causing replay errors
* various bug fixes and code cleanups
Version 0.9.5:

View file

@ -28,6 +28,7 @@
#include "preferences.hpp"
#include "replay.hpp"
#include "statistics.hpp"
#include "unit.hpp"
#include "unit_display.hpp"
#include "util.hpp"
#include "wassert.hpp"
@ -375,7 +376,10 @@ gamemap::location ai_interface::move_unit(location from, location to, std::map<l
const location loc = move_unit_partial(from,to,possible_moves);
const unit_map::iterator u = info_.units.find(loc);
if(u != info_.units.end()) {
u->second.set_movement(0);
if (from == to)
u->second.set_movement(unit::NOT_MOVED);
else
u->second.set_movement(0);
}
return loc;

View file

@ -259,7 +259,7 @@ int unit::movement_left() const
bool unit::can_attack() const
{
return moves_ != -1;
return moves_ != ATTACKED;
}
void unit::set_movement(int moves)

View file

@ -163,6 +163,10 @@ public:
bool move_interrupted() const;
const gamemap::location& get_interrupted_move() const;
void set_interrupted_move(const gamemap::location& interrupted_move);
//is set to the number of moves left, ATTACKED if attacked,
// MOVED if moved and then pressed "end turn"
// NOT_MOVED if not moved and pressed "end turn"
enum MOVES { ATTACKED=-1, MOVED=-2, NOT_MOVED=-3 };
private:
unit_race::GENDER generate_gender(const unit_type& type, bool use_genders);
unit_race::GENDER gender_;
@ -184,10 +188,6 @@ private:
int side_;
//is set to the number of moves left, ATTACKED if attacked,
// MOVED if moved and then pressed "end turn"
// NOT_MOVED if not moved and pressed "end turn"
enum MOVES { ATTACKED=-1, MOVED=-2, NOT_MOVED=-3 };
int moves_;
bool user_end_turn_;
bool facingLeft_;