From 484f1215646444e0a1c728610fa9bbe205c9d349 Mon Sep 17 00:00:00 2001 From: alb42 Date: Fri, 3 Jan 2020 17:36:16 +0100 Subject: [PATCH 1/3] Fixed: ERROR- RemoveCritter asked to remove a critter that dont exist. --- cbrain.pp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cbrain.pp b/cbrain.pp index c1e9ad2..5dde4ef 100644 --- a/cbrain.pp +++ b/cbrain.pp @@ -461,12 +461,14 @@ implementation end; end; end; - - {Update the critter's status.} - if NAttValue(C^.SF,NAG_StatusChange,SEF_Poison) <> 0 then begin - C^.HP := C^.HP - Random( 6 ); + {Protect against the case where the creature has already died} + if SC^.CAct <> Nil then begin + {Update the critter's status.} + if NAttValue(C^.SF,NAG_StatusChange,SEF_Poison) <> 0 then begin + C^.HP := C^.HP - Random( 6 ); + end; + UpdateStatusList( C^.SF ); end; - UpdateStatusList( C^.SF ); if C^.HP < 0 then CritterDeath(SC,C,False); C := SC^.CAct; From cd64b032be4091ac65edd3e8d253181372dd4156 Mon Sep 17 00:00:00 2001 From: alb42 Date: Fri, 3 Jan 2020 17:39:14 +0100 Subject: [PATCH 2/3] init black background, for systems not have black as default (e.g. Amiga) --- deadcold.pas | 1 + 1 file changed, 1 insertion(+) diff --git a/deadcold.pas b/deadcold.pas index 53b599b..c31a560 100644 --- a/deadcold.pas +++ b/deadcold.pas @@ -8,6 +8,7 @@ rpm: RPGMenuPtr; begin + TextBackground(Black); RPM := CreateRPGMenu( LightBlue , Green , LightGreen , 20 , 8 , 60 , 23 ); AddRPGMenuItem( RPM , 'Start New Game' , 1 ); AddRPGMenuItem( RPM , 'Load Saved Game' , 2 ); From b84f430be5f15ad9e2f532f92d5a4fc176bc0106 Mon Sep 17 00:00:00 2001 From: alb42 Date: Fri, 3 Jan 2020 18:00:38 +0100 Subject: [PATCH 3/3] no special treatmeant for directory separator needed, just use the constant for it --- dcplay.pp | 18 +++--------------- gamebook.pp | 15 ++++++++------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/dcplay.pp b/dcplay.pp index 5f3ca94..e6a198d 100644 --- a/dcplay.pp +++ b/dcplay.pp @@ -276,11 +276,7 @@ implementation DCGameMessage('Game Over.'); GamePause; - {$ifdef WINDOWS} - FName := FSearch( SC^.PC^.Name + '.txt' , 'savegame\' ); - {$else} - FName := FSearch( SC^.PC^.Name + '.txt' , 'savegame/' ); - {$endif} + FName := FSearch( SC^.PC^.Name + '.txt' , 'savegame' + DirectorySeparator); if ( FName <> '' ) and PLAY_DangerOn then begin Assign(F,FName); Erase(F); @@ -327,11 +323,7 @@ implementation begin { Create the menu. } RPM := CreateRPGMenu( LightBlue , Green , LightGreen , 20 , 8 , 60 , 23 ); - {$ifdef WINDOWS} - BuildFileMenu( RPM , 'savegame\*.txt' ); - {$else} - BuildFileMenu( RPM , 'savegame/*.txt' ); - {$endif} + BuildFileMenu( RPM , 'savegame'+ DirectorySeparator + '*.txt' ); if RPM^.numitem < 1 then begin { No save game files were found. Jump to STARTGAME, } @@ -349,11 +341,7 @@ implementation { main menu. Otherwise, load the file and pass the } { scenario to PLAYSCENE. } if FName <> '' then begin - {$ifdef WINDOWS} - SC := LoadGame( 'savegame\' + FName ); - {$else} - SC := LoadGame( 'savegame/' + FName ); - {$endif} + SC := LoadGame( 'savegame' + DirectorySeparator + FName ); PlayScene( SC ); end; end; diff --git a/gamebook.pp b/gamebook.pp index fd94335..90389c2 100644 --- a/gamebook.pp +++ b/gamebook.pp @@ -354,12 +354,12 @@ implementation T: Integer; begin {Open the file.} - {$ifdef WINDOWS} - Assign(F,'savegame\' + SC^.PC^.Name + '.txt'); - {$else} - Assign(F,'savegame/' + SC^.PC^.Name + '.txt'); - {$endif} + Assign(F,'savegame' + DirectorySeparator + SC^.PC^.Name + '.txt'); + {$i-} ReWrite(F); + {$+} + if IOResult = 0 then + begin {Write the savefile version first of all.} writeln(F,SaveFileVersion); @@ -407,8 +407,9 @@ implementation end; end; Writeln( F , '-1' ); - {Close the file} - Close(F); + {Close the file} + Close(F); + end; end; Function LoadGame( FName: String ): ScenarioPtr;