mail[Wesnoth-commits] r13866 - in /trunk: changelog data/scenario-test.cfg src/builder.cpp


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

Header


Content

Posted by mcn4bb on October 09, 2006 - 23:39:
Author: darthfool
Date: Mon Oct  9 23:38:45 2006
New Revision: 13866

URL: http://svn.gna.org/viewcvs/wesnoth?rev=13866&view=rev
Log:
fixed bug 7274, terrain probabilites when using rotations

Modified:
    trunk/changelog
    trunk/data/scenario-test.cfg
    trunk/src/builder.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=13866&r1=13865&r2=13866&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Mon Oct  9 23:38:45 2006
@@ -32,6 +32,7 @@
    * show leader's name and colour at status table even when that team is 
fogged
      (patch #605)
  * WML engine
+   * fixed terrain probabilities for terrains defined with rotations (bug 
#7274)
    * added a 'hide_help' key that prevents a unit type from being listed in 
the
      in-game help
    * added an 'allow_new_game' key (default=yes) to prevent [multiplayer]

Modified: trunk/data/scenario-test.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=13866&r1=13865&r2=13866&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Mon Oct  9 23:38:45 2006
@@ -1,25 +1,46 @@
+#testing terrain rotation probability
+[terrain]
+symbol_image=castle
+id=castle
+name= _ "Castle"
+char=y
+aliasof=W
+[/terrain]
+
+{FORESTADJ y g 33 mountains}
+{FORESTADJ y g 50 forest}
+{FORESTADJ y g 100 reed1-small}
+
+
+#{SHEX y overlay 50 mountains}
+#{SHEX y overlay 100 forest}
+
 [test]
        name="Test scenario"
+
+
+
        map_data="mmmmggggggggggggggggggggggggggggggggg
 mmmmggggggggggggggggggggggggggggggggg
 mgggggCCCCggggggggggggggggggggggggggg
 mgggggC1Cgggggggggfffffgggggggggggggg
 mgggggCCCgggggggggfffffgggccccggggggg
 mgggggCCCgggggggggfffffgggcchhggggggg
-mgggggtgtgggggggggggggggggccccggggggg
-ggggggggggggggggggggggggggggggggggggg
-ggggggggggggggggggggggggggggggggggggg
-ggggggggggggggggggggggggggggggggggggg
-gggggggggggggggggggggCCCggggggggggggg
-gggggggggggggggggggggCCCggggggggggggg
-ggggggggggggggggggggggggggggggggggggg
-ggnnKnggggggggggggggggggggggggggggggg
-gggnngggggggggggggggggggggggggggggggg
-gggggggggggggggggggggggggggg2gggggggg
-gggggggDgggggtggggggggggggggggggggggg
-ggggggDgggtgggggggggggggggggggggggggg
-ggggggggggggggggggggggggggggggggggggg
+mgggggtgtgggggggggggggggggccccygggygg
+ggggggggggggggggggggggggggggggggygggg
+ggggggggggggggggggggggggggggggygggygg
+ggggggggggggggggggggggggggggggggygggg
+gggggggggggggggggggggCCCggggggygggygg
+gggggggggggggggggggggCCCggggggggygggg
+ggggggggggggggggggggggggggggggygggygg
+ggnnKnggggggggggggggggggggggggggygggg
+gggnngggggggggggggggggggggggggygggygg
+gggggggggggggggggggggggggggg2gggygggg
+gggggggDgggggtggggggggggggggggygggygg
+ggggggDgggtgggggggggggggggggggggygggg
+ggggggggggggggggggggggggggggggygggygg
 "
+
 
 [event]
 name=moveto

Modified: trunk/src/builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/builder.cpp?rev=13866&r1=13865&r2=13866&view=diff
==============================================================================
--- trunk/src/builder.cpp (original)
+++ trunk/src/builder.cpp Mon Oct  9 23:38:45 2006
@@ -650,9 +650,15 @@
                add_rule(rules, tpl);
        } else {
                const std::vector<std::string>& rot = utils::split(rotations, 
',');
+               int prob = tpl.probability;
+               double p = ((float)prob)/100;
+               double in = 1.0/rot.size(); 
+               prob = (prob >= 100 || prob<0) ? 100 : floor(100*(1.0 - 
pow(1.0 - p,in)));
 
                for(size_t angle = 0; angle < rot.size(); angle++) {
                        building_rule rule = rotate_rule(tpl, angle, rot);
+                       rule.probability=prob;
+                       //correct probability for number of rotations
                        add_rule(rules, rule);
                }
        }




Related Messages


Powered by MHonArc, Updated Tue Oct 10 00:00:12 2006