89 lines
2.0 KiB
ObjectPascal
89 lines
2.0 KiB
ObjectPascal
unit Game.Chivalry.MedievalWarfare;
|
|
|
|
interface
|
|
uses
|
|
System.Generics.Collections,
|
|
|
|
Game.Chivalry,
|
|
Game.Intf;
|
|
|
|
|
|
type
|
|
{ I haven't actually done any research into the dedicated server
|
|
for the other Chivalry game, so for now most stuff is implemented
|
|
in the base Chivalry class. }
|
|
TChivalryMedievalWarfareGame = class(TChivalryGame)
|
|
protected
|
|
procedure LoadSupportedMapList(AList: TList<IGameMap>); override;
|
|
public
|
|
class function GetGameName: string; override;
|
|
end;
|
|
|
|
|
|
implementation
|
|
uses
|
|
System.Classes,
|
|
System.IniFiles,
|
|
System.SysUtils,
|
|
|
|
Resources,
|
|
Game.Map,
|
|
Game.Registry;
|
|
|
|
|
|
{ TChivalryMedievalWarfareGame }
|
|
class function TChivalryMedievalWarfareGame.GetGameName: string;
|
|
begin
|
|
Result := 'Chivalry: Medieval Warfare';
|
|
end;
|
|
|
|
|
|
procedure TChivalryMedievalWarfareGame.LoadSupportedMapList(AList: TList<IGameMap>);
|
|
var
|
|
mapListFileName: string;
|
|
mapList: TMemIniFile;
|
|
categories: TStringList;
|
|
categoryName: string;
|
|
maps: TStringList;
|
|
mapIndex: Integer;
|
|
|
|
begin
|
|
mapListFileName := GetAssetPath('Chivalry.MedievalWarfare.MapList.ini');
|
|
if not FileExists(mapListFileName) then
|
|
exit;
|
|
|
|
mapList := TMemIniFile.Create(mapListFileName);
|
|
try
|
|
categories := nil;
|
|
maps := nil;
|
|
try
|
|
categories := TStringList.Create;
|
|
maps := TStringList.Create;
|
|
|
|
mapList.ReadSections(categories);
|
|
|
|
for categoryName in categories do
|
|
begin
|
|
maps.Clear;
|
|
mapList.ReadSectionValues(categoryName, maps);
|
|
|
|
for mapIndex := 0 to Pred(maps.Count) do
|
|
AList.Add(TGameMap.Create(Trim(maps.Names[mapIndex]),
|
|
Trim(maps.ValueFromIndex[mapIndex]),
|
|
Trim(categoryName)));
|
|
end;
|
|
finally
|
|
FreeAndNil(maps);
|
|
FreeAndNil(categories);
|
|
end;
|
|
finally
|
|
FreeAndNil(mapList);
|
|
end;
|
|
end;
|
|
|
|
|
|
initialization
|
|
TGameRegistry.Register(TChivalryMedievalWarfareGame);
|
|
|
|
end.
|