mail[Wesnoth-commits] r43444 - in /trunk/src: arrow.cpp arrow.hpp


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

Header


Content

Posted by gabrielmorin on June 15, 2010 - 00:59:
Author: gabba
Date: Tue Jun 15 00:59:17 2010
New Revision: 43444

URL: http://svn.gna.org/viewcvs/wesnoth?rev=43444&view=rev
Log:
Arrow: Little change to path validation

Modified:
    trunk/src/arrow.cpp
    trunk/src/arrow.hpp

Modified: trunk/src/arrow.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/arrow.cpp?rev=43444&r1=43443&r2=43444&view=diff
==============================================================================
--- trunk/src/arrow.cpp (original)
+++ trunk/src/arrow.cpp Tue Jun 15 00:59:17 2010
@@ -45,10 +45,10 @@
 
 bool arrow::set_path(const arrow_path_t &path)
 {
-       previous_path_ = path_;
-       path_ = path;
-       if (valid_path())
-       {
+       if (valid_path(path))
+       {
+               previous_path_ = path_;
+               path_ = path;
                update_symbols(previous_path_);
                return true;
        }
@@ -61,7 +61,7 @@
 void arrow::set_color(const std::string& color)
 {
        color_ = color;
-       if (valid_path())
+       if (valid_path(path_))
        {
                update_symbols(path_);
        }
@@ -70,7 +70,7 @@
 void arrow::set_style(const std::string& style)
 {
        style_ = style;
-       if (valid_path())
+       if (valid_path(path_))
        {
                update_symbols(path_);
        }
@@ -79,7 +79,7 @@
 void arrow::set_layer(const display::tdrawing_layer & layer)
 {
        layer_ = layer;
-       if (valid_path())
+       if (valid_path(path_))
        {
                invalidate_arrow_path(path_);
                notify_arrow_changed();
@@ -89,7 +89,7 @@
 void arrow::set_alpha(float alpha)
 {
        alpha_ = ftofxp(alpha);
-       if (valid_path())
+       if (valid_path(path_))
        {
                update_symbols(path_);
        }
@@ -111,9 +111,9 @@
                                loc, image::get_image(symbols_map_[loc], 
image::SCALED_TO_ZOOM), false, false, alpha_);
 }
 
-bool arrow::valid_path() const
-{
-       if (path_.size() >= 2)
+bool arrow::valid_path(arrow_path_t path) const
+{
+       if (path.size() >= 2)
                return true;
        else
                return false;
@@ -131,7 +131,7 @@
 
 void arrow::update_symbols(arrow_path_t old_path)
 {
-       if (!valid_path())
+       if (!valid_path(path_))
        {
                WRN_ARR << "arrow::update_symbols called with invalid path\n";
                return;

Modified: trunk/src/arrow.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/arrow.hpp?rev=43444&r1=43443&r2=43444&view=diff
==============================================================================
--- trunk/src/arrow.hpp (original)
+++ trunk/src/arrow.hpp Tue Jun 15 00:59:17 2010
@@ -78,7 +78,7 @@
        void draw_hex(const map_location & hex);
 
        /// Checks that the path is not of length 0 or 1
-       bool valid_path() const;
+       bool valid_path(arrow_path_t path) const;
 
        void add_observer(arrow_observer & observer);
 




Related Messages


Powered by MHonArc, Updated Tue Jun 15 01:00:13 2010