Author: ilor
Date: Tue Jul 29 11:59:35 2008
New Revision: 28259

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28259&view=rev
Log:
editor2 map class update

Modified:
    trunk/src/editor2/editor_controller.cpp
    trunk/src/editor2/editor_map.cpp
    trunk/src/editor2/editor_map.hpp

Modified: trunk/src/editor2/editor_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_controller.cpp?rev=28259&r1=28258&r2=28259&view=diff
==============================================================================
--- trunk/src/editor2/editor_controller.cpp (original)
+++ trunk/src/editor2/editor_controller.cpp Tue Jul 29 11:59:35 2008
@@ -41,7 +41,7 @@
 editor_controller::editor_controller(const config &game_config, CVideo& video)
 : controller_base(SDL_GetTicks(), game_config, video)
 , mouse_handler_base(map_)
-, map_(editor_map::new_map(game_config, 44, 33, t_translation::GRASS_LAND))
+, map_(game_config, 44, 33, t_translation::GRASS_LAND)
 , gui_(NULL), do_quit_(false), quit_mode_(EXIT_ERROR)
 {
        init(video);
@@ -242,7 +242,7 @@
 
 void editor_controller::new_map(int width, int height, 
t_translation::t_terrain fill)
 {
-       set_map(editor_map::new_map(game_config_, width, height, fill));
+       set_map(editor_map(game_config_, width, height, fill));
 }
 
 void editor_controller::set_map(const editor_map& map)

Modified: trunk/src/editor2/editor_map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.cpp?rev=28259&r1=28258&r2=28259&view=diff
==============================================================================
--- trunk/src/editor2/editor_map.cpp (original)
+++ trunk/src/editor2/editor_map.cpp Tue Jul 29 11:59:35 2008
@@ -34,17 +34,17 @@
 {
 }
 
+editor_map::editor_map(const config& terrain_cfg, size_t width, size_t height, 
t_translation::t_terrain filler)
+: gamemap(terrain_cfg, gamemap::default_map_header + 
t_translation::write_game_map(
+       t_translation::t_map(width, t_translation::t_list(height, filler))))
+, filename_(), actions_since_save_(0)
+{
+}
+
 editor_map::~editor_map()
 {
        clear_stack(undo_stack_);
        clear_stack(redo_stack_);
-}
-
-editor_map editor_map::new_map(const config& terrain_cfg, size_t width, size_t 
height, t_translation::t_terrain filler)
-{
-       const t_translation::t_list column(height, filler);
-       const t_translation::t_map map(width, column);
-       return editor_map(terrain_cfg, gamemap::default_map_header + 
t_translation::write_game_map(map));
 }
 
 std::set<gamemap::location> editor_map::get_contigious_terrain_tiles(const 
gamemap::location& start) const
@@ -232,15 +232,12 @@
 }
 
 void editor_map::resize(int width, int height, int x_offset, int y_offset,
-       bool do_expand, t_translation::t_terrain filler)
+       t_translation::t_terrain filler)
 {
        int old_w = w();
        int old_h = h();
        if (old_w == width && old_h == height && x_offset == 0 && y_offset == 
0) {
                return;
-       }
-       if (do_expand) {
-               filler = t_translation::NONE_TERRAIN;
        }
 
        // Determine the amount of resizing is required

Modified: trunk/src/editor2/editor_map.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.hpp?rev=28259&r1=28258&r2=28259&view=diff
==============================================================================
--- trunk/src/editor2/editor_map.hpp (original)
+++ trunk/src/editor2/editor_map.hpp Tue Jul 29 11:59:35 2008
@@ -33,12 +33,12 @@
 class editor_map : public gamemap 
 {
 public:
+
        editor_map(const config& terrain_cfg, const std::string& data);
+       editor_map(const config& terrain_cfg, size_t width, size_t height, 
t_translation::t_terrain filler);
        
        ~editor_map();
        
-
-       static editor_map new_map(const config& terrain_cfg, size_t width, 
size_t height, t_translation::t_terrain filler);
        
        /**
         * Get a contigious set of tiles having the same terrain as the 
starting location.
@@ -119,8 +119,12 @@
        /** Re-does a previousle undid action, and puts it back in the undo 
stack. */
        void redo();
        
+       /** 
+        * Resize the map. If the filler is NONE, the border terrain will be 
copied
+        * when expanding, otherwise the fill er terrain will be inserted there
+        */
        void resize(int width, int height, int x_offset, int y_offset,
-               bool do_expand, t_translation::t_terrain filler);
+               t_translation::t_terrain filler = t_translation::NONE_TERRAIN);
 
        void flip_x();
        void flip_y();


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

Reply via email to