Skip to content

Commit 88af08d

Browse files
committed
Remade android lose/win crash fix
1 parent ac33273 commit 88af08d

2 files changed

Lines changed: 14 additions & 36 deletions

File tree

code/gameoptions.pas

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,20 @@ implementation
6060
UserNameKey = 'UserName';
6161
UserGuidKey = 'UserGuid';
6262

63-
{
6463
procedure SetValue<T>(const AKey: string; AValue: T);
6564
begin
6665
UserConfig.SetValue(AKey, AValue);
6766
if UserConfig.Modified then
6867
UserConfig.Save();
6968
end;
70-
}
71-
72-
procedure SetValue(const AKey: string; const AValue: string); overload;
73-
begin
74-
UserConfig.SetValue(AKey, AValue);
75-
if UserConfig.Modified then
76-
UserConfig.Save();
77-
end;
78-
79-
procedure SetValue(const AKey: string; AValue: Boolean); overload;
80-
begin
81-
UserConfig.SetValue(AKey, AValue);
82-
if UserConfig.Modified then
83-
UserConfig.Save();
84-
end;
85-
86-
procedure SetValue(const AKey: string; AValue: Integer); overload;
87-
begin
88-
UserConfig.SetValue(AKey, AValue);
89-
if UserConfig.Modified then
90-
UserConfig.Save();
91-
end;
9269

9370
function Difficulty(): NDifficulty;
9471
begin
9572
Result := NDifficulty(EnumValue(ETPDifficulty, UserConfig.GetValue(DifficultyKey, '')));
9673
if Ord(Result) in [0..254] then
9774
Exit;
9875
Result := DifficultyDefault;
99-
SetValue(DifficultyKey, EnumName(ETPDifficulty, Ord(Result)));
76+
SetValue<string>(DifficultyKey, EnumName(ETPDifficulty, Ord(Result)));
10077
end;
10178

10279
function MusicLevel(): Byte;
@@ -106,12 +83,12 @@ function MusicLevel(): Byte;
10683

10784
procedure SetMusicLevel(AValue: Byte);
10885
begin
109-
SetValue(MusicKey, AValue);
86+
SetValue<byte>(MusicKey, AValue);
11087
end;
11188

11289
procedure SetDifficulty(AValue: NDifficulty);
11390
begin
114-
SetValue(DifficultyKey, DifficultyName(AValue));
91+
SetValue<string>(DifficultyKey, DifficultyName(AValue));
11592
end;
11693

11794
function DifficultyName(AValue: NDifficulty): string;
@@ -126,7 +103,7 @@ function Fullscreen(): Boolean;
126103

127104
procedure SetFullscreen(AValue: Boolean);
128105
begin
129-
SetValue(FullscreenKey, AValue);
106+
SetValue<Boolean>(FullscreenKey, AValue);
130107
Application.MainWindow.FullScreen := AValue;
131108
end;
132109

@@ -137,7 +114,7 @@ function UseTimer(): Boolean;
137114

138115
procedure SetUseTimer(AValue: Boolean);
139116
begin
140-
SetValue(UseTimerKey, AValue);
117+
SetValue<Boolean>(UseTimerKey, AValue);
141118
end;
142119

143120
function UserName(): string;
@@ -147,7 +124,7 @@ function UserName(): string;
147124

148125
procedure SetUserName(const AValue: string);
149126
begin
150-
SetValue(UserNameKey, AValue);
127+
SetValue<string>(UserNameKey, AValue);
151128
end;
152129

153130
function UserGuid(): string;
@@ -157,7 +134,7 @@ function UserGuid(): string;
157134

158135
procedure SetUserGuid(const AValue: string);
159136
begin
160-
SetValue(UserGuidKey, AValue);
137+
SetValue<string>(UserGuidKey, AValue);
161138
end;
162139

163140
initialization

code/gameviewgame.pas

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ procedure TViewGame.TimerBloodTick(ASender: TObject);
443443

444444
if Map.Hero.Dead then
445445
begin
446-
TimerPreEnd.Exists := True;
447-
FViewEnd := ViewDefeat;
446+
//TimerPreEnd.Exists := True;
447+
Container.View := ViewDefeat;
448448
end
449449
else
450450
begin
@@ -464,21 +464,22 @@ procedure TViewGame.TimerBloodTick(ASender: TObject);
464464

465465
if LWeapon = hwNo then
466466
WeaponClick(hwNo);
467+
UpdateRooms();
468+
UpdateMiniBossRooms();
467469
//WriteLnLog(Format('T%d S%d L%d L%d', [Map.HeroTowerIndex, Map.HeroStockIndex, Map.LastTower, Map.LastStock]));
468470
if Map.IsFinalRoom(Map.HeroTowerIndex + 1, Map.HeroStockIndex + 1) then
469471
begin
470-
TimerPreEnd.Exists := True;
471-
FViewEnd := ViewWin;
472+
//TimerPreEnd.Exists := True;
472473
ViewWin.Score := Map.Score(FGameTicks);
474+
Container.View := ViewWin;
473475
end;
474-
UpdateRooms();
475-
UpdateMiniBossRooms();
476476
end;
477477
FSkip := False;
478478
end;
479479

480480
procedure TViewGame.TimerPreEndTick(ASender: TObject);
481481
begin
482+
FPause := True;
482483
TimerPreEnd.Exists := False;
483484
Container.View := FViewEnd;
484485
end;

0 commit comments

Comments
 (0)