wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src Makefile.am Makefile.in dialogs.cpp...


From: Yann Dirson
Subject: [Wesnoth-cvs-commits] wesnoth/src Makefile.am Makefile.in dialogs.cpp...
Date: Thu, 02 Sep 2004 11:46:22 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Yann Dirson <address@hidden>    04/09/02 15:41:10

Modified files:
        src            : Makefile.am Makefile.in dialogs.cpp 
                         pathfind.cpp pathfind.hpp 
        src/editor     : editor.cpp 
Added files:
        src            : filechooser.cpp pathutils.cpp pathutils.hpp 

Log message:
        first attempt at desentangling file deps to make editor smaller

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filechooser.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathutils.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathutils.hpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/Makefile.am.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/Makefile.in.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathfind.cpp.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathfind.hpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.81&tr2=1.82&r1=text&r2=text

Patches:
Index: wesnoth/src/Makefile.am
diff -u wesnoth/src/Makefile.am:1.45 wesnoth/src/Makefile.am:1.46
--- wesnoth/src/Makefile.am:1.45        Sun Aug 29 11:54:24 2004
+++ wesnoth/src/Makefile.am     Thu Sep  2 15:41:09 2004
@@ -39,6 +39,7 @@
                  dialogs.cpp \
                  display.cpp \
                  events.cpp \
+                 filechooser.cpp \
                  filesystem.cpp \
                  font.cpp \
                  game.cpp \
@@ -47,7 +48,7 @@
                  gamestatus.cpp \
                  gettext.cpp \
                  halo.cpp \
-          help.cpp \
+                 help.cpp \
                  hotkeys.cpp \
                  image.cpp \
                  intro.cpp \
@@ -65,6 +66,7 @@
                  multiplayer_lobby.cpp \
                  network.cpp \
                  pathfind.cpp \
+                 pathutils.cpp \
                  playlevel.cpp \
                  playturn.cpp \
                  preferences.cpp \
@@ -117,7 +119,7 @@
                  gamestatus.hpp \
                  gettext.hpp \
                  halo.hpp \
-          help.hpp \
+                 help.hpp \
                  hotkeys.hpp \
                  image.hpp \
                  intro.hpp \
@@ -135,6 +137,7 @@
                  multiplayer_lobby.hpp \
                  network.hpp \
                  pathfind.hpp \
+                 pathutils.hpp \
                  playlevel.hpp \
                  playturn.hpp \
                  preferences.hpp \
@@ -180,28 +183,25 @@
                         editor/editor_undo.cpp \
                         about.cpp \
                         actions.cpp \
-                        ai.cpp \
-                        ai_attack.cpp \
-                        ai_move.cpp \
-                        builder.cpp \
-                        cavegen.cpp \
+                        builder.cpp \
+                        cavegen.cpp \
                         clipboard.cpp \
                         config.cpp \
                         cursor.cpp \
                         dialogs.cpp \
                         display.cpp \
                         events.cpp \
+                        filechooser.cpp \
                         filesystem.cpp \
                         font.cpp \
                         game_config.cpp \
                         game_events.cpp \
                         gamestatus.cpp \
-                    gettext.cpp \
+                        gettext.cpp \
                         halo.cpp \
-             help.cpp \
+                        help.cpp \
                         hotkeys.cpp \
                         image.cpp \
-                        intro.cpp \
                         key.cpp \
                         language.cpp \
                         log.cpp \
@@ -211,8 +211,8 @@
                         mapgen_dialog.cpp \
                         mouse.cpp \
                         network.cpp \
+                        pathutils.cpp \
                         pathfind.cpp \
-                        playlevel.cpp \
                         playturn.cpp \
                         preferences.cpp \
                         race.cpp \
@@ -227,7 +227,7 @@
                         theme.cpp \
                         tooltips.cpp \
                         unit.cpp \
-                        unit_display.cpp \
+                        unit_display.cpp \
                         unit_types.cpp \
                         video.cpp \
                         widgets/button.cpp \
@@ -263,9 +263,9 @@
                         game_config.hpp \
                         game_events.hpp \
                         gamestatus.hpp \
-                    gettext.hpp \
+                        gettext.hpp \
                         halo.hpp \
-             help.hpp \
+                        help.hpp \
                         hotkeys.hpp \
                         image.hpp \
                         intro.hpp \
@@ -279,6 +279,7 @@
                         mouse.hpp \
                         network.hpp \
                         pathfind.hpp \
+                        pathutils.hpp \
                         playlevel.hpp \
                         playturn.hpp \
                         preferences.hpp \
@@ -294,7 +295,7 @@
                         theme.hpp \
                         tooltips.hpp \
                         unit.hpp \
-                        unit_display.hpp \
+                        unit_display.hpp \
                         unit_types.hpp \
                         video.hpp \
                         widgets/button.hpp \
Index: wesnoth/src/Makefile.in
diff -u wesnoth/src/Makefile.in:1.66 wesnoth/src/Makefile.in:1.67
--- wesnoth/src/Makefile.in:1.66        Thu Sep  2 09:36:11 2004
+++ wesnoth/src/Makefile.in     Thu Sep  2 15:41:09 2004
@@ -75,42 +75,42 @@
        ai_attack.$(OBJEXT) ai_move.$(OBJEXT) builder.$(OBJEXT) \
        cavegen.$(OBJEXT) clipboard.$(OBJEXT) config.$(OBJEXT) \
        cursor.$(OBJEXT) dialogs.$(OBJEXT) display.$(OBJEXT) \
-       events.$(OBJEXT) filesystem.$(OBJEXT) font.$(OBJEXT) \
-       game.$(OBJEXT) game_config.$(OBJEXT) game_events.$(OBJEXT) \
-       gamestatus.$(OBJEXT) gettext.$(OBJEXT) halo.$(OBJEXT) \
-       help.$(OBJEXT) hotkeys.$(OBJEXT) image.$(OBJEXT) \
-       intro.$(OBJEXT) key.$(OBJEXT) language.$(OBJEXT) log.$(OBJEXT) \
-       map.$(OBJEXT) map_label.$(OBJEXT) mapgen.$(OBJEXT) \
-       mapgen_dialog.$(OBJEXT) mouse.$(OBJEXT) multiplayer.$(OBJEXT) \
+       events.$(OBJEXT) filechooser.$(OBJEXT) filesystem.$(OBJEXT) \
+       font.$(OBJEXT) game.$(OBJEXT) game_config.$(OBJEXT) \
+       game_events.$(OBJEXT) gamestatus.$(OBJEXT) gettext.$(OBJEXT) \
+       halo.$(OBJEXT) help.$(OBJEXT) hotkeys.$(OBJEXT) \
+       image.$(OBJEXT) intro.$(OBJEXT) key.$(OBJEXT) \
+       language.$(OBJEXT) log.$(OBJEXT) map.$(OBJEXT) \
+       map_label.$(OBJEXT) mapgen.$(OBJEXT) mapgen_dialog.$(OBJEXT) \
+       mouse.$(OBJEXT) multiplayer.$(OBJEXT) \
        multiplayer_client.$(OBJEXT) multiplayer_connect.$(OBJEXT) \
        multiplayer_lobby.$(OBJEXT) network.$(OBJEXT) \
-       pathfind.$(OBJEXT) playlevel.$(OBJEXT) playturn.$(OBJEXT) \
-       preferences.$(OBJEXT) race.$(OBJEXT) replay.$(OBJEXT) \
-       reports.$(OBJEXT) sdl_utils.$(OBJEXT) show_dialog.$(OBJEXT) \
-       sound.$(OBJEXT) statistics.$(OBJEXT) team.$(OBJEXT) \
-       terrain.$(OBJEXT) theme.$(OBJEXT) titlescreen.$(OBJEXT) \
-       tooltips.$(OBJEXT) unit.$(OBJEXT) unit_display.$(OBJEXT) \
-       unit_types.$(OBJEXT) video.$(OBJEXT) button.$(OBJEXT) \
-       file_chooser.$(OBJEXT) combo.$(OBJEXT) menu.$(OBJEXT) \
-       progressbar.$(OBJEXT) scrollbar.$(OBJEXT) slider.$(OBJEXT) \
-       textbox.$(OBJEXT) widget.$(OBJEXT)
+       pathfind.$(OBJEXT) pathutils.$(OBJEXT) playlevel.$(OBJEXT) \
+       playturn.$(OBJEXT) preferences.$(OBJEXT) race.$(OBJEXT) \
+       replay.$(OBJEXT) reports.$(OBJEXT) sdl_utils.$(OBJEXT) \
+       show_dialog.$(OBJEXT) sound.$(OBJEXT) statistics.$(OBJEXT) \
+       team.$(OBJEXT) terrain.$(OBJEXT) theme.$(OBJEXT) \
+       titlescreen.$(OBJEXT) tooltips.$(OBJEXT) unit.$(OBJEXT) \
+       unit_display.$(OBJEXT) unit_types.$(OBJEXT) video.$(OBJEXT) \
+       button.$(OBJEXT) file_chooser.$(OBJEXT) combo.$(OBJEXT) \
+       menu.$(OBJEXT) progressbar.$(OBJEXT) scrollbar.$(OBJEXT) \
+       slider.$(OBJEXT) textbox.$(OBJEXT) widget.$(OBJEXT)
 wesnoth_OBJECTS = $(am_wesnoth_OBJECTS)
 wesnoth_LDADD = $(LDADD)
 am_wesnoth_editor_OBJECTS = editor.$(OBJEXT) editor_layout.$(OBJEXT) \
        map_manip.$(OBJEXT) editor_palettes.$(OBJEXT) \
        editor_main.$(OBJEXT) editor_dialogs.$(OBJEXT) \
        editor_undo.$(OBJEXT) about.$(OBJEXT) actions.$(OBJEXT) \
-       ai.$(OBJEXT) ai_attack.$(OBJEXT) ai_move.$(OBJEXT) \
        builder.$(OBJEXT) cavegen.$(OBJEXT) clipboard.$(OBJEXT) \
        config.$(OBJEXT) cursor.$(OBJEXT) dialogs.$(OBJEXT) \
-       display.$(OBJEXT) events.$(OBJEXT) filesystem.$(OBJEXT) \
-       font.$(OBJEXT) game_config.$(OBJEXT) game_events.$(OBJEXT) \
-       gamestatus.$(OBJEXT) gettext.$(OBJEXT) halo.$(OBJEXT) \
-       help.$(OBJEXT) hotkeys.$(OBJEXT) image.$(OBJEXT) \
-       intro.$(OBJEXT) key.$(OBJEXT) language.$(OBJEXT) log.$(OBJEXT) \
+       display.$(OBJEXT) events.$(OBJEXT) filechooser.$(OBJEXT) \
+       filesystem.$(OBJEXT) font.$(OBJEXT) game_config.$(OBJEXT) \
+       game_events.$(OBJEXT) gamestatus.$(OBJEXT) gettext.$(OBJEXT) \
+       halo.$(OBJEXT) help.$(OBJEXT) hotkeys.$(OBJEXT) \
+       image.$(OBJEXT) key.$(OBJEXT) language.$(OBJEXT) log.$(OBJEXT) \
        map_label.$(OBJEXT) map.$(OBJEXT) mapgen.$(OBJEXT) \
        mapgen_dialog.$(OBJEXT) mouse.$(OBJEXT) network.$(OBJEXT) \
-       pathfind.$(OBJEXT) playlevel.$(OBJEXT) playturn.$(OBJEXT) \
+       pathutils.$(OBJEXT) pathfind.$(OBJEXT) playturn.$(OBJEXT) \
        preferences.$(OBJEXT) race.$(OBJEXT) replay.$(OBJEXT) \
        reports.$(OBJEXT) sdl_utils.$(OBJEXT) show_dialog.$(OBJEXT) \
        sound.$(OBJEXT) statistics.$(OBJEXT) team.$(OBJEXT) \
@@ -138,6 +138,7 @@
 @AMDEP_TRUE@   ./$(DEPDIR)/editor_palettes.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/editor_undo.Po ./$(DEPDIR)/events.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/file_chooser.Po \
address@hidden@ ./$(DEPDIR)/filechooser.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/filesystem.Po ./$(DEPDIR)/font.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/game.Po ./$(DEPDIR)/game_config.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/game_events.Po \
@@ -154,8 +155,8 @@
 @AMDEP_TRUE@   ./$(DEPDIR)/multiplayer_connect.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/multiplayer_lobby.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/network.Po ./$(DEPDIR)/pathfind.Po \
address@hidden@ ./$(DEPDIR)/playlevel.Po ./$(DEPDIR)/playturn.Po \
address@hidden@ ./$(DEPDIR)/preferences.Po \
address@hidden@ ./$(DEPDIR)/pathutils.Po ./$(DEPDIR)/playlevel.Po \
address@hidden@ ./$(DEPDIR)/playturn.Po ./$(DEPDIR)/preferences.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/progressbar.Po ./$(DEPDIR)/race.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/replay.Po ./$(DEPDIR)/reports.Po \
 @AMDEP_TRUE@   ./$(DEPDIR)/scrollbar.Po ./$(DEPDIR)/sdl_utils.Po \
@@ -379,6 +380,7 @@
                  dialogs.cpp \
                  display.cpp \
                  events.cpp \
+                 filechooser.cpp \
                  filesystem.cpp \
                  font.cpp \
                  game.cpp \
@@ -387,7 +389,7 @@
                  gamestatus.cpp \
                  gettext.cpp \
                  halo.cpp \
-          help.cpp \
+                 help.cpp \
                  hotkeys.cpp \
                  image.cpp \
                  intro.cpp \
@@ -405,6 +407,7 @@
                  multiplayer_lobby.cpp \
                  network.cpp \
                  pathfind.cpp \
+                 pathutils.cpp \
                  playlevel.cpp \
                  playturn.cpp \
                  preferences.cpp \
@@ -457,7 +460,7 @@
                  gamestatus.hpp \
                  gettext.hpp \
                  halo.hpp \
-          help.hpp \
+                 help.hpp \
                  hotkeys.hpp \
                  image.hpp \
                  intro.hpp \
@@ -475,6 +478,7 @@
                  multiplayer_lobby.hpp \
                  network.hpp \
                  pathfind.hpp \
+                 pathutils.hpp \
                  playlevel.hpp \
                  playturn.hpp \
                  preferences.hpp \
@@ -520,28 +524,25 @@
                         editor/editor_undo.cpp \
                         about.cpp \
                         actions.cpp \
-                        ai.cpp \
-                        ai_attack.cpp \
-                        ai_move.cpp \
-                        builder.cpp \
-                        cavegen.cpp \
+                        builder.cpp \
+                        cavegen.cpp \
                         clipboard.cpp \
                         config.cpp \
                         cursor.cpp \
                         dialogs.cpp \
                         display.cpp \
                         events.cpp \
+                        filechooser.cpp \
                         filesystem.cpp \
                         font.cpp \
                         game_config.cpp \
                         game_events.cpp \
                         gamestatus.cpp \
-                    gettext.cpp \
+                        gettext.cpp \
                         halo.cpp \
-             help.cpp \
+                        help.cpp \
                         hotkeys.cpp \
                         image.cpp \
-                        intro.cpp \
                         key.cpp \
                         language.cpp \
                         log.cpp \
@@ -551,8 +552,8 @@
                         mapgen_dialog.cpp \
                         mouse.cpp \
                         network.cpp \
+                        pathutils.cpp \
                         pathfind.cpp \
-                        playlevel.cpp \
                         playturn.cpp \
                         preferences.cpp \
                         race.cpp \
@@ -567,7 +568,7 @@
                         theme.cpp \
                         tooltips.cpp \
                         unit.cpp \
-                        unit_display.cpp \
+                        unit_display.cpp \
                         unit_types.cpp \
                         video.cpp \
                         widgets/button.cpp \
@@ -603,9 +604,9 @@
                         game_config.hpp \
                         game_events.hpp \
                         gamestatus.hpp \
-                    gettext.hpp \
+                        gettext.hpp \
                         halo.hpp \
-             help.hpp \
+                        help.hpp \
                         hotkeys.hpp \
                         image.hpp \
                         intro.hpp \
@@ -619,6 +620,7 @@
                         mouse.hpp \
                         network.hpp \
                         pathfind.hpp \
+                        pathutils.hpp \
                         playlevel.hpp \
                         playturn.hpp \
                         preferences.hpp \
@@ -634,7 +636,7 @@
                         theme.hpp \
                         tooltips.hpp \
                         unit.hpp \
-                        unit_display.hpp \
+                        unit_display.hpp \
                         unit_types.hpp \
                         video.hpp \
                         widgets/button.hpp \
@@ -742,6 +744,7 @@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
@@ -770,6 +773,7 @@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
address@hidden@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
 @AMDEP_TRUE@@am__include@ @address@hidden/$(DEPDIR)/address@hidden@
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.51 wesnoth/src/dialogs.cpp:1.52
--- wesnoth/src/dialogs.cpp:1.51        Mon Aug 30 01:23:16 2004
+++ wesnoth/src/dialogs.cpp     Thu Sep  2 15:41:09 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.51 2004/08/30 01:23:16 Sirp Exp $ */
+/* $Id: dialogs.cpp,v 1.52 2004/09/02 15:41:09 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -540,73 +540,6 @@
 }
 
 
-int show_file_chooser_dialog(display &disp, std::string &filename,
-                                                        const std::string 
title,
-                                                        int xloc, int yloc) {
-       const events::event_context dialog_events_context;
-       const gui::dialog_manager manager;
-       const events::resize_lock prevent_resizing;
-
-       CVideo& screen = disp.video();
-       surface const scr = screen.getSurface();
-
-       const int width = 400;
-       const int height = 400;
-       const int left_padding = 10;
-       const int right_padding = 10;
-       const int top_padding = 10;
-       const int bot_padding = 10;
-
-       // If not both locations were supplied, put the dialog in the middle
-       // of the screen.
-       if (yloc <= -1 || xloc <= -1) {
-               xloc = scr->w / 2 - width / 2;
-               yloc = scr->h / 2 - height / 2;
-       }
-       std::vector<gui::button*> buttons_ptr;
-       gui::button ok_button_(disp, _("Ok"));
-       gui::button cancel_button_(disp, _("Cancel"));
-       buttons_ptr.push_back(&ok_button_);
-       buttons_ptr.push_back(&cancel_button_);
-       surface_restorer restorer;
-       gui::draw_dialog(xloc, yloc, width, height, disp, title, NULL, 
&buttons_ptr, &restorer);
-
-       gui::file_chooser fc(disp, filename);
-       fc.set_location(xloc + left_padding, yloc + top_padding);
-       fc.set_width(width - left_padding - right_padding);
-       fc.set_height(height - top_padding - bot_padding);
-       fc.set_dirty(true);
-       
-       events::raise_draw_event();
-       screen.flip();
-       disp.invalidate_all();
-
-       CKey key;
-       for (;;) {
-               events::pump();
-               events::raise_process_event();
-               events::raise_draw_event();
-               if (fc.choice_made()) {
-                       filename = fc.get_choice();
-                       return 0; // We know that the OK button is on index 0.
-               }
-               if (key[SDLK_ESCAPE]) {
-                       // Escape quits from the dialog.
-                       return -1;
-               }
-               for (std::vector<gui::button*>::iterator button_it = 
buttons_ptr.begin();
-                        button_it != buttons_ptr.end(); button_it++) {
-                       if ((*button_it)->pressed()) {
-                               // Return the index of the pressed button.
-                               filename = fc.get_choice();
-                               return button_it - buttons_ptr.begin();
-                       }
-               }
-               screen.flip();
-               SDL_Delay(10);
-       }
-}
-
 namespace {
        static const SDL_Rect unit_preview_size = {-200,-370,200,370};
        static const SDL_Rect weaponless_unit_preview_size = 
{-190,-140,190,140};
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.81 wesnoth/src/editor/editor.cpp:1.82
--- wesnoth/src/editor/editor.cpp:1.81  Thu Sep  2 11:34:27 2004
+++ wesnoth/src/editor/editor.cpp       Thu Sep  2 15:41:10 2004
@@ -29,8 +29,6 @@
 #include "../sdl_utils.hpp"
 #include "../tooltips.hpp"
 #include "../team.hpp"
-#include "../unit_types.hpp"
-#include "../unit.hpp"
 #include "../util.hpp"
 #include "../video.hpp"
 
@@ -1134,7 +1132,7 @@
                l_button_func_ = func;
                const std::string string_to_translate = std::string("action_") 
+ get_action_name(func);
                reports::set_report_content(reports::EDIT_LEFT_BUTTON_FUNCTION,
-                                                                       
translate_string(string_to_translate));
+                                           
translate_string(string_to_translate));
                gui_.invalidate_game_status();
                l_button_palette_dirty_ = true;
        }
Index: wesnoth/src/pathfind.cpp
diff -u wesnoth/src/pathfind.cpp:1.41 wesnoth/src/pathfind.cpp:1.42
--- wesnoth/src/pathfind.cpp:1.41       Sat Aug 28 23:23:05 2004
+++ wesnoth/src/pathfind.cpp    Thu Sep  2 15:41:09 2004
@@ -1,4 +1,4 @@
-/* $Id: pathfind.cpp,v 1.41 2004/08/28 23:23:05 isaaccp Exp $ */
+/* $Id: pathfind.cpp,v 1.42 2004/09/02 15:41:09 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -70,27 +70,6 @@
        return gamemap::location();
 }
 
-void get_adjacent_tiles(const gamemap::location& a, gamemap::location* res)
-{
-       res->x = a.x;
-       res->y = a.y-1;
-       ++res;
-       res->x = a.x+1;
-       res->y = a.y - (is_even(a.x) ? 1:0);
-       ++res;
-       res->x = a.x+1;
-       res->y = a.y + (is_odd(a.x) ? 1:0);
-       ++res;
-       res->x = a.x;
-       res->y = a.y+1;
-       ++res;
-       res->x = a.x-1;
-       res->y = a.y + (is_odd(a.x) ? 1:0);
-       ++res;
-       res->x = a.x-1;
-       res->y = a.y - (is_even(a.x) ? 1:0);
-}
-
 namespace {
 
 void get_tiles_radius_internal(const gamemap::location& a, size_t radius, 
std::set<gamemap::location>& res, std::map<gamemap::location,int>& visited)
@@ -147,30 +126,6 @@
        res.insert(visited.begin(), visited.end());
 }
 
-bool tiles_adjacent(const gamemap::location& a, const gamemap::location& b)
-{
-       //two tiles are adjacent if y is different by 1, and x by 0, or if
-       //x is different by 1 and y by 0, or if x and y are each different by 1,
-       //and the x value of the hex with the greater y value is even
-
-       const int xdiff = abs(a.x - b.x);
-       const int ydiff = abs(a.y - b.y);
-       return ydiff == 1 && a.x == b.x || xdiff == 1 && a.y == b.y ||
-              xdiff == 1 && ydiff == 1 && (a.y > b.y ? is_even(a.x) : 
is_even(b.x));
-}
-
-size_t distance_between(const gamemap::location& a, const gamemap::location& b)
-{
-       const size_t hdistance = abs(a.x - b.x);
-
-       const size_t vpenalty = (is_even(a.x) && is_odd(b.x) && a.y < b.y ||
-                                is_even(b.x) && is_odd(a.x) && b.y < a.y) ? 
1:0;
-       const size_t vdistance = abs(a.y - b.y) + vpenalty;
-       const size_t vsavings = minimum<int>(vdistance,hdistance/2 + 
hdistance%2);
-
-       return hdistance + vdistance - vsavings;
-}
-
 bool enemy_zoc(const gamemap& map, const gamestatus& status, 
                                        const std::map<gamemap::location,unit>& 
units,
                                        const std::vector<team>& teams,
Index: wesnoth/src/pathfind.hpp
diff -u wesnoth/src/pathfind.hpp:1.30 wesnoth/src/pathfind.hpp:1.31
--- wesnoth/src/pathfind.hpp:1.30       Sat Aug 28 23:23:05 2004
+++ wesnoth/src/pathfind.hpp    Thu Sep  2 15:41:09 2004
@@ -1,4 +1,4 @@
-/* $Id: pathfind.hpp,v 1.30 2004/08/28 23:23:05 isaaccp Exp $ */
+/* $Id: pathfind.hpp,v 1.31 2004/09/02 15:41:09 ydirson Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,7 +17,7 @@
 #include "gamestatus.hpp"
 #include "map.hpp"
 #include "unit.hpp"
-#include "unit_types.hpp"
+#include "pathutils.hpp"
 
 #include <algorithm>
 #include <cassert>
@@ -29,10 +29,6 @@
 
 //this module contains various pathfinding functions and utilities.
 
-//function which, given a location, will place all adjacent locations in
-//res. res must point to an array of 6 location objects.
-void get_adjacent_tiles(const gamemap::location& a, gamemap::location* res);
-
 //a convenient type for storing a list of tiles adjacent to a certain tile
 typedef util::array<gamemap::location,6> adjacent_tiles_array;
 
@@ -46,10 +42,6 @@
 //function which tells if two locations are adjacent.
 bool tiles_adjacent(const gamemap::location& a, const gamemap::location& b);
 
-//function which gives the number of hexes between two tiles (i.e. the minimum
-//number of hexes that have to be traversed to get from one hex to the other)
-size_t distance_between(const gamemap::location& a, const gamemap::location& 
b);
-
 enum VACANT_TILE_TYPE { VACANT_CASTLE, VACANT_ANY };
 
 //function which will find a location on the board that is as near to loc as




reply via email to

[Prev in Thread] Current Thread [Next in Thread]