mail[Wesnoth-commits] r37248 - /trunk/src/ai/actions.cpp


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

Header


Content

Posted by AI0867 on July 26, 2009 - 23:04:
Author: ai0867
Date: Sun Jul 26 23:04:51 2009
New Revision: 37248

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37248&view=rev
Log:
Silence a warning that when we [end_turn], the result of the formula isn't 
checked.

Modified:
    trunk/src/ai/actions.cpp

Modified: trunk/src/ai/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/actions.cpp?rev=37248&r1=37247&r2=37248&view=diff
==============================================================================
--- trunk/src/ai/actions.cpp (original)
+++ trunk/src/ai/actions.cpp Sun Jul 26 23:04:51 2009
@@ -293,7 +293,12 @@
 
        check_victory();
        set_gamestate_changed();
-       manager::raise_enemy_attacked();
+       try {
+               manager::raise_enemy_attacked();
+       } catch (end_turn_exception&) {
+               is_ok(); //Silences "unchecked result" warning
+               throw;
+       }
 }
 
 
@@ -450,8 +455,12 @@
 
 
        set_gamestate_changed();
-       manager::raise_unit_moved();
-
+       try {
+               manager::raise_unit_moved();
+       } catch (end_turn_exception&) {
+               is_ok(); //Silences "unchecked result" warning
+               throw;
+       }
 }
 
 
@@ -670,7 +679,12 @@
                // Confirm the transaction - i.e. don't undo recruitment
                replay_guard.confirm_transaction();
                set_gamestate_changed();
-               manager::raise_unit_recruited();
+               try {
+                       manager::raise_unit_recruited();
+               } catch (end_turn_exception&) {
+                       is_ok(); //Silences "unchecked result" warning
+                       throw;
+               }
        } else {
                set_error(AI_ACTION_FAILURE);
        }
@@ -769,15 +783,20 @@
        assert(is_success());
        const game_info& info = get_info();
        unit_map::iterator un = info.units.find(unit_location_);
-       if (remove_movement_){
-               un->second.set_movement(0);
-               set_gamestate_changed();
-               manager::raise_unit_moved();
-       }
-       if (remove_attacks_){
-               un->second.set_attacks(0);
-               set_gamestate_changed();
-               manager::raise_unit_moved();//to be on the safe side
+       try {
+               if (remove_movement_){
+                       un->second.set_movement(0);
+                       set_gamestate_changed();
+                       manager::raise_unit_moved();
+               }
+               if (remove_attacks_){
+                       un->second.set_attacks(0);
+                       set_gamestate_changed();
+                       manager::raise_unit_moved();//to be on the safe side
+               }
+       } catch (end_turn_exception&) {
+               is_ok(); //Silences "unchecked result" warning
+               throw;
        }
 }
 




Related Messages


Powered by MHonArc, Updated Sun Jul 26 23:21:17 2009