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

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

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


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp playturn.cpp
Date: Mon, 14 Mar 2005 17:26:39 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/03/14 22:26:38

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

Log message:
        Fixed bug #7138: [end turn] should be locked if you can not end turn.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.295&tr2=1.296&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.94&tr2=1.95&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.341&tr2=1.342&r1=text&r2=text

Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.295 wesnoth/src/display.cpp:1.296
--- wesnoth/src/display.cpp:1.295       Thu Mar 10 21:42:04 2005
+++ wesnoth/src/display.cpp     Mon Mar 14 22:26:38 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.295 2005/03/10 21:42:04 ydirson Exp $ */
+/* $Id: display.cpp,v 1.296 2005/03/14 22:26:38 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2147,6 +2147,22 @@
        return NULL;
 }
 
+void display::enable_menu(const std::string& item, bool enable)
+{
+       for(std::vector<theme::menu>::const_iterator menu = 
theme_.menus().begin();
+                       menu != theme_.menus().end(); ++menu) {
+               
+               std::vector<std::string>::const_iterator hasitem = 
+                       std::find(menu->items().begin(), menu->items().end(), 
item);
+
+               if(hasitem != menu->items().end()) {
+                       const size_t index = menu - theme_.menus().begin();
+                       wassert(index < buttons_.size());
+                       buttons_[index].enable(enable);
+               }
+       }
+}
+
 void display::begin_game()
 {
        in_game_ = true;
@@ -2217,7 +2233,7 @@
 }
 
 namespace {
-       const int max_chat_messages = 6;
+       const unsigned int max_chat_messages = 6;
        const int chat_message_border = 5;
        const int chat_message_x = 10;
        const int chat_message_y = 10;
@@ -2288,7 +2304,7 @@
 
 void display::prune_chat_messages(bool remove_all)
 {
-       const int message_ttl = remove_all ? 0 : 1200000;
+       const unsigned int message_ttl = remove_all ? 0 : 1200000;
        if(chat_messages_.empty() == false && 
(chat_messages_.front().created_at+message_ttl < SDL_GetTicks() || 
chat_messages_.size() > max_chat_messages)) {
                const int movement = 
font::get_floating_label_rect(chat_messages_.front().handle).h;
 
Index: wesnoth/src/display.hpp
diff -u wesnoth/src/display.hpp:1.94 wesnoth/src/display.hpp:1.95
--- wesnoth/src/display.hpp:1.94        Wed Mar  9 22:21:54 2005
+++ wesnoth/src/display.hpp     Mon Mar 14 22:26:38 2005
@@ -1,4 +1,4 @@
-/* $Id: display.hpp,v 1.94 2005/03/09 22:21:54 ydirson Exp $ */
+/* $Id: display.hpp,v 1.95 2005/03/14 22:26:38 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -304,6 +304,9 @@
 
        const theme::menu* menu_pressed();
 
+       //finds the menu which has a given item in it, and enables or disables 
it.
+       void enable_menu(const std::string& item, bool enable);
+
        void add_observer(const std::string& name);
        void remove_observer(const std::string& name);
        const std::set<std::string>& observers() const { return observers_; }
@@ -482,7 +485,7 @@
 
                int speaker_handle;
                int handle;
-               int created_at;
+               Uint32 created_at;
        };
 
        void prune_chat_messages(bool remove_all=false);
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.341 wesnoth/src/playturn.cpp:1.342
--- wesnoth/src/playturn.cpp:1.341      Thu Mar 10 20:59:20 2005
+++ wesnoth/src/playturn.cpp    Mon Mar 14 22:26:38 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.341 2005/03/10 20:59:20 ydirson Exp $ */
+/* $Id: playturn.cpp,v 1.342 2005/03/14 22:26:38 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -154,6 +154,8 @@
     path_turns_(0), end_turn_(false), start_ncmd_(-1), textbox_(textbox), 
replay_sender_(replay_sender)
 {
        enemies_visible_ = enemies_visible();
+
+       gui_.enable_menu("endturn", !browse_);
 }
 
 void turn_info::turn_slice()
@@ -2801,7 +2803,7 @@
                        return;
                }
 
-               if(last_space == -1) {
+               if(last_space == std::string::npos) {
                        beginning = true;
                        semiword = text;        
                }else{
@@ -2822,7 +2824,7 @@
                                        if(guess.size() == 0) {
                                                guess = name;
                                        }else{
-                                               int i;
+                                               size_t i;
                                                for(i=0; (i < guess.size()) || 
(i < name.size()); i++) {
                                                        if(guess[i] != name[i]) 
{
                                                                break;




reply via email to

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