Author: silene
Date: Thu May 21 16:57:23 2009
New Revision: 35783
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35783&view=rev
Log:
Uninlined complicated function.
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=35783&r1=35782&r2=35783&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Thu May 21 16:57:23 2009
@@ -3108,6 +3108,32 @@
return &ui->second;
}
+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_ ||
+ !disp.tile_nearly_on_screen(loc) || incapacitated())
+ {
+ return;
+ }
+ if (get_current_animation_tick() > next_idling_ + 1000)
+ {
+ // prevent all units animating at the same time
+ if (disp.idle_anim()) {
+ next_idling_ = get_current_animation_tick()
+ + static_cast<int>((20000 + rand() % 20000) *
disp.idle_anim_rate());
+ } else {
+ next_idling_ = INT_MAX;
+ }
+ } else {
+ set_idling(disp, loc);
+ }
+}
+
team_data calculate_team_data(const team& tm, int side, const unit_map& units)
{
team_data res;
Modified: trunk/src/unit.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=35783&r1=35782&r2=35783&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Thu May 21 16:57:23 2009
@@ -145,28 +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_ ||
- !disp.tile_nearly_on_screen(loc) ||
- incapacitated())
- return;
- if (get_current_animation_tick() > next_idling_ + 1000) {
- // prevent all units animating at the same time
- if (disp.idle_anim()) {
- next_idling_ = get_current_animation_tick()
- + static_cast<int>((20000 + rand() %
20000) * disp.idle_anim_rate());
- } else {
- next_idling_ = INT_MAX;
- }
- } 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);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits