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

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

[Wesnoth-cvs-commits] wesnoth ./changelog src/game_config.hpp src/gam...


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth ./changelog src/game_config.hpp src/gam...
Date: Thu, 05 May 2005 21:07:59 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/05/06 01:07:59

Modified files:
        .              : changelog 
        src            : game_config.hpp game_config.cpp display.cpp 
Added files:
        images/misc    : foot-left-n-slow.png foot-left-nw-slow.png 
                         foot-right-n-slow.png foot-right-nw-slow.png 

Log message:
        made it so a unit's defense is shown over a hex when the unit is 
selected and a hex is moused-over; also made it so different footprints are 
used dependent on unit speed

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/images/misc/foot-left-n-slow.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/images/misc/foot-left-nw-slow.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/images/misc/foot-right-n-slow.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/images/misc/foot-right-nw-slow.png?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.649&tr2=1.650&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_config.cpp.diff?tr1=1.94&tr2=1.95&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.318&tr2=1.319&r1=text&r2=text

Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.649 wesnoth/changelog:1.650
--- wesnoth/changelog:1.649     Thu May  5 23:04:25 2005
+++ wesnoth/changelog   Fri May  6 01:07:58 2005
@@ -1,5 +1,6 @@
 CVS HEAD:
  * user interface improvements:
+   * made it so a unit's defense in a terrain is displayed over the terrain 
when choosing to move the unit
    * added 'Advanced' preferences section with 'binary save files' and 'show 
combat' as initial options
    * fix editor file chooser when starting directory has many files (#11698)
    * made it so network dialogs show progress of data transfers again
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.318 wesnoth/src/display.cpp:1.319
--- wesnoth/src/display.cpp:1.318       Fri Apr 22 19:19:21 2005
+++ wesnoth/src/display.cpp     Fri May  6 01:07:59 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.318 2005/04/22 19:19:21 ott Exp $ */
+/* $Id: display.cpp,v 1.319 2005/05/06 01:07:59 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1646,29 +1646,40 @@
                        }
                }
        }
+
+       const std::vector<std::string>* image_category = NULL;
 
-       static const std::string left_nw(game_config::foot_left_nw);
-       static const std::string left_n(game_config::foot_left_n);
-       static const std::string right_nw(game_config::foot_right_nw);
-       static const std::string right_n(game_config::foot_right_n);
-
-       const std::string* image_str = &left_nw;
 
        if(left_foot) {
                if(direction == gamemap::location::NORTH ||
                   direction == gamemap::location::SOUTH) {
-                       image_str = &left_n;
+                       image_category = &game_config::foot_left_n;
                } else {
-                       image_str = &left_nw;
+                       image_category = &game_config::foot_left_nw;
                }
        } else {
                if(direction == gamemap::location::NORTH ||
                   direction == gamemap::location::SOUTH) {
-                       image_str = &right_n;
+                       image_category = &game_config::foot_right_n;
                } else {
-                       image_str = &right_nw;
+                       image_category = &game_config::foot_right_nw;
                }
-       }
+       }
+
+       if(image_category == NULL || image_category->empty()) {
+               return;
+       }
+
+       const std::string* image_str = &image_category->front();
+       const unit_map::const_iterator un = units_.find(route_.steps.front());
+       if(un != units_.end()) {
+               const int move_cost = 
un->second.movement_cost(map_,map_.get_terrain(loc)) - 1;
+               if(move_cost >= int(image_category->size())) {
+                       image_str = &image_category->back();
+               } else if(move_cost > 0) {
+                       image_str = &(*image_category)[move_cost];
+               }
+       }
 
        surface image(image::get_image(*image_str));
        if(image == NULL) {
@@ -1685,26 +1696,44 @@
                image.assign(image::reverse_image(image));
        }
 
-       draw_unit(xloc,yloc,image,vflip,ftofxp(0.5));
+       draw_unit(xloc,yloc,image,vflip,ftofxp(0.5));
+
+       if(show_time == false) {
+               return;
+       }
+
+       std::stringstream text;
+
+#ifndef USE_TINY_GUI
+       if(un != units_.end() && zoom_ >= DefaultZoom) {
+               text << 
(100-un->second.defense_modifier(map_,map_.get_terrain(loc))) << "%";
+       }
+#endif
+
+       if(route_.move_left > 0 && route_.move_left < 10) {
+
+               text << " (" << char('1' + route_.move_left) << ")";
+       }
+
+       const std::string& str = text.str();
+               
+       if(str.empty() == false) {
+               const SDL_Rect& rect = map_area();
 
-       if(show_time && route_.move_left > 0 && route_.move_left < 10) {
-               const SDL_Rect& rect = map_area();
-               std::string str(1,'x');
-               str[0] = '1' + route_.move_left;
-               const SDL_Rect& text_area = 
font::text_area(str,font::SIZE_LARGE);
+               const SDL_Rect& text_area = 
font::text_area(str,font::SIZE_PLUS);
                const int x = xloc + zoom_/2 - text_area.w/2;
                const int y = yloc + zoom_/2 - text_area.h/2;
 
                //draw the text with a black outline
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y-1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y+1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x,y-1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y-1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y+1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x,y+1);
-               
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::YELLOW_COLOUR,str,x,y);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y-1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y+1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x,y-1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y-1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y+1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x,y+1);
+               
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::YELLOW_COLOUR,str,x,y);
        }
 }
 
Index: wesnoth/src/game_config.cpp
diff -u wesnoth/src/game_config.cpp:1.94 wesnoth/src/game_config.cpp:1.95
--- wesnoth/src/game_config.cpp:1.94    Thu Mar 10 00:00:06 2005
+++ wesnoth/src/game_config.cpp Fri May  6 01:07:59 2005
@@ -1,4 +1,4 @@
-/* $Id: game_config.cpp,v 1.94 2005/03/10 00:00:06 ydirson Exp $ */
+/* $Id: game_config.cpp,v 1.95 2005/05/06 01:07:59 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -10,12 +10,13 @@
 
    See the COPYING file for more details.
 */
+
+#include "global.hpp"
 
 #include "config.hpp"
-#include "global.hpp"
-
 #include "game_config.hpp"
-#include "wesconfig.h"
+#include "wesconfig.h"
+#include "serialization/string_utils.hpp"
 
 #include <cstdlib>
 
@@ -56,7 +57,7 @@
        std::string dot_image = "misc/dot.png";
        std::string cross_image = "misc/cross.png";
        
-       std::string foot_left_nw, foot_left_n, foot_right_nw, foot_right_n;
+       std::vector<std::string> foot_left_nw, foot_left_n, foot_right_nw, 
foot_right_n;
 
        std::string observer_image;
        
@@ -126,10 +127,10 @@
                cross_image = v["cross_image"];
                dot_image = v["dot_image"];
 
-               foot_left_nw = v["footprint_left_nw"];
-               foot_left_n = v["footprint_left_n"];
-               foot_right_nw = v["footprint_right_nw"];
-               foot_right_n = v["footprint_right_n"];
+               foot_left_nw = utils::split(v["footprint_left_nw"]);
+               foot_left_n = utils::split(v["footprint_left_n"]);
+               foot_right_nw = utils::split(v["footprint_right_nw"]);
+               foot_right_n = utils::split(v["footprint_right_n"]);
 
                missile_n_image = v["missile_n_image"];
                missile_ne_image = v["missile_ne_image"];
Index: wesnoth/src/game_config.hpp
diff -u wesnoth/src/game_config.hpp:1.27 wesnoth/src/game_config.hpp:1.28
--- wesnoth/src/game_config.hpp:1.27    Thu Mar 10 00:00:06 2005
+++ wesnoth/src/game_config.hpp Fri May  6 01:07:59 2005
@@ -1,4 +1,4 @@
-/* $Id: game_config.hpp,v 1.27 2005/03/10 00:00:06 ydirson Exp $ */
+/* $Id: game_config.hpp,v 1.28 2005/05/06 01:07:59 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -15,7 +15,8 @@
 
 class config;
 
-#include <string>
+#include <string>
+#include <vector>
 
 //basic game configuration information is here.
 namespace game_config
@@ -39,10 +40,11 @@
        extern std::string game_icon, game_title, game_logo, title_music, 
map_image, rightside_image, rightside_image_bot,
                               moved_energy_image, unmoved_energy_image, 
partmoved_energy_image,
                                           
enemy_energy_image,ally_energy_image,flag_image,
-                                          dot_image,cross_image,
-                                          
foot_left_nw,foot_left_n,foot_right_nw,foot_right_n,
+                                          dot_image,cross_image,               
           
                                           
missile_n_image,missile_ne_image,terrain_mask_image,observer_image,download_campaign_image,
-                                          
checked_menu_image,unchecked_menu_image;
+                                          
checked_menu_image,unchecked_menu_image;
+
+       extern std::vector<std::string> 
foot_left_nw,foot_left_n,foot_right_nw,foot_right_n;
 
        extern int title_logo_x, title_logo_y, title_buttons_x, 
title_buttons_y, title_buttons_padding, title_tip_x, title_tip_y, 
title_tip_width, title_tip_padding;
 




reply via email to

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