mail[Wesnoth-commits] r37297 - in /trunk/src: mouse_events.cpp random.cpp


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

Header


Content

Posted by kailoran on July 28, 2009 - 14:56:
Author: ilor
Date: Tue Jul 28 14:56:38 2009
New Revision: 37297

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37297&view=rev
Log:
tweak new RNG behavior in SP

Modified:
    trunk/src/mouse_events.cpp
    trunk/src/random.cpp

Modified: trunk/src/mouse_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=37297&r1=37296&r2=37297&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Tue Jul 28 14:56:38 2009
@@ -696,7 +696,6 @@
        // this function gets it's arguments by value because the calling 
function
        // object might get deleted in the clear callback call below, 
invalidating
        // const ref arguments
-       rand_rng::invalidate_seed();
        rand_rng::clear_new_seed_callback();
        LOG_NG << "Performing attack with seed " << seed << "\n";
        recorder.add_seed("attack", seed);

Modified: trunk/src/random.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/random.cpp?rev=37297&r1=37296&r2=37297&view=diff
==============================================================================
--- trunk/src/random.cpp (original)
+++ trunk/src/random.cpp Tue Jul 28 14:56:38 2009
@@ -102,9 +102,12 @@
 
 void invalidate_seed()
 {
-       DBG_RND << "invalidate_seed\n";
-       last_seed = rand(); //for SP
-       DBG_RND << "seed becomes " << last_seed << "\n";
+       LOG_RND << "invalidate_seed\n";
+       assert(random_generator!=NULL);
+       last_seed = rand();
+       if (has_valid_seed()) { //aka SRNG is disabled
+               random_generator->set_seed(last_seed);
+       }
        seed_valid = false;
 }
 




Related Messages


Powered by MHonArc, Updated Tue Jul 28 15:01:22 2009