Changeset 239 for trunk/UGame.pas


Ignore:
Timestamp:
Sep 21, 2018, 1:08:17 PM (6 years ago)
Author:
chronos
Message:
  • Fixed: Store map type in saved game files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r238 r239  
    127127  SWrongFileFormat = 'Wrong file format';
    128128  SNewGameFile = 'New game.xtg';
     129  SUnsupportedMapType = 'Unsupported map type';
    129130
    130131procedure InitStrings;
     
    249250    mtVoronoi: Map := TVoronoiMap.Create;
    250251    mtIsometric: Map := TIsometricMap.Create;
    251     else Map := TMap.Create;
     252    else raise Exception.Create(SUnsupportedMapType);
    252253  end;
    253254  Map.Game := Self;
     
    503504    RootNode := Doc.DocumentElement;
    504505    with RootNode do begin
     506      MapType := TMapType(ReadInteger(RootNode, 'MapType', Integer(mtNone)));
    505507      SymetricMap := ReadBoolean(RootNode, 'SymetricMap', False);
    506508      CyclicMap := ReadBoolean(RootNode, 'CyclicMap', False);
     
    555557    AppendChild(RootNode);
    556558    with RootNode do begin
     559      WriteInteger(RootNode, 'MapType', Integer(MapType));
    557560      WriteBoolean(RootNode, 'SymetricMap', SymetricMap);
    558561      WriteBoolean(RootNode, 'CyclicMap', CyclicMap);
Note: See TracChangeset for help on using the changeset viewer.