Changeset 84 for trunk


Ignore:
Timestamp:
Dec 31, 2021, 9:48:23 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Languages/BigMetro.cs.po

    r76 r84  
    4949msgstr "Nové vysoké skóre!"
    5050
     51#: uengine.snooldstationtoconnectnew
     52msgid "No old line station to connect new station"
     53msgstr ""
     54
    5155#: uengine.soldhighscore
    5256msgid "Old high score was %d passengers in %d days."
    5357msgstr "Dřívější vysoké skóre bylo %d cestujících v %d dnech."
     58
     59#: uengine.sstationnotdefined
     60msgid "Station have to be defined"
     61msgstr ""
     62
     63#: uengine.sstationwithoutmapstation
     64msgid "Station have to have MapStation"
     65msgstr ""
     66
     67#: uengine.strackpointnotfound
     68msgid "Track point %d not found"
     69msgstr ""
    5470
    5571#: uengine.szerozoomnotalowed
  • trunk/Languages/BigMetro.po

    r76 r84  
    3939msgstr ""
    4040
     41#: uengine.snooldstationtoconnectnew
     42msgid "No old line station to connect new station"
     43msgstr ""
     44
    4145#: uengine.soldhighscore
    4246msgid "Old high score was %d passengers in %d days."
     47msgstr ""
     48
     49#: uengine.sstationnotdefined
     50msgid "Station have to be defined"
     51msgstr ""
     52
     53#: uengine.sstationwithoutmapstation
     54msgid "Station have to have MapStation"
     55msgstr ""
     56
     57#: uengine.strackpointnotfound
     58msgid "Track point %d not found"
    4359msgstr ""
    4460
  • trunk/UEngine.pas

    r78 r84  
    188188  end;
    189189
     190  TMetroTrain = class;
     191
     192  TMetroCarriage = class
     193    Train: TMetroTrain;
     194  end;
     195
     196  TMetroCarriages = class(TFPGObjectList<TMetroCarriage>)
     197  end;
     198
    190199  { TMetroTrain }
    191200
     
    204213    InStation: Boolean;
    205214    TargetStation: TLineStation;
     215    Carriages: TMetroCarriages;
    206216    function GetTargetStationDistance: Integer;
    207217    function GetPosition: TPoint;
     
    421431
    422432uses
    423   UGeometric, UFormMain, ULanguages, UPixelPointer;
     433  UGeometric, UFormMain, ULanguages;
    424434
    425435resourcestring
     
    433443  SNewHighScore = 'New high score!';
    434444  SOldHighScore = 'Old high score was %d passengers in %d days.';
     445  STrackPointNotFound = 'Track point %d not found';
     446  SStationNotDefined = 'Station have to be defined';
     447  SNoOldStationToConnectNew = 'No old line station to connect new station';
     448  SStationWithoutMapStation = 'Station have to have MapStation';
    435449
    436450{ TTrackLinks }
     
    475489destructor TTrack.Destroy;
    476490begin
    477   Points.Free;
    478   Links.Free;
     491  FreeAndNil(Points);
     492  FreeAndNil(Links);
    479493  inherited;
    480494end;
     
    490504destructor TTrackLink.Destroy;
    491505begin
    492   Points.Free;
     506  FreeAndNil(Points);
    493507  inherited;
    494508end;
     
    512526destructor TMap.Destroy;
    513527begin
    514   Rivers.Free;
     528  FreeAndNil(Rivers);
    515529  inherited;
    516530end;
     
    618632destructor TTrackPointsAngle.Destroy;
    619633begin
    620   TrackLinks.Free;
     634  FreeAndNil(TrackLinks);
    621635  inherited;
    622636end;
     
    744758destructor TTrackPoint.Destroy;
    745759begin
    746   NeighLinks.Free;
    747   NeighPoints.Free;
     760  FreeAndNil(NeighLinks);
     761  FreeAndNil(NeighPoints);
    748762  inherited;
    749763end;
     
    917931begin
    918932  if not Assigned(Station) then
    919     raise Exception.Create('Station have to be defined');
     933    raise Exception.Create(SStationNotDefined);
    920934  if not Assigned(LineStationDown) and not Assigned(LineStationUp) and (LineStations.Count > 0) then
    921     raise Exception.Create('No old line station to connect new station');
     935    raise Exception.Create(SNoOldStationToConnectNew);
    922936  NewLineStation := TLineStation.Create;
    923937  NewLineStation.Line := Self;
     
    10611075  Index2 := Points.IndexOf(TP2);
    10621076  if (Index1 = -1) then
    1063     raise Exception.Create('TrackPoint1 not found');
     1077    raise Exception.Create(Format(STrackPointNotFound, [1]));
    10641078  if (Index2 = -1) then
    1065     raise Exception.Create('TrackPoint2 not found');
     1079    raise Exception.Create(Format(STrackPointNotFound, [2]));
    10661080  if Index1 > Index2 then begin
    10671081    Temp := Index1;
     
    10951109destructor TMetroLine.Destroy;
    10961110begin
    1097   Trains.Free;
    1098   LineStations.Free;
    1099   Track.Free;
     1111  FreeAndNil(Trains);
     1112  FreeAndNil(LineStations);
     1113  FreeAndNil(Track);
    11001114  inherited;
    11011115end;
     
    11841198  Passengers := TMetroPassengers.Create;
    11851199  Passengers.FreeObjects := False;
     1200  Carriages := TMetroCarriages.Create;
    11861201  Direction := 1;
    11871202  Line := nil;
     
    11901205destructor TMetroTrain.Destroy;
    11911206begin
    1192   Passengers.Free;
     1207  FreeAndNil(Passengers);
     1208  FreeAndNil(Carriages);
    11931209  inherited;
    11941210end;
     
    17911807          // Load new passengers
    17921808          if Assigned(CurrentStation) and not Assigned(CurrentStation.MapStation) then
    1793             raise Exception.Create('Station have to have MapStation');
     1809            raise Exception.Create(SStationWithoutMapStation);
    17941810          if Assigned(CurrentStation)  then
    17951811          for P := CurrentStation.MapStation.Passengers.Count - 1 downto 0 do begin
Note: See TracChangeset for help on using the changeset viewer.