Conversation logic refinements (#567, #756)

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3673 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2011-08-27 20:55:32 +00:00
parent 2b41e76eeb
commit f3928c731a
2 changed files with 12 additions and 2 deletions
+11 -1
View File
@@ -611,6 +611,15 @@ StripShip (COUNT fuel_required)
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 @@ StripShip (COUNT fuel_required)
{
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 @@ StripShip (COUNT fuel_required)
end_mod = which_module;
++module_count[which_module];
total += GLOBAL (ModuleCost[which_module]);
RandomContext_Delete (rc);
}
if (total == 0)
+1 -1
View File
@@ -390,7 +390,7 @@ AlliedHome (RESPONSE_REF R)
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);
}