diff --git a/data/maps/map-test b/data/maps/map-test index b3273b661c9..4215a898313 100644 --- a/data/maps/map-test +++ b/data/maps/map-test @@ -2,9 +2,9 @@ gggggggggggggggg gggggggggggggggg fffffggggggggggg fffffggggggggggg -fffffggggggggggg -fffffggggggggggg -fffffggggggggggg +fffffggggSSSSggg +fffffggggSSSSggg +fffffgggggSSSggg fffffggggggggggg fffffCCggggggggg ggC1CC2ggggggggg diff --git a/data/scenario-test.cfg b/data/scenario-test.cfg index d01c9d66cf0..8cfe0efbbf7 100644 --- a/data/scenario-test.cfg +++ b/data/scenario-test.cfg @@ -17,7 +17,7 @@ canrecruit=1 controller=human hitpoints=10 - recruit=Elvish Hero,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman + recruit=Elvish Hero,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman,Red Mage enemy=2 [/side] diff --git a/data/terrain.cfg b/data/terrain.cfg index 6fec86dd93a..940ab3ac9b9 100644 --- a/data/terrain.cfg +++ b/data/terrain.cfg @@ -61,6 +61,15 @@ blue=200 no_overlay=true [/terrain] +[terrain] +image=snow +name=tundra +char=S +red=255 +green=255 +blue=255 +[/terrain] + [terrain] image=hills name=hills diff --git a/src/playturn.cpp b/src/playturn.cpp index e861f800f7e..68d2dd268d5 100644 --- a/src/playturn.cpp +++ b/src/playturn.cpp @@ -170,15 +170,12 @@ void play_turn(game_data& gameinfo, game_state& state_of_game, //temporarily set moves to full to see how far //it could move - const int movement = u->second.movement_left(); - u->second.set_movement(u->second.total_movement()); + const unit_movement_resetter move_change(u->second); + current_paths = paths(map,gameinfo,units,new_hex,teams, ignore_zocs,teleport); gui.set_paths(¤t_paths); enemy_paths = true; - - //restore unit's movement - u->second.set_movement(movement); } } diff --git a/src/unit.hpp b/src/unit.hpp index f449122fa7a..eb676feb090 100644 --- a/src/unit.hpp +++ b/src/unit.hpp @@ -24,6 +24,8 @@ class unit { public: + friend struct unit_movement_resetter; + unit(game_data& data, const config& cfg); unit(const unit_type* t, int side, bool use_traits=false); @@ -145,6 +147,24 @@ private: void apply_modifications(); }; +//object which temporarily resets a unit's movement +struct unit_movement_resetter +{ + unit_movement_resetter(unit& u) : u_(u), moves_(u.moves_) + { + u.moves_ = u.total_movement(); + } + + ~unit_movement_resetter() + { + u_.moves_ = moves_; + } + +private: + unit& u_; + int moves_; +}; + struct compare_unit_values { bool operator()(const unit& a, const unit& b) const;