Skip to content
This repository was archived by the owner on Oct 4, 2018. It is now read-only.

Commit c80bfe7

Browse files
Fix the desynch bug
Ilwrath's shield must be visible for both parties upon the ship's death If the cloak is visible for one side and invisible for the other the game's internal states will end up differing, ultimately leading to a out of synch error
1 parent 63ccbbd commit c80bfe7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/uqm/tactrans.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include "libs/mathlib.h"
4444
#include "ships/ship.h"
4545

46+
#include "uqm/colors.h" // For Ilwrath INVIS_COLOR
47+
4648
static void cleanup_dead_ship (ELEMENT *ElementPtr);
4749

4850
static BOOLEAN dittyIsPlaying;
@@ -628,6 +630,21 @@ ship_death (ELEMENT *ShipPtr)
628630
StopMusic ();
629631

630632
GetElementStarShip (ShipPtr, &StarShipPtr);
633+
634+
// Enable Ilwrath's cloak visibility for both sides
635+
// if the ship was cloaked upon destruction
636+
// Having the cloak on for one side and off for one causes
637+
// a desynch in net play
638+
if (StarShipPtr->SpeciesID = ILWRATH_ID)
639+
{
640+
if (GetPrimType (&DisplayArray[ShipPtr->PrimIndex]) == STAMPFILL_PRIM)
641+
{
642+
PRIMITIVE *lpPrim;
643+
lpPrim = &(GLOBAL (DisplayArray))[ShipPtr->PrimIndex];
644+
SetPrimType(lpPrim, STAMPFILL_PRIM);
645+
SetPrimColor(lpPrim, INVIS_COLOR);
646+
}
647+
}
631648

632649
if (ShipPtr->mass_points <= MAX_SHIP_MASS)
633650
{ // Not running away and not reincarnating (Pkunk)
@@ -675,7 +692,7 @@ ship_death (ELEMENT *ShipPtr)
675692
StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 1),
676693
CalcSoundPosition (ShipPtr), ShipPtr,
677694
GAME_SOUND_PRIORITY + 1);
678-
695+
679696
++ShipPtr->life_span;
680697

681698
DeltaCrew (ShipPtr, -(SIZE)ShipPtr->crew_level);

0 commit comments

Comments
 (0)