Author: ilor
Date: Thu May 29 22:59:17 2008
New Revision: 26913

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26913&view=rev
Log:
changed std::cerr to LOG_NG* change new editor dir and namespace to editor2 for 
consistency
* wire the current editor into the main title screen (this is temporary)
* some work-in-progress in editor2/

Added:
    trunk/src/editor2/
      - copied from r26844, trunk/src/map_editor/
Removed:
    trunk/src/map_editor/
Modified:
    trunk/src/editor2/action.cpp
    trunk/src/editor2/action.hpp
    trunk/src/editor2/action_base.hpp
    trunk/src/editor2/editor_common.hpp
    trunk/src/game.cpp

Modified: trunk/src/editor2/action.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/action.cpp?rev=26913&r1=26844&r2=26913&view=diff
==============================================================================
--- trunk/src/editor2/action.cpp (original)
+++ trunk/src/editor2/action.cpp Thu May 29 22:59:17 2008
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
-   Copyright (C) 2008 by Tomasz Œniatowski <[EMAIL PROTECTED]>
+   Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
 
    This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 #include "action.hpp"
 #include "../foreach.hpp"
 
-namespace map_editor {
+namespace editor2 {
        
 editor_action_whole_map* editor_action_whole_map::perform(editor_map& m) {
        editor_action_whole_map* undo = new editor_action_whole_map(m);
@@ -122,4 +122,4 @@
        throw editor_action_not_implemented();
 }
 
-} //namespace map_editor
+} //end namespace editor2

Modified: trunk/src/editor2/action.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/action.hpp?rev=26913&r1=26844&r2=26913&view=diff
==============================================================================
--- trunk/src/editor2/action.hpp (original)
+++ trunk/src/editor2/action.hpp Thu May 29 22:59:17 2008
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
-   Copyright (C) 2008 by Tomasz Œniatowski <[EMAIL PROTECTED]>
+   Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
 
    This program is free software; you can redistribute it and/or modify
@@ -15,13 +15,24 @@
 //! @file action.hpp
 //! Editor action classes
 
+#ifndef EDITOR2_ACTION_HPP
+#define EDITOR2_ACTION_HPP
+
 #include "action_base.hpp"
 #include "../map.hpp"
 #include "../terrain.hpp"
 
-namespace map_editor {
+namespace editor2 {
        
-//Replace contents of the entirem map action
+class editor_map : public gamemap
+{
+};
+
+class brush
+{
+};
+       
+//Replace contents of the entire map action
 //useful as a fallback undo method when something else would be impractical
 class editor_action_whole_map : public editor_action
 {
@@ -50,6 +61,35 @@
     protected:
         std::vector<editor_action*> actions_;
 };
+
+//class editor_action_chain_whole_map : public editor_action_chain
+//{
+//     public:
+//             explicit 
editor_action_chain_whole_map(std::vector<editor_action*> actions)
+//             : editor_action_chain(actions)
+//             {
+//             }
+//             editor_action_whole_map* perform(editor_map& m)
+//             {
+//                     editor_action_whole_map* undo = new 
editor_action_whole_map(m);
+//                     perform_without_undo(m);
+//                     return undo;
+//             }
+//     
+//};
+
+//class editor_action_undo_wrapper : public editor_action
+//{
+//     public:
+//             editor_action_undo_wrapper(editor_action* undo, editor_action* 
redo)
+//             : undo_(undo)
+//             , redo_(redo)
+//             {
+//             }
+//             ~editor_action_undo_wrapper();
+//     protected:
+//             
+//};
 
 //common base classes for actions with common behaviour
 
@@ -199,4 +239,6 @@
                gamemap::location loc2_;
 };
 
-} //namespace map_editor
+} //end namespace editor2
+
+#endif

Modified: trunk/src/editor2/action_base.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/action_base.hpp?rev=26913&r1=26844&r2=26913&view=diff
==============================================================================
--- trunk/src/editor2/action_base.hpp (original)
+++ trunk/src/editor2/action_base.hpp Thu May 29 22:59:17 2008
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
-   Copyright (C) 2008 by Tomasz Œniatowski <[EMAIL PROTECTED]>
+   Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
 
    This program is free software; you can redistribute it and/or modify
@@ -22,9 +22,12 @@
 //! Code that only deals with actions polymorphically should only need to 
 //! include this header file.
 
+#ifndef EDITOR2_ACTION_BASE_HPP_INCLUDED
+#define EDITOR2_ACTION_BASE_HPP_INCLUDED
+
 #include "editor_common.hpp"
 
-namespace map_editor {
+namespace editor2 {
 
 //base class (interface) for editor actions.
 class editor_action
@@ -56,4 +59,6 @@
 {
 };
 
-} //namespace map_editor
+} //end namespace editor2
+
+#endif

Modified: trunk/src/editor2/editor_common.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_common.hpp?rev=26913&r1=26844&r2=26913&view=diff
==============================================================================
--- trunk/src/editor2/editor_common.hpp (original)
+++ trunk/src/editor2/editor_common.hpp Thu May 29 22:59:17 2008
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
-   Copyright (C) 2008 by Tomasz Œniatowski <[EMAIL PROTECTED]>
+   Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
 
    This program is free software; you can redistribute it and/or modify
@@ -15,18 +15,29 @@
 //! @file editor_common.hpp
 //! Main (common) editor header
 
-namespace map_editor {
+#ifndef EDITOR2_EDITOR_COMMON_HPP_INCLUDED
+#define EDITOR2_EDITOR_COMMON_HPP_INCLUDED
+
+#include "../log.hpp"
+#define DBG_ED LOG_STREAM_INDENT(debug, editor)
+#define LOG_ED LOG_STREAM_INDENT(info, editor)
+#define WRN_ED LOG_STREAM_INDENT(warn, editor)
+#define ERR_ED LOG_STREAM_INDENT(err, editor)
+#define SCOPE_ED log_scope(__FUNCTION__)
+
+
+namespace editor2 {
 
 struct editor_exception
 {
 };
 
-class editor_map
-{
-};
 
-class brush
-{
-};
+// forward declarations
+class editor_display;
+class editor_map;
+class brush;
 
-} //namespace map_editor
+} //end namespace editor2
+
+#endif

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=26913&r1=26912&r2=26913&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Thu May 29 22:59:17 2008
@@ -66,6 +66,10 @@
 #include "ai_python.hpp"
 #endif
 
+#ifdef MAP_EDITOR
+#include "editor2/editor_main.hpp"
+#endif
+
 #include "wesconfig.h"
 
 #include <clocale>
@@ -139,6 +143,9 @@
        enum RELOAD_GAME_DATA { RELOAD_DATA, NO_RELOAD_DATA };
        void play_game(RELOAD_GAME_DATA reload=RELOAD_DATA);
        void play_replay();
+#ifdef MAP_EDITOR
+       editor2::EXIT_STATUS start_editor();
+#endif
        const config& game_config(){return game_config_;};
 
 private:
@@ -2016,6 +2023,11 @@
                defines_map_["NORMAL"] = preproc_define();
                defines_map_["MEDIUM"] = preproc_define();
        }
+#ifdef MAP_EDITOR
+       defines_map_["EDITOR"] = preproc_define();
+       defines_map_["NORMAL"] = preproc_define();
+       defines_map_["MEDIUM"] = preproc_define();
+#endif
 
        //refresh_game_cfg();
 }
@@ -2115,6 +2127,13 @@
                e.show(disp());
        }
 }
+
+#ifdef MAP_EDITOR
+editor2::EXIT_STATUS game_controller::start_editor()
+{
+       editor2::start(game_config_, video_);
+}
+#endif
 
 game_controller::~game_controller()
 {
@@ -2527,8 +2546,9 @@
                        continue;
 #ifdef MAP_EDITOR
                } else if(res == gui::START_MAP_EDITOR) {
-                       gui::show_error_message(game.disp(), "The map editor is 
not available. Yet.");
-                       gui::set_background_dirty()
+                       //@todo editor can ask the game to quit completely
+                       game.start_editor();
+                       gui::set_background_dirty();
                        continue;
 #endif
                }


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

Reply via email to