Author: fendrin
Date: Tue Mar 15 04:11:53 2011
New Revision: 48916
URL: http://svn.gna.org/viewcvs/wesnoth?rev=48916&view=rev
Log:
Code cleanups.
Modified:
branches/editor/src/editor/editor_controller.cpp
branches/editor/src/editor/editor_controller.hpp
branches/editor/src/editor/editor_map.cpp
branches/editor/src/editor/map_context.cpp
Modified: branches/editor/src/editor/editor_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/editor_controller.cpp?rev=48916&r1=48915&r2=48916&view=diff
==============================================================================
--- branches/editor/src/editor/editor_controller.cpp (original)
+++ branches/editor/src/editor/editor_controller.cpp Tue Mar 15 04:11:53 2011
@@ -138,26 +138,32 @@
}
}
- //TODO avoid duplicate code
+ init_global_context();
+
+ refresh_all();
+ events::raise_draw_event();
+ if (default_tool_menu != NULL) {
+ const SDL_Rect& menu_loc =
default_tool_menu->location(get_display().screen_area());
+ show_menu(default_tool_menu->items(),menu_loc.x+1,menu_loc.y +
menu_loc.h + 1,false);
+ return;
+ }
+
+}
+
+void editor_controller::init_global_context()
+{
resources::game_map = &get_map();
resources::units = &get_map().get_units();
resources::teams = &get_map().get_teams();
+ //TODO see if we can use any of this
//resources::state_of_game = &gamestate_;
//resources::controller = this;
//resources::tod_manager = &tod_manager_;
//resources::undo_stack = &undo_stack_;
//resources::redo_stack = &redo_stack_;
//resources::persist = &persist_;
-
- refresh_all();
- events::raise_draw_event();
- if (default_tool_menu != NULL) {
- const SDL_Rect& menu_loc =
default_tool_menu->location(get_display().screen_area());
- show_menu(default_tool_menu->items(),menu_loc.x+1,menu_loc.y +
menu_loc.h + 1,false);
- return;
- }
-
-}
+}
+
void editor_controller::init_gui(CVideo& video)
{
@@ -262,10 +268,13 @@
foreach (const config &i, cfg.child_range("time")) {
tods_.push_back(time_of_day(i));
}
+ //TODO register the tod_manager and use the tods from the scenario
+ //resources::tod_manager = &tod_manager_;
}
void editor_controller::init_music(const config& game_config)
{
+ //TODO play music from the scenario we edit
const config &cfg = game_config.child("editor_music");
if (!cfg) {
ERR_ED << "No editor music defined\n";
@@ -447,8 +456,6 @@
resources::game_map = &get_map();
resources::units = &get_map().get_units();
resources::teams = &get_map().get_teams();
- //resources::units = &units_;
- //resources::teams = &teams_;
//resources::state_of_game = &gamestate_;
//resources::controller = this;
//resources::tod_manager = &tod_manager_;
@@ -558,7 +565,7 @@
/* This snippet of code seems interresting at this point:
get_map().get_state().build_team(dummy, "", get_map().get_teams(),
dummy, get_map()
, get_map().get_units(), true);
- */
+ */
teams.push_back(t);
get_display().load_flags();
Modified: branches/editor/src/editor/editor_controller.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/editor_controller.hpp?rev=48916&r1=48915&r2=48916&view=diff
==============================================================================
--- branches/editor/src/editor/editor_controller.hpp (original)
+++ branches/editor/src/editor/editor_controller.hpp Tue Mar 15 04:11:53 2011
@@ -335,6 +335,10 @@
void editor_settings_dialog_redraw_callback(int r, int g, int
b);
private:
+
+ /** init the global resources */
+ void init_global_context();
+
/** init the display object and general set-up */
void init_gui(CVideo& video);
Modified: branches/editor/src/editor/editor_map.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/editor_map.cpp?rev=48916&r1=48915&r2=48916&view=diff
==============================================================================
--- branches/editor/src/editor/editor_map.cpp (original)
+++ branches/editor/src/editor/editor_map.cpp Tue Mar 15 04:11:53 2011
@@ -423,15 +423,17 @@
void editor_map::setup(const config& level)
{
- resources::game_map = this;
- resources::units = &units_;
- resources::teams = &teams_;
- resources::state_of_game = &state_;
+ //TODO this is done in the controller
+ //resources::game_map = this;
+ //resources::units = &units_;
+ //resources::teams = &teams_;
+ //TODO state_of_game, do we need it?
+ //resources::state_of_game = &state_;
//TODO make the controller available?
// resources::controller = this;
- resources::tod_manager = &tod_manager_;
-
- foreach (const config &side, level.child_range("side"))
+ //resources::tod_manager = &tod_manager_;
+
+ foreach (const config& side, level.child_range("side"))
{
//TODO clean up.
// state_.build_team(side, "", teams_, level, *this
Modified: branches/editor/src/editor/map_context.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/map_context.cpp?rev=48916&r1=48915&r2=48916&view=diff
==============================================================================
--- branches/editor/src/editor/map_context.cpp (original)
+++ branches/editor/src/editor/map_context.cpp Tue Mar 15 04:11:53 2011
@@ -71,7 +71,6 @@
, needs_labels_reset_(false)
, changed_locations_()
, everything_changed_(false)
-// , labels_(NULL)
{
log_scope2(log_editor, "Loading map " + filename);
if (!file_exists(filename) || is_directory(filename)) {
@@ -118,10 +117,10 @@
read(cfg, *(preprocess_file(filename_)));
if (boost::regex_match(map_string, re_scenario)) {
cfg = cfg.child_or_empty("scenario");
-//TODO add the writeable member
- // writeable_ = false;
+ //TODO add the writeable member
+ //writeable_ = false;
} else {
-// writeable_ = true;
+ //writeable_ = true;
}
// foreach (const config &i, cfg.child_range("label"))
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits