Fix bug #1612 - ignore `turnOffMultiMsg` for sending droid deaths from HP loss, since they aren't handled by the caller of `turnOffMultiMsg`.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9943 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-02-21 16:31:35 +00:00 committed by Git SVN Gateway
parent d96986488f
commit 9dbc31ade2
2 changed files with 12 additions and 4 deletions

View File

@ -193,7 +193,6 @@ float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weap
else if (relativeDamage < 0.0f)
{
// HACK: Prevent transporters from being destroyed in single player
// FIXME: in projectile routines, turnOffMultiMsg() is called, and bites us here
if ( (game.type == CAMPAIGN) && !bMultiPlayer && (psDroid->droidType == DROID_TRANSPORTER) )
{
debug(LOG_ATTACK, "Transport(%d) saved from death--since it should never die (SP only)", psDroid->id);
@ -227,7 +226,18 @@ float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weap
else
{
debug(LOG_DEATH, "droidDamage: Droid %d beyond repair", (int)psDroid->id);
destroyDroid(psDroid);
// This should be sent even if multi messages are turned off, as the group message that was
// sent won't contain the destroyed droid
if (bMultiPlayer && !bMultiMessages)
{
bMultiMessages = true;
destroyDroid(psDroid);
bMultiMessages = false;
}
else
{
destroyDroid(psDroid);
}
}
}

View File

@ -1275,8 +1275,6 @@ static void proj_ImpactFunc( PROJECTILE *psObj )
//Watermelon:uses a slightly different check for angle,
// since fragment of a project is from the explosion spot not from the projectile start position
impactSide = getHitSide(psObj, (BASE_OBJECT *)psCurrD);
// FIXME: This screws us! A droid *can* die in the function below!
// which means we can't send that info to other players since turnOffMultiMsg() is off!
relativeDamage = droidDamage(psCurrD, damage, psStats->weaponClass, psStats->weaponSubClass, impactSide);
turnOffMultiMsg(false); // multiplay msgs back on.