mail[Wesnoth-commits] r20075 - in /trunk/src: game.cpp game_display.cpp image.cpp image.hpp


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

Header


Content

Posted by alinktomine on September 03, 2007 - 22:03:
Author: alink
Date: Mon Sep  3 22:02:28 2007
New Revision: 20075

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20075&view=rev
Log:
~TC was incompletly restored after the adhesion storm
Now initialize and reset TC in titlescreen for add-ons and campaigns icons
(previously was only initialized after having played a game)
This also restore coloring for case like ~TC(not a playing side)

Modified:
    trunk/src/game.cpp
    trunk/src/game_display.cpp
    trunk/src/image.cpp
    trunk/src/image.hpp

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=20075&r1=20074&r2=20075&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Mon Sep  3 22:02:28 2007
@@ -2013,6 +2013,10 @@
                //make sure the game config is always set to how it should be 
at the title screen
                game.reset_game_cfg();
 
+               // reset the TC, since a game can modify it, and it may be 
used
+               // by images in add-ons or campaigns dialogs
+               image::set_team_colors();
+
                statistics::fresh_stats();
 
                sound::play_music_repeatedly(game_config::title_music);

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=20075&r1=20074&r2=20075&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Mon Sep  3 22:02:28 2007
@@ -117,7 +117,7 @@
 
                
flags_.back().start_animation(rand()%flags_.back().get_end_time(), true);
        }
-       image::set_team_colors(side_colors);
+       image::set_team_colors(&side_colors);
 
        // Clear the screen contents
        surface const disp(screen_.getSurface());

Modified: trunk/src/image.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image.cpp?rev=20075&r1=20074&r2=20075&view=diff
==============================================================================
--- trunk/src/image.cpp (original)
+++ trunk/src/image.cpp Mon Sep  3 22:02:28 2007
@@ -335,9 +335,16 @@
                                                break;
                                        std::string f1,f2;
                                        int side_n = 
lexical_cast_default<int>(field.substr(0,pos),-1);
-                                       if (side_n > 
static_cast<int>(team_colors.size()) || side_n < 1)
-                                               break;
-                                       f1 = team_colors[side_n-1];
+                                       if (side_n < 1)
+                                                break;
+                                       else if (side_n < 
static_cast<int>(team_colors.size())) {
+                                               f1 = team_colors[side_n-1];
+                                       } else {
+                                               // this side is not inialized 
use default "n"
+                                               f1 = 
lexical_cast<std::string>(side_n);
+                                       }       
+
+                                       
                                        f2 = field.substr(pos+1);
                                        if(game_config::tc_info(f2).size()){
                                                function="RC";
@@ -461,9 +468,13 @@
        }
 }
 
-void set_team_colors(const std::vector<std::string>& colors)
-{
-       team_colors = colors;
+void set_team_colors(const std::vector<std::string>* colors)
+{
+       if (colors == NULL)
+               team_colors.clear();
+       else {
+               team_colors = *colors;
+       }
 }
 
 void set_image_mask(const std::string& /*image*/)

Modified: trunk/src/image.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image.hpp?rev=20075&r1=20074&r2=20075&view=diff
==============================================================================
--- trunk/src/image.hpp (original)
+++ trunk/src/image.hpp Mon Sep  3 22:02:28 2007
@@ -171,7 +171,8 @@
 
        ///set the team colors used by the TC image modification
        ///use a vector with one string for each team
-       void set_team_colors(const std::vector<std::string>& colors);
+       ///using NULL will reset to default TC
+       void set_team_colors(const std::vector<std::string>* colors = NULL);
 
        ///function which sets a certain image as a 'mask' for all scaled 
images.
        ///the 'mask' is blitted onto all scaled images.




Related Messages


Powered by MHonArc, Updated Mon Sep 03 22:20:19 2007