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/unit_types.cpp


From: ott
Subject: [Wesnoth-cvs-commits] wesnoth ./changelog src/unit_types.cpp
Date: Thu, 12 May 2005 14:08:26 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     ott <address@hidden>    05/05/12 18:08:26

Modified files:
        .              : changelog 
        src            : unit_types.cpp 

Log message:
        fix #13033: allow % in increase_attacks=

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.663&tr2=1.664&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.101&tr2=1.102&r1=text&r2=text

Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.663 wesnoth/changelog:1.664
--- wesnoth/changelog:1.663     Thu May 12 16:41:04 2005
+++ wesnoth/changelog   Thu May 12 18:08:26 2005
@@ -3,8 +3,8 @@
  * user interface improvements:
    * made menu widgets sortable
    * added %-to-kill to Damage Calculations
-   * 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
+   * unit defense in a terrain is displayed over the terrain when choosing move
+   * added 'Advanced' preferences: 'binary save files', 'show combat' initially
    * fix editor file chooser when starting directory has many files (#11698)
    * made it so network dialogs show progress of data transfers again
    * starting position in editor now starts at player 1 (#10625)
@@ -69,7 +69,8 @@
  * slow now works with berserk and is cumulative across berserk rounds
  * fix replays with idle_ai, as seen in user scenario Rebellion (#12943)
  * new WML preprocessor, allows for nested parentheses in macros (#10995)
- * new [random] representation, fixes error with saving complex scenarios 
(forum thread 5659)
+ * new [random] representation, fixes error saving complex scenarios (forum 
thread 5659)
+ * increase_attacks= attribute of [effect] now allows percentages (#13033)
  * various bug fixes and code cleanups
 
 Version 0.9.1:
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.101 wesnoth/src/unit_types.cpp:1.102
--- wesnoth/src/unit_types.cpp:1.101    Mon Apr 25 14:50:52 2005
+++ wesnoth/src/unit_types.cpp  Thu May 12 18:08:26 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.101 2005/04/25 14:50:52 ott Exp $ */
+/* $Id: unit_types.cpp,v 1.102 2005/05/12 18:08:26 ott Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -313,14 +313,22 @@
        }
 
        if(increase_attacks.empty() == false) {
-               const int increase = atoi(increase_attacks.c_str());
+               int increase = 0;
+               
+               if(increase_attacks[increase_attacks.size()-1] == '%') {
+                       const std::string 
inc(increase_attacks.begin(),increase_attacks.end()-1);
+                       increase = div100(num_attacks_ * atoi(inc.c_str()));
+               } else {
+                       increase = atoi(increase_attacks.c_str());
+               }
+
                num_attacks_ += increase;
                if(num_attacks_ < 1) {
                        num_attacks_ = 1;
                }
 
                if(description != NULL) {
-                       desc << (increase > 0 ? "+" : "") << increase << " " << 
_("strikes");
+                       desc << (increase_attacks[0] == '-' ? "" : "+") << 
increase_attacks << " " << _("strikes");
                }
        }
 




reply via email to

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