mail[Wesnoth-commits] r43982 - /trunk/src/tod_manager.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on July 07, 2010 - 14:46:
Author: alink
Date: Wed Jul  7 14:46:54 2010
New Revision: 43982

URL: http://svn.gna.org/viewcvs/wesnoth?rev=43982&view=rev
Log:
small cleaning in tod_manager
- probably fix [store_time_of_day] for a much earlier turn
- remove useless validation (we add a dummy when empty)

Modified:
    trunk/src/tod_manager.cpp

Modified: trunk/src/tod_manager.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/tod_manager.cpp?rev=43982&r1=43981&r2=43982&view=diff
==============================================================================
--- trunk/src/tod_manager.cpp (original)
+++ trunk/src/tod_manager.cpp Wed Jul  7 14:46:54 2010
@@ -100,8 +100,6 @@
 
 time_of_day tod_manager::get_time_of_day() const
 {
-       VALIDATE(times_.size(), _("No time of day has been defined."));
-
        return times_[currentTime_];
 }
 
@@ -121,7 +119,7 @@
 
 time_of_day tod_manager::get_previous_time_of_day() const
 {
-       return get_time_of_day_turn(turn() - 1);
+       return get_time_of_day_turn(turn_ - 1);
 }
 
 time_of_day tod_manager::get_time_of_day(int illuminated, const 
map_location& loc, int n_turn) const
@@ -149,7 +147,7 @@
 
 time_of_day tod_manager::get_time_of_day(int illuminated, const 
map_location& loc) const
 {
-       return get_time_of_day(illuminated, loc, turn());
+       return get_time_of_day(illuminated, loc, turn_);
 }
 
 bool tod_manager::is_start_ToD(const std::string& random_start_time)
@@ -242,12 +240,9 @@
 
 time_of_day tod_manager::get_time_of_day_turn(int nturn) const
 {
-       VALIDATE(times_.size(), _("No time of day has been defined."));
-
-       int time = (currentTime_ + nturn  - turn_)% times_.size();
-
-       if (time < 0)
-       {
+       int time = (currentTime_ + nturn  - turn_) % times_.size();
+
+       while(time < 0) {
                time += times_.size();
        }
 
@@ -301,7 +296,6 @@
 
 void tod_manager::set_turn(unsigned int num)
 {
-       VALIDATE(times_.size(), _("No time of day has been defined."));
        const unsigned int old_num = turn_;
        // Correct ToD
        int current_time = (currentTime_ + num - old_num) % times_.size();
@@ -320,8 +314,6 @@
 
 bool tod_manager::next_turn()
 {
-       VALIDATE(times_.size(), _("No time of day has been defined."));
-
        currentTime_ = (currentTime_ + 1)%times_.size();
        ++turn_;
        return is_time_left();




Related Messages


Powered by MHonArc, Updated Wed Jul 07 15:00:11 2010