Author: silene
Date: Sat May 9 15:40:50 2009
New Revision: 35500
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35500&view=rev
Log:
Hid some implementations away from the interface.
Modified:
trunk/src/unit.cpp
trunk/src/unit.hpp
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=35500&r1=35499&r2=35500&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat May 9 15:40:50 2009
@@ -2970,6 +2970,36 @@
return *this;
}
+void unit::refresh(const game_display &disp,const map_location &loc)
+{
+ if (state_ == STATE_FORGET && anim_ &&
anim_->animation_finished_potential()) {
+ set_standing(loc);
+ return;
+ }
+ if (state_ != STATE_STANDING || get_current_animation_tick() <
next_idling_
+ || incapacitated())
+ return;
+ if (get_current_animation_tick() > next_idling_ + 1000) {
+ // prevent all units animating at the same time
+ set_standing(loc);
+ } else {
+ set_idling(disp, loc);
+ }
+}
+
+unit_movement_resetter::unit_movement_resetter(unit &u, bool operate) :
+ u_(u), moves_(u.movement_)
+{
+ if (operate) {
+ u.movement_ = u.total_movement();
+ }
+}
+
+unit_movement_resetter::~unit_movement_resetter()
+{
+ u_.movement_ = moves_;
+}
+
int team_units(const unit_map& units, unsigned int side)
{
int res = 0;
Modified: trunk/src/unit.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=35500&r1=35499&r2=35500&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sat May 9 15:40:50 2009
@@ -145,18 +145,7 @@
void end_turn();
void new_scenario();
/** Called on every draw */
- void refresh(const game_display& disp,const map_location& loc) {
- if (state_ == STATE_FORGET && anim_ &&
anim_->animation_finished_potential()) {
- set_standing( loc);
- return;
- }
- if (state_ != STATE_STANDING || (get_current_animation_tick() <
next_idling_) || incapacitated()) return;
- if (get_current_animation_tick() > next_idling_ + 1000) { //
prevent all units animating at the same
- set_standing(loc);
- } else {
- set_idling(disp, loc);
- }
- }
+ void refresh(const game_display& disp,const map_location& loc);
bool take_hit(int damage) { hit_points_ -= damage; return hit_points_
<= 0; }
void heal(int amount);
@@ -465,17 +454,8 @@
/** Object which temporarily resets a unit's movement */
struct unit_movement_resetter
{
- unit_movement_resetter(unit& u, bool operate=true) : u_(u),
moves_(u.movement_)
- {
- if(operate) {
- u.movement_ = u.total_movement();
- }
- }
-
- ~unit_movement_resetter()
- {
- u_.movement_ = moves_;
- }
+ unit_movement_resetter(unit& u, bool operate=true);
+ ~unit_movement_resetter();
private:
unit& u_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits