mail[Wesnoth-commits] r14086 - in /trunk: changelog src/unit_animation.cpp src/unit_animation.hpp


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

Header


Content

Posted by jeremy . rosen on October 26, 2006 - 20:54:
Author: boucman
Date: Thu Oct 26 20:53:28 2006
New Revision: 14086

URL: http://svn.gna.org/viewcvs/wesnoth?rev=14086&view=rev
Log:
allow frequency tweaking in animations

Modified:
    trunk/changelog
    trunk/src/unit_animation.cpp
    trunk/src/unit_animation.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=14086&r1=14085&r2=14086&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu Oct 26 20:53:28 2006
@@ -62,6 +62,7 @@
      in every scenario played using that era)
    * new operation for set_variable : divide
    * Animations now use duration= tag instead of begin= and end= (backward
+   * Animations now have a frequency= filter to allow to tweak realtive 
rarety
    compatible)
    * [message]s now use the duration= tag instead of [delay]ing afterwards
  * multiplayer game management

Modified: trunk/src/unit_animation.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_animation.cpp?rev=14086&r1=14085&r2=14086&view=diff
==============================================================================
--- trunk/src/unit_animation.cpp (original)
+++ trunk/src/unit_animation.cpp Thu Oct 26 20:53:28 2006
@@ -95,7 +95,8 @@
        add_frame(frame.duration(),frame,!frame.does_not_change());
 }
 
-unit_animation::unit_animation(const config& cfg,const std::string 
frame_string ):terrain_types(utils::split(cfg["terrain"])){
+unit_animation::unit_animation(const config& cfg,const std::string 
frame_string ):terrain_types(utils::split(cfg["terrain"]))
+{
        config::const_child_itors range = cfg.child_range(frame_string);
        if(cfg["start_time"].empty() &&range.first != range.second) {
                starting_frame_time_ = atoi((**range.first)["begin"].c_str());
@@ -121,6 +122,7 @@
        for(itor = cfg.child_range("secondary_unit_filter").first; itor 
<cfg.child_range("secondary_unit_filter").second;itor++) {
                secondary_unit_filter_.push_back(**itor);
        }
+       frequency_ = atoi(cfg["frequency"].c_str());    
 
        /* warn on deprecated WML */
        if(cfg.child("sound")) {
@@ -172,6 +174,9 @@
                }
 
        } else if (!unit_filter_.empty()) return -1;
+       if(frequency_ && !(rand()%frequency_)) return -1;
+
+       
 
        return result;
 }

Modified: trunk/src/unit_animation.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_animation.hpp?rev=14086&r1=14085&r2=14086&view=diff
==============================================================================
--- trunk/src/unit_animation.hpp (original)
+++ trunk/src/unit_animation.hpp Thu Oct 26 20:53:28 2006
@@ -42,6 +42,7 @@
                std::vector<config> unit_filter_;
                std::vector<config> secondary_unit_filter_;
                std::vector<gamemap::location::DIRECTION> directions;
+               int frequency_;
 };
 
 class attack_type;




Related Messages


Powered by MHonArc, Updated Thu Oct 26 21:41:11 2006