Fixed Bug #704338: Crash: Town Hall Destroyed, Peasant inside
This commit is contained in:
parent
d64d194567
commit
e5a6aba98b
2 changed files with 17 additions and 7 deletions
|
@ -1133,6 +1133,8 @@
|
|||
<LI><B>1.19pre1</B>
|
||||
<LI>Fixed setup script for BSD and 'sh' (from ppl).
|
||||
<LI>Added support for 16x16 tiles (from Jimmy Salmon).
|
||||
<LI>Fixed Bug #704338: Crash: Town Hall Destroyed, Peasant inside
|
||||
(from Russell Smith)
|
||||
<LI>+++
|
||||
</UL>
|
||||
</UL>
|
||||
|
|
|
@ -157,6 +157,7 @@ global void ReleaseUnit(Unit* unit)
|
|||
DebugCheck( *unit->UnitSlot!=unit );
|
||||
temp=Units[--NumUnits];
|
||||
temp->UnitSlot=unit->UnitSlot;
|
||||
temp->Slot=unit->Slot;
|
||||
*unit->UnitSlot=temp;
|
||||
Units[NumUnits]=NULL;
|
||||
//
|
||||
|
@ -2229,7 +2230,7 @@ global void DropOutAll(const Unit* source)
|
|||
i=0;
|
||||
for( table=Units; table<Units+NumUnits; table++ ) {
|
||||
unit=*table;
|
||||
if( unit->Removed && unit->X==source->X && unit->Y==source->Y ) {
|
||||
if( unit->Removed && unit->Next==source ) {
|
||||
++i;
|
||||
DropOutOnSide(unit,LookingW
|
||||
,source->Type->TileWidth,source->Type->TileHeight);
|
||||
|
@ -3414,8 +3415,8 @@ global void LetUnitDie(Unit* unit)
|
|||
// Restore value for oil-patch
|
||||
unit->Value=unit->Data.Builded.Worker->Value;
|
||||
}
|
||||
DestroyAllInside(unit);
|
||||
}
|
||||
DestroyAllInside(unit);
|
||||
|
||||
RemoveUnit(unit,NULL);
|
||||
UnitLost(unit);
|
||||
|
@ -3505,7 +3506,9 @@ global void LetUnitDie(Unit* unit)
|
|||
global void DestroyAllInside(Unit* source)
|
||||
{
|
||||
Unit* unit;
|
||||
Unit* table[UnitMax];
|
||||
int i;
|
||||
int j;
|
||||
|
||||
//
|
||||
// Destroy all units in Transporters
|
||||
|
@ -3539,15 +3542,20 @@ global void DestroyAllInside(Unit* source)
|
|||
//
|
||||
// Destroy all units in buildings or Resources (mines...)
|
||||
//
|
||||
j = 0;
|
||||
for( i=0; i<NumUnits; i++ ) {
|
||||
unit=Units[i];
|
||||
if( !unit->Removed ) { // not an unit inside
|
||||
continue;
|
||||
}
|
||||
if( unit->X==source->X && unit->Y==source->Y ) {
|
||||
LetUnitDie(unit);
|
||||
if( unit->Removed && unit->Next==source ) {
|
||||
table[j++] = unit;
|
||||
}
|
||||
}
|
||||
for( i=0; i<j; i++ ) {
|
||||
unit=table[i];
|
||||
RemoveUnit(unit,NULL);
|
||||
UnitLost(unit);
|
||||
UnitClearOrders(unit);
|
||||
ReleaseUnit(unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue