Author: ilor
Date: Sun Jul 13 03:31:47 2008
New Revision: 27968
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27968&view=rev
Log:
add -e / --editor command line switch to allow starting editor2 bypassing the
title screen
Modified:
trunk/src/editor2/editor_controller.cpp
trunk/src/game.cpp
Modified: trunk/src/editor2/editor_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=27968&r1=27967&r2=27968&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Sun Jul 13 03:31:47 2008
@@ -16,6 +16,7 @@
#include "editor_map.hpp"
#include "mouse_action.hpp"
#include "../config_adapter.hpp"
+#include "../cursor.hpp"
#include "../foreach.hpp"
#include "../hotkeys.hpp"
#include "../preferences.hpp"
@@ -37,6 +38,7 @@
hotkey::set_scope_active(hotkey::SCOPE_EDITOR);
init(video);
set_mouse_action(new mouse_action_paint(*this));
+ cursor::set(cursor::NORMAL);
gui_->invalidate_game_status();
gui_->invalidate_all();
gui_->draw();
@@ -47,6 +49,7 @@
brushes_[0].add_relative_location(-1,0);
set_brush(&brushes_[0]);
//redraw_everything();
+
}
void editor_controller::init(CVideo& video)
@@ -55,6 +58,7 @@
const config* theme_cfg = get_theme(game_config_, "editor2");
theme_cfg = theme_cfg ? theme_cfg : &dummy;
gui_ = new editor_display(video, map_, *theme_cfg, game_config_,
config());
+ gui_->set_grid(preferences::grid());
}
editor_controller::~editor_controller()
Modified: trunk/src/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=27968&r1=27967&r2=27968&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Sun Jul 13 03:31:47 2008
@@ -135,6 +135,9 @@
bool new_campaign();
bool goto_campaign();
bool goto_multiplayer();
+#ifdef USE_EDITOR2
+ bool goto_editor();
+#endif
bool play_multiplayer();
void manage_addons();
void remove_addons();
@@ -208,6 +211,9 @@
std::string multiplayer_server_;
bool jump_to_campaign_, jump_to_multiplayer_;
+#ifdef USE_EDITOR2
+ bool jump_to_editor_;
+#endif
};
game_controller::game_controller(int argc, char** argv)
@@ -217,6 +223,9 @@
force_bpp_(-1), disp_(NULL), loaded_game_show_replay_(false),
loaded_game_cancel_orders_(false),
jump_to_campaign_(false), jump_to_multiplayer_(false)
+#ifdef USE_EDITOR2
+ ,jump_to_editor_(false)
+#endif
{
bool no_sound = false;
for(arg_ = 1; arg_ != argc_; ++arg_) {
@@ -322,6 +331,10 @@
} else if(val == "--new-widgets") {
// This is a hidden option to enable the new widget
toolkit.
gui2::new_widgets = true;
+#ifdef USE_EDITOR2
+ } else if(val == "-e" || val == "--editor") {
+ jump_to_editor_ = true;
+#endif
} else if(val[0] == '-') {
std::cerr << "unknown option: " << val << std::endl;
throw config::error("unknown option");
@@ -1068,6 +1081,21 @@
}
return true;
}
+
+#ifdef USE_EDITOR2
+bool game_controller::goto_editor()
+{
+ if(jump_to_editor_){
+ jump_to_editor_ = false;
+ if (start_editor() != editor2::EXIT_QUIT_TO_DESKTOP){
+ ;
+ }else{
+ return false;
+ }
+ }
+ return true;
+}
+#endif
static std::string format_file_size(const std::string& size_str)
{
@@ -2415,6 +2443,9 @@
<< " additional command
mode options in-game.\n"
<< " --decompress INFILE OUTFILE decompresses a
savefile (INFILE) that is in binary\n"
<< " WML format into text
WML format (OUTFILE).\n"
+#ifdef USE_EDITOR2
+ << " -e, --editor starts editor2 not
showing title screen.\n"
+#endif
<< " -f, --fullscreen runs the game in
full screen mode.\n"
<< " --fps displays the number
of frames per second the game\n"
<< " is currently running
at, in a corner of the screen.\n"
@@ -2704,6 +2735,11 @@
if(game.goto_multiplayer() == false){
continue; //Go to main menu
}
+#ifdef USE_EDITOR2
+ if (game.goto_editor() == false) {
+ return 0;
+ }
+#endif
loadscreen_manager.reset();
gui::TITLE_RESULT res = game.is_loading() ? gui::LOAD_GAME :
gui::NOTHING;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits