mail[Wesnoth-commits] r44823 - /trunk/src/whiteboard/manager.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by gabrielmorin on July 28, 2010 - 21:45:
Author: gabba
Date: Wed Jul 28 21:45:50 2010
New Revision: 44823

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44823&view=rev
Log:
Whiteboard: correctly set back the whiteboard to disabled state if turn ends 
between pressing and releasing the ctrl key.

Modified:
    trunk/src/whiteboard/manager.cpp

Modified: trunk/src/whiteboard/manager.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=44823&r1=44822&r2=44823&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Wed Jul 28 21:45:50 2010
@@ -53,6 +53,7 @@
 
 manager::~manager()
 {
+       LOG_WB << "Manager destroyed.\n";
 }
 
 static void print_to_chat(const std::string& title, const std::string& 
message)
@@ -107,35 +108,40 @@
 
 void manager::set_invert_behavior(bool invert)
 {
+       bool block_whiteboard_activation = false;
        if(wait_for_side_init_
                        || executing_actions_
                        || is_observer())
-               return;
-
-       static bool print_once = true;
-       if (print_once)
-       {
-               print_once = false;
-               print_to_chat("whiteboard", std::string("Hold the ctrl key to 
temporarily toggle the whiteboard.")
-                       + " (Activate and then) Deactivate the whiteboard 
with the :wb command to erase all actions.");
-               print_help();
-       }
+       {
+                block_whiteboard_activation = true;
+       }
+
+
 
        log_scope("set_invert_behavior");
        if (invert)
        {
                if (!inverted_behavior_)
                {
-                       inverted_behavior_ = true;
                        if (active_)
                        {
                                DBG_WB << "Whiteboard deactivated 
temporarily.\n";
+                               inverted_behavior_ = true;
                                set_active(false);
                        }
-                       else // active_ == false
+                       else if (!block_whiteboard_activation)
                        {
                                DBG_WB << "Whiteboard activated 
temporarily.\n";
+                               inverted_behavior_ = true;
                                set_active(true);
+                               static bool print_once = true;
+                               if (print_once)
+                               {
+                                       print_once = false;
+                                       print_to_chat("whiteboard", 
std::string("Hold the ctrl key to temporarily toggle the whiteboard.")
+                                               + " (Activate and then) 
Deactivate the whiteboard with the :wb command to erase all actions.");
+                                       print_help();
+                               }
                        }
                }
        }
@@ -143,15 +149,16 @@
        {
                if (inverted_behavior_)
                {
-                       inverted_behavior_ = false;
                        if (active_)
                        {
                                DBG_WB << "Whiteboard set back to deactivated 
status.\n";
+                               inverted_behavior_ = false;
                                set_active(false);
                        }
-                       else // active_ == false
+                       else if (!block_whiteboard_activation)
                        {
                                DBG_WB << "Whiteboard set back to activated 
status.\n";
+                               inverted_behavior_ = false;
                                set_active(true);
                        }
                }




Related Messages


Powered by MHonArc, Updated Wed Jul 28 22:40:15 2010