Skip to content

Commit

Permalink
Fixed crashing bug in kidnapping story
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Mar 2, 2016
1 parent 86826bf commit 605d7a6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
43 changes: 33 additions & 10 deletions arenascript.pp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ implementation
ASRD_InfoGear: GearPtr;
ASRD_GameBoard: GameBoardPtr;
ASRD_MemoMessage: String;
I_Persona: GearPtr;

NeedGC: Boolean;


Procedure ArenaScriptReDraw;
Expand Down Expand Up @@ -2150,7 +2151,7 @@ implementation
Source := PlotMaster( Source );
if ( Source <> Nil ) and ( Source^.G = GG_Plot ) then begin
AdvancePlot( GB , Source^.Parent , Source , N );
if ( I_Persona <> Nil ) and ( I_Persona^.Parent = Source ) then I_Persona := Nil;
NeedGC := True;
end;
end;
end;
Expand Down Expand Up @@ -2198,7 +2199,7 @@ implementation

{ Mark the story for deletion. }
Source^.G := GG_AbsolutelyNothing;
if ( I_Persona <> Nil ) and ( I_Persona^.Parent = Source ) then I_Persona := Nil;
NeedGC := True;
end;
end;

Expand Down Expand Up @@ -4091,7 +4092,6 @@ implementation
I_PC := PC;
I_NPC := NPC;
I_Rumors := CreateRumorList( GB , PC , NPC );
I_Persona := Interact;
{$IFDEF SDLMODE}
ASRD_GameBoard := GB;
{$ENDIF}
Expand Down Expand Up @@ -4170,7 +4170,7 @@ implementation

end;

until ( N = -1 ) or ( IntMenu^.NumItem < 1 ) or ( I_Endurance < 1 ) or ( I_NPC = Nil ) or (I_Persona = Nil);
until ( N = -1 ) or ( IntMenu^.NumItem < 1 ) or ( I_Endurance < 1 ) or ( I_NPC = Nil );

{ If the menu is empty, pause for a minute. Or at least a keypress. }
if IntMenu^.NumItem < 1 then begin
Expand All @@ -4193,10 +4193,10 @@ implementation
{ Check - If this persona gear is the child of a gear whose type }
{ is GG_ABSOLUTELYNOTHING, chances are that it used to be a plot }
{ but it's been advanced by the conversation. Delete it. }
if I_Persona <> Nil then begin
{if Interact <> Nil then begin
Interact := FindRoot( Interact );
PruneNothings( Interact );
end;
end;}

{ Set the ReTalk value. }
{ Base retalk time is 1500 ticks; may be raised or lowered depending }
Expand All @@ -4211,9 +4211,10 @@ implementation
DisposeRPGMenu( IntMenu );
DisposeSAtt( I_Rumors );

I_NPC := Nil;

{ Restore the display. }
ClrZone( ZONE_InteractTotal );
I_Persona := Nil;
end;

Procedure ForceInteract( GB: GameBoardPtr; CID: LongInt );
Expand Down Expand Up @@ -4280,13 +4281,29 @@ implementation
P2 := Plot^.Next;

{ Remove the plot, if it's been advanced. }
if Plot^.G = GG_AbsolutelyNothing then RemoveGear( Plot^.Parent^.InvCom , Plot );
{if Plot^.G = GG_AbsolutelyNothing then RemoveGear( Plot^.Parent^.InvCom , Plot );}
end;
Plot := P2;
end;
CheckTriggerAlongPath := it;
end;

Procedure DoScriptGC( GB: GameBoardPtr );
{ Get rid of any ABSOLUTELYNOTHINGS that may be hanging about. }
var
Adv: GearPtr;
begin
if NeedGC then begin
Adv := GG_LocateAdventure( GB, Nil );
if Adv <> Nil then begin
PruneNothings( Adv^.SubCom );
PruneNothings( Adv^.InvCom );
NeedGC := False;
end;
end;
end;


Procedure HandleTriggers( GB: GameBoardPtr );
{ Go through the list of triggers, enacting events if any are }
{ found. Deallocate the triggers as they are processed. }
Expand Down Expand Up @@ -4352,9 +4369,12 @@ implementation
DisposeSAtt( TList );

end;
DoScriptGC( GB );
end;
end;



initialization
SCRIPT_DynamicEncounter := Nil;
Grabbed_Gear := Nil;
Expand All @@ -4363,7 +4383,10 @@ initialization

lancemate_tactics_persona := LoadFile( 'lmtactics.txt' , Data_Directory );

I_Persona := Nil;
I_NPC := Nil;

NeedGC := False;


finalization
if SCRIPT_DynamicEncounter <> Nil then begin
Expand Down
4 changes: 4 additions & 0 deletions gears.pp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,11 @@ function FindRoot( Part: GearPtr ): GearPtr;

initialization
{ Make sure we have the required data directories. }
{$IFDEF WINDOWS}
Config_Directory := GetUserDir() + OS_Dir_Separator + 'gharena' + OS_Dir_Separator;
{$ELSE}
Config_Directory := GetAppConfigDir(False);
{$ENDIF}
Config_File := Config_Directory + 'gharena.cfg';

Save_Game_DirName := 'SaveGame';
Expand Down
2 changes: 2 additions & 0 deletions gearutil.pp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ function InGoodModule( Part: GearPtr ): Boolean;
else it := 'Platonic Form';
end;

if Part^.g = GG_AbsolutelyNothing then it := '~!' + it;

GearName := it;
end;

Expand Down
1 change: 1 addition & 0 deletions history.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fixed bug when story ends during a conversation (arenascript.pp)
- Added InfoTier stat for modules (ghmodule.pp,sdlinfo.pp,coninfo.pp)
- Fixed GuardFight1, GuardFight2 memos
- Fixed Deep Lobster sashimi bug (WMONdefault.txt)
Expand Down

0 comments on commit 605d7a6

Please sign in to comment.