Author: euschn
Date: Wed Jun 24 11:25:04 2009
New Revision: 36384

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36384&view=rev
Log:
removed gamestatus member from play_controller and game_events::resources_t

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

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Wed Jun 24 11:25:04 2009
@@ -1020,11 +1020,8 @@
                std::string add = cfg["add"];
                std::string current = cfg["current"];
                if(!add.empty()) {
-                       rsrc.status_ptr->modify_turns(add);
                        rsrc.controller->modify_turns(add);
                } else if(!value.empty()) {
-                       
rsrc.status_ptr->add_turns(-rsrc.status_ptr->number_of_turns());
-                       
rsrc.status_ptr->add_turns(lexical_cast_default<int>(value,-1));
                        
rsrc.controller->add_turns(-rsrc.controller->number_of_turns());
                        
rsrc.controller->add_turns(lexical_cast_default<int>(value,-1));
                }
@@ -1036,7 +1033,6 @@
                        if(new_turn_number_u < current_turn_number || 
(new_turn_number > rsrc.controller->number_of_turns() && 
rsrc.controller->number_of_turns() != -1)) {
                                ERR_NG << "attempted to change current turn 
number to one out of range (" << new_turn_number << ") or less than current 
turn\n";
                        } else if(new_turn_number_u != current_turn_number) {
-                               rsrc.status_ptr->set_turn(new_turn_number_u);
                                rsrc.controller->set_turn(new_turn_number_u);
                                rsrc.state_of_game->set_variable("turn_number", 
str_cast<size_t>(new_turn_number_u));
                                rsrc.screen->new_turn();
@@ -3339,7 +3335,6 @@
 // Adding/removing new time_areas dynamically with Standard Location Filters.
 WML_HANDLER_FUNCTION(time_area, /*event_info*/, cfg)
 {
-       gamestatus *status_ptr = game_events::resources->status_ptr;
        play_controller *controller = game_events::resources->controller;
 
                log_scope("time_area");
@@ -3351,7 +3346,6 @@
                        const std::vector<std::string> id_list =
                                utils::split(ids, ',', utils::STRIP_SPACES | 
utils::REMOVE_EMPTY);
                        foreach(const std::string& id, id_list) {
-                               status_ptr->remove_time_area(id);
                                controller->remove_time_area(id);
                                LOG_NG << "event WML removed time_area '" << id 
<< "'\n";
                        }
@@ -3369,7 +3363,6 @@
                        filter.restrict_size(game_config::max_loop);
                        filter.get_locations(locs);
                        config parsed_cfg = cfg.get_parsed_config();
-                       status_ptr->add_time_area(id, locs, parsed_cfg);
                        controller->add_time_area(id, locs, parsed_cfg);
                        LOG_NG << "event WML inserted time_area '" << id << 
"'\n";
                }
@@ -3797,7 +3790,7 @@
        manager::manager(const config& cfg, gamemap& map_,
                        unit_map& units_,
                        std::vector<team>& teams_,
-                       game_state& state_of_game_, gamestatus& status,
+                       game_state& state_of_game_,
                        play_controller& controller)
                : resources()
                , variable_manager(&state_of_game_)
@@ -3816,7 +3809,6 @@
                resources.units = &units_;
                resources.teams = &teams_;
                resources.state_of_game = &state_of_game_;
-               resources.status_ptr = &status;
                resources.lua_kernel = new LuaKernel;
                resources.controller = &controller;
                game_events::resources = &resources;

Modified: trunk/src/game_events.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.hpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/game_events.hpp (original)
+++ trunk/src/game_events.hpp Wed Jun 24 11:25:04 2009
@@ -26,7 +26,7 @@
 
 class game_display;
 class game_state;
-class gamestatus;
+class tod_manager;
 class team;
 class t_string;
 class unit;
@@ -57,7 +57,6 @@
                unit_map *units;
                std::vector<team> *teams;
                game_state *state_of_game;
-               gamestatus *status_ptr; //FIXME: give resources_t its own 
tod_manager
                LuaKernel *lua_kernel;
                play_controller *controller;
        };
@@ -75,7 +74,7 @@
                // and must remain valid for the life of the object.
                manager(const config& scenario_cfg, gamemap& map,
                                unit_map& units, std::vector<team>& teams,
-                               game_state& state_of_game, gamestatus& status,
+                               game_state& state_of_game,
                                play_controller& controller);
                ~manager();
                void set_gui(game_display&);

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Wed Jun 24 11:25:04 2009
@@ -59,7 +59,6 @@
        level_(level),
        teams_(),
        gamestate_(state_of_game),
-       status_(level, num_turns, &state_of_game),
        map_(game_config, level["map_data"]),
        units_(),
        undo_stack_(),
@@ -83,7 +82,6 @@
        set_victory_music_list(level_["victory_music"]);
        set_defeat_music_list(level_["defeat_music"]);
 
-       status_.teams = &teams_;
        game_config::add_color_info(level);
        hotkey::deactivate_all_scopes();
        hotkey::set_scope_active(hotkey::SCOPE_GENERAL);
@@ -131,7 +129,7 @@
        // as that functions use the manager state_of_game
        // Has to be done before registering any events!
        events_manager_.reset(new game_events::manager(level_,map_,
-                                                   units_,teams_, 
gamestate_,status_,*this));
+                                                   units_,teams_, 
gamestate_,*this));
 
        std::set<std::string> seen_save_ids;
 

Modified: trunk/src/play_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.hpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/play_controller.hpp (original)
+++ trunk/src/play_controller.hpp Wed Jun 24 11:25:04 2009
@@ -167,7 +167,6 @@
        const config& level_;
        std::vector<team> teams_;
        game_state& gamestate_;
-       gamestatus status_;
        gamemap map_;
        unit_map units_;
        undo_list undo_stack_;

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Wed Jun 24 11:25:04 2009
@@ -858,12 +858,8 @@
 }
 
 void playsingle_controller::check_time_over(){
-       //FIXME: remove these assertions once turn functionality is removed 
from gamestatus
-       assert (status_.turn() == turn());
-       assert (status_.number_of_turns() == number_of_turns());
-       assert (status_.get_time_of_day().id == 
tod_manager_.get_time_of_day().id);
        bool b = next_turn();
-       if(!status_.next_turn() && !b) {
+       if(!b) {
 
                if(non_interactive()) {
                        std::cout << "time over (draw)\n";

Modified: trunk/src/replay_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay_controller.cpp?rev=36384&r1=36383&r2=36384&view=diff
==============================================================================
--- trunk/src/replay_controller.cpp (original)
+++ trunk/src/replay_controller.cpp Wed Jun 24 11:25:04 2009
@@ -167,7 +167,6 @@
        tod_manager_= tod_manager_start_;
        recorder.start_replay();
        units_ = units_start_;
-       status_ = status_start_;
        gamestate_ = gamestate_start_;
        teams_ = teams_start_;
        statistics::fresh_stats();
@@ -178,7 +177,7 @@
                // failure)
                events_manager_.reset();
                events_manager_.reset(new game_events::manager(level_,map_,
-                                                               units_,teams_, 
gamestate_,status_, *this));
+                                                               units_,teams_, 
gamestate_, *this));
                events_manager_->set_gui(*gui_);
                events_manager_->set_soundsource(*soundsources_manager_);
        }
@@ -361,12 +360,7 @@
                player_number_++;
 
                if (static_cast<size_t>(player_number_) > teams_.size()) {
-                       //FIXME: remove these assertions once turn 
functionality is removed from gamestatus
-                       assert (status_.turn() == turn());
-                       assert (status_.number_of_turns() == number_of_turns());
-                       assert (status_.get_time_of_day().id == 
tod_manager_.get_time_of_day().id);
                        next_turn();
-                       status_.next_turn();
                        try {
                                finish_turn();
                        } catch (end_turn_exception) {


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

Reply via email to