Author: shadowmaster
Date: Tue Sep 16 20:24:02 2008
New Revision: 29490

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29490&view=rev
Log:
* A small optimization/validation pass added in case the passed location
* is not generally valid in get_time_of_day() overload

Modified:
    trunk/src/gamestatus.cpp

Modified: trunk/src/gamestatus.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=29490&r1=29489&r2=29490&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Tue Sep 16 20:24:02 2008
@@ -281,16 +281,17 @@
 {
        time_of_day res = get_time_of_day_turn(n_turn);
 
-       for(std::vector<area_time_of_day>::const_iterator i = areas_.begin(); i 
!= areas_.end(); ++i) {
-               if(i->hexes.count(loc) == 1) {
-
-                       VALIDATE(i->times.size(), _("No time of day has been 
defined."));
-
-                       res = i->times[(n_turn-1)%i->times.size()];
-                       break;
-               }
-       }
-
+       if(loc.valid()) {
+               for(std::vector<area_time_of_day>::const_iterator i = 
areas_.begin(); i != areas_.end(); ++i) {
+                       if(i->hexes.count(loc) == 1) {
+       
+                               VALIDATE(i->times.size(), _("No time of day has 
been defined."));
+       
+                               res = i->times[(n_turn-1)%i->times.size()];
+                               break;
+                       }
+               }
+       }
 
        if(illuminated) {
                res.bonus_modified=illuminated;


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to