From: <mcm...@us...> - 2011-08-27 20:55:38
|
Revision: 3673 http://sc2.svn.sourceforge.net/sc2/?rev=3673&view=rev Author: mcmartin Date: 2011-08-27 20:55:32 +0000 (Sat, 27 Aug 2011) Log Message: ----------- Conversation logic refinements (#567, #756) Modified Paths: -------------- trunk/sc2/src/uqm/comm/melnorm/melnorm.c trunk/sc2/src/uqm/comm/utwig/utwigc.c Modified: trunk/sc2/src/uqm/comm/melnorm/melnorm.c =================================================================== --- trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2011-08-27 20:54:35 UTC (rev 3672) +++ trunk/sc2/src/uqm/comm/melnorm/melnorm.c 2011-08-27 20:55:32 UTC (rev 3673) @@ -611,6 +611,15 @@ BYTE module_count[BOMB_MODULE_0]; BYTE slot; DWORD capacity; + RandomContext *rc; + + // Bug #567 + // In order to offer the same deal each time if it is refused, we seed + // the random number generator with our location, thus making the deal + // a repeatable pseudo-random function of where we got stuck and what, + // exactly, is on our ship. + rc = RandomContext_New(); + RandomContext_SeedRandom(rc, GLOBAL_SIS (log_y) * LOG_UNITS_X + GLOBAL_SIS (log_x)); SIS_copy = GlobData.SIS_state; for (i = PLANET_LANDER; i < BOMB_MODULE_0; ++i) @@ -654,7 +663,7 @@ { DWORD rand_val; - rand_val = TFB_Random (); + rand_val = RandomContext_Random (rc); switch (which_module = LOBYTE (LOWORD (rand_val)) % (CREW_POD + 1)) { case PLANET_LANDER: @@ -703,6 +712,7 @@ end_mod = which_module; ++module_count[which_module]; total += GLOBAL (ModuleCost[which_module]); + RandomContext_Delete (rc); } if (total == 0) Modified: trunk/sc2/src/uqm/comm/utwig/utwigc.c =================================================================== --- trunk/sc2/src/uqm/comm/utwig/utwigc.c 2011-08-27 20:54:35 UTC (rev 3672) +++ trunk/sc2/src/uqm/comm/utwig/utwigc.c 2011-08-27 20:55:32 UTC (rev 3673) @@ -390,7 +390,7 @@ Response (what_now_homeworld, AlliedHome); if (PHRASE_ENABLED (how_is_ultron)) Response (how_is_ultron, AlliedHome); - if (NumVisits == 0) + if (NumVisits == 0 && ActivateStarShip (UTWIG_SHIP, FEASIBILITY_STUDY) != 0) Response (can_you_help, ExitConversation); Response (bye_allied_homeworld, ExitConversation); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |