forked from Kromster80/kam_remake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
KM_GameOptions.pas
65 lines (50 loc) · 1.27 KB
/
KM_GameOptions.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
unit KM_GameOptions;
{$I KaM_Remake.inc}
interface
uses
KM_CommonClasses;
type
//Game options set in MP lobby
//(maybe later we could use some of these for SP games too)
TKMGameOptions = class
public
Peacetime: Word; //Peacetime in minutes
SpeedPT: Single; //Game speed during peacetime
SpeedAfterPT: Single; //Game speed after peacetime (usually slower)
RandomSeed: Integer;
constructor Create;
procedure Reset;
procedure Save(SaveStream: TKMemoryStream);
procedure Load(LoadStream: TKMemoryStream);
end;
implementation
{ TKMGameOptions }
constructor TKMGameOptions.Create;
begin
inherited;
//Default values are not always 0
Reset;
end;
//Resets values to defaults
procedure TKMGameOptions.Reset;
begin
Peacetime := 0;
SpeedPT := 1;
SpeedAfterPT := 1;
RandomSeed := 0; //Must be init later on. 0 is an erroneous value for KaMSeed
end;
procedure TKMGameOptions.Load(LoadStream: TKMemoryStream);
begin
LoadStream.Read(Peacetime);
LoadStream.Read(SpeedPT);
LoadStream.Read(SpeedAfterPT);
LoadStream.Read(RandomSeed);
end;
procedure TKMGameOptions.Save(SaveStream: TKMemoryStream);
begin
SaveStream.Write(Peacetime);
SaveStream.Write(SpeedPT);
SaveStream.Write(SpeedAfterPT);
SaveStream.Write(RandomSeed);
end;
end.