Skip to content

Commit

Permalink
Fixed bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
devapromix committed Mar 3, 2024
1 parent 8368f72 commit 7d644ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Sources/Game/TransportTycoon.Game.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ TGame = class(TObject)
FRace: TRaceEnum;
FSlotStr: array [TSlot] of string;
FFullscreen: Boolean;
FCanClose: Boolean;
procedure ForceDirs;
public const
MaxLoan = 200000;
Expand All @@ -74,6 +75,7 @@ TGame = class(TObject)
property Speed: TGameSpeedEnum read FSpeed;
property Race: TRaceEnum read FRace write FRace;
property Fullscreen: Boolean read FFullscreen write FFullscreen;
property CanClose: Boolean read FCanClose write FCanClose;
procedure Clear;
procedure Step;
function GetPath(ASubDir: string): string;
Expand Down Expand Up @@ -116,6 +118,7 @@ constructor TGame.Create;
var
LParam: Integer;
begin
FCanClose := False;
FRace := reHuman;
FIsOrder := False;
FIsDebug := False;
Expand Down
10 changes: 5 additions & 5 deletions Sources/Scenes/TransportTycoon.Scene.Dialog.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ procedure TSceneDialog.Render;
begin
DrawMap(Self.ScreenWidth, Self.ScreenHeight);

DrawFrame(LCaption, 40, 10);
DrawText(14, LMessage);
AddButton(17, 'ENTER', 'Yes');
DrawFrame(LCaption, 40, 9);
DrawText(15, LMessage);
AddButton(17, 'ENTER', 'Leave');
AddButton(17, 'ESC', 'Cancel');

if LIsDrawBar then
Expand All @@ -70,9 +70,9 @@ procedure TSceneDialog.Update(var AKey: Word);
if (GetButtonsY = MY) then
begin
case MX of
27 .. 37:
26 .. 38:
AKey := TK_ENTER;
41 .. 52:
42 .. 53:
AKey := TK_ESCAPE;
end;
end;
Expand Down
1 change: 1 addition & 0 deletions Sources/Scenes/TransportTycoon.Scene.Menu.Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ implementation

procedure Close();
begin
Game.CanClose := True;
terminal_close();
end;

Expand Down
2 changes: 1 addition & 1 deletion Sources/TransportTycoon.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ begin
LTick := 0;
Game.Step;
end;
until (LKey = TK_CLOSE);
until Game.CanClose;
terminal_close();
finally
FreeAndNil(Scenes);
Expand Down

0 comments on commit 7d644ea

Please sign in to comment.