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

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

[Wesnoth-cvs-commits] wesnoth/src actions.cpp playturn.cpp playturn.hpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src actions.cpp playturn.cpp playturn.hpp
Date: Thu, 30 Dec 2004 09:11:52 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/12/30 13:57:24

Modified files:
        src            : actions.cpp playturn.cpp playturn.hpp 

Log message:
        added assertion that the route is empty back into move_unit() and fixed 
the caller in playturn

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.175&tr2=1.176&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.312&tr2=1.313&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.hpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.175 wesnoth/src/actions.cpp:1.176
--- wesnoth/src/actions.cpp:1.175       Thu Dec 30 02:52:37 2004
+++ wesnoth/src/actions.cpp     Thu Dec 30 13:57:23 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.175 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: actions.cpp,v 1.176 2004/12/30 13:57:23 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1570,9 +1570,7 @@
                  replay* move_recorder, undo_list* undo_stack,
                  gamemap::location *next_unit, bool continue_move, bool 
should_clear_shroud)
 {
-       if(route.empty()) {
-               return 0;
-       }
+       assert(route.empty() == false);
 
        //stop the user from issuing any commands while the unit is moving
        const command_disabler disable_commands;
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.312 wesnoth/src/playturn.cpp:1.313
--- wesnoth/src/playturn.cpp:1.312      Thu Dec 30 02:52:37 2004
+++ wesnoth/src/playturn.cpp    Thu Dec 30 13:57:23 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.312 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.313 2004/12/30 13:57:23 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -264,6 +264,11 @@
 }
 
 void turn_info::mouse_motion(const SDL_MouseMotionEvent& event)
+{
+       mouse_motion(event.x,event.y);
+}
+
+void turn_info::mouse_motion(int x, int y)
 {
        if(minimap_scrolling_) {
                //if the game is run in a window, we could miss a LMB/MMB up 
event
@@ -271,7 +276,7 @@
                // thus, we need to check if the LMB/MMB is still down
                minimap_scrolling_ = ((SDL_GetMouseState(NULL,NULL) & 
(SDL_BUTTON(1) | SDL_BUTTON(2))) != 0);
                if(minimap_scrolling_) {
-                       const gamemap::location& loc = 
gui_.minimap_location_on(event.x,event.y);
+                       const gamemap::location& loc = 
gui_.minimap_location_on(x,y);
                        if(loc.valid()) {
                                if(loc != last_hex_) {
                                        last_hex_ = loc;
@@ -287,7 +292,7 @@
 
        gamemap::location::DIRECTION nearest_hex;
        const team& current_team = teams_[team_num_-1];
-       const gamemap::location new_hex = 
gui_.hex_clicked_on(event.x,event.y,&nearest_hex);
+       const gamemap::location new_hex = gui_.hex_clicked_on(x,y,&nearest_hex);
 
        if(new_hex != last_hex_ || nearest_hex != last_nearest_) {
                if(new_hex.valid() == false) {
@@ -445,7 +450,9 @@
 } //end anonymous namespace
 
 void turn_info::mouse_press(const SDL_MouseButtonEvent& event)
-{
+{
+       mouse_motion(event.x,event.y);
+
        if(is_left_click(event) && event.state == SDL_RELEASED) {
                minimap_scrolling_ = false;
        } else if(is_middle_click(event) && event.state == SDL_RELEASED) {
Index: wesnoth/src/playturn.hpp
diff -u wesnoth/src/playturn.hpp:1.59 wesnoth/src/playturn.hpp:1.60
--- wesnoth/src/playturn.hpp:1.59       Thu Dec 30 02:52:37 2004
+++ wesnoth/src/playturn.hpp    Thu Dec 30 13:57:23 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.hpp,v 1.59 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: playturn.hpp,v 1.60 2004/12/30 13:57:23 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -178,7 +178,8 @@
        void do_recruit(const std::string& name);
 
        void handle_event(const SDL_Event& event);
-       void mouse_motion(const SDL_MouseMotionEvent& event);
+       void mouse_motion(const SDL_MouseMotionEvent& event);
+       void mouse_motion(int x, int y);
        void mouse_press(const SDL_MouseButtonEvent& event);
 
        void left_click(const SDL_MouseButtonEvent& event);




reply via email to

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