Restored resources::units in a limited context
This is a partial revert of ed15163b95
. Most place still use resources::gameboard->units(), but
they should still point to the same place.
This was done since the editor doesn't have a game_board and needs a way to specify a global unit_map.
This commit is contained in:
parent
fb3cae64df
commit
f9dadbb80a
5 changed files with 9 additions and 1 deletions
|
@ -160,6 +160,7 @@ void editor_controller::init_music(const config& game_config)
|
|||
|
||||
editor_controller::~editor_controller()
|
||||
{
|
||||
resources::units = nullptr;
|
||||
resources::tod_manager = nullptr;
|
||||
resources::gameboard = nullptr;
|
||||
|
||||
|
|
|
@ -80,10 +80,10 @@ public:
|
|||
|
||||
// TODO register the tod_manager with the gui?
|
||||
resources::tod_manager = context_manager_.get_map_context().get_time_manager();
|
||||
resources::units = &context_manager_.get_map_context().get_units();
|
||||
|
||||
context_manager_.gui().replace_overlay_map(&context_manager_.get_map_context().get_overlays());
|
||||
|
||||
|
||||
resources::classification = &context_manager_.get_map_context().get_classification();
|
||||
|
||||
context_manager_.gui().init_flags();
|
||||
|
|
|
@ -125,6 +125,7 @@ static void clear_resources()
|
|||
resources::tunnels = nullptr;
|
||||
resources::undo_stack = nullptr;
|
||||
resources::recorder = nullptr;
|
||||
resources::units = nullptr;
|
||||
resources::whiteboard.reset();
|
||||
resources::classification = nullptr;
|
||||
}
|
||||
|
@ -212,6 +213,7 @@ void play_controller::init(CVideo& video, const config& level)
|
|||
resources::gameboard = &gamestate().board_;
|
||||
resources::gamedata = &gamestate().gamedata_;
|
||||
resources::tod_manager = &gamestate().tod_manager_;
|
||||
resources::units = &gamestate().board_.units_;
|
||||
resources::filter_con = &gamestate();
|
||||
resources::undo_stack = &undo_stack();
|
||||
resources::game_events = gamestate().events_manager_.get();
|
||||
|
@ -295,6 +297,7 @@ void play_controller::reset_gamestate(const config& level, int replay_pos)
|
|||
resources::gameboard = nullptr;
|
||||
resources::gamedata = nullptr;
|
||||
resources::tod_manager = nullptr;
|
||||
resources::units = nullptr;
|
||||
resources::filter_con = nullptr;
|
||||
resources::lua_kernel = nullptr;
|
||||
resources::game_events = nullptr;
|
||||
|
@ -307,6 +310,7 @@ void play_controller::reset_gamestate(const config& level, int replay_pos)
|
|||
resources::gameboard = &gamestate().board_;
|
||||
resources::gamedata = &gamestate().gamedata_;
|
||||
resources::tod_manager = &gamestate().tod_manager_;
|
||||
resources::units = &gamestate().board_.units_;
|
||||
resources::filter_con = &gamestate();
|
||||
resources::undo_stack = &undo_stack();
|
||||
resources::game_events = gamestate().events_manager_.get();
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace resources
|
|||
fake_unit_manager *fake_units = nullptr;
|
||||
pathfind::manager *tunnels = nullptr;
|
||||
actions::undo_list *undo_stack = nullptr;
|
||||
unit_map *units = nullptr;
|
||||
std::shared_ptr<wb::manager> whiteboard = std::shared_ptr<wb::manager>();
|
||||
game_classification *classification = nullptr;
|
||||
bool simulation_ = false;
|
||||
|
|
|
@ -28,6 +28,7 @@ class game_lua_kernel;
|
|||
class play_controller;
|
||||
class fake_unit_manager;
|
||||
class tod_manager;
|
||||
class unit_map;
|
||||
class persist_manager;
|
||||
class game_classification;
|
||||
struct mp_game_settings;
|
||||
|
@ -61,6 +62,7 @@ namespace resources
|
|||
extern ::tod_manager *tod_manager;
|
||||
extern pathfind::manager *tunnels;
|
||||
extern actions::undo_list *undo_stack;
|
||||
extern unit_map *units;
|
||||
extern std::shared_ptr<wb::manager> whiteboard;
|
||||
extern bool simulation_;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue