Author: soliton
Date: Wed Oct 21 23:46:03 2009
New Revision: 39403

URL: http://svn.gna.org/viewcvs/wesnoth?rev=39403&view=rev
Log:
implemented current_side() function in play_controller and made use of it to 
fix some todos

Modified:
    trunk/src/game_events.cpp
    trunk/src/play_controller.hpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=39403&r1=39402&r2=39403&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Wed Oct 21 23:46:03 2009
@@ -1490,9 +1490,7 @@
 
                        // Otherwise get the random value from the replay data
                        else {
-                               /** @todo FIXME: get player_number_ from the 
play_controller, not from the WML vars. */
-                               const t_string& side_str = 
resources::state_of_game->get_variable("side_number");
-                               const int side = 
lexical_cast_default<int>(side_str.base_str(), -1);
+                               const int side = 
resources::controller->current_side();
 
                                do_replay_handle(side, "random_number");
                                const config* const action = 
get_replay_source().get_next_action();
@@ -2559,13 +2557,9 @@
                                        }
                                }
 
+                               const int side = controller->current_side();
                                if(utils::string_bool(cfg["advance"], true) && 
get_replay_source().at_end()) {
                                        // Try to advance the unit
-
-                                       /** @todo FIXME: get player_number_ 
from the play_controller, not from the WML vars. */
-                                       const t_string& side_str = 
resources::state_of_game->get_variable("side_number");
-                                       const int side = 
lexical_cast_default<int>(side_str.base_str(), -1);
-
                                        // Select advancement if it is on the 
playing side and the player is a human
                                        const bool sel = (side == 
static_cast<int>(u.side())
                                                        && 
(*resources::teams)[side-1].is_human());
@@ -3313,11 +3307,7 @@
 
                        // Otherwise if an input has to be made, get it from 
the replay data
                } else {
-                       /** @todo FIXME: get player_number_ from the 
play_controller, not from the WML vars. */
-                       const t_string& side_str = 
resources::state_of_game->get_variable("side_number");
-                       const int side = 
lexical_cast_default<int>(side_str.base_str(), -1);
-
-
+                       const int side = controller->current_side();
 
                        if(!options.empty()) {
                                do_replay_handle(side, "choose");

Modified: trunk/src/play_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.hpp?rev=39403&r1=39402&r2=39403&view=diff
==============================================================================
--- trunk/src/play_controller.hpp (original)
+++ trunk/src/play_controller.hpp Wed Oct 21 23:46:03 2009
@@ -116,6 +116,8 @@
         */
        bool next_turn() {return tod_manager_.next_turn();}
 
+       int current_side() { return player_number_; }
+
        void add_time_area(const config& cfg) {tod_manager_.add_time_area(cfg);}
        void add_time_area(const std::string& id, const std::set<map_location>& 
locs,
                                const config& time_cfg) 
{tod_manager_.add_time_area(id, locs, time_cfg);}


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

Reply via email to