- Timestamp:
- Apr 9, 2015, 11:58:38 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BigMetro.lpi
r23 r24 90 90 <Filename Value="UGeometric.pas"/> 91 91 <IsPartOfProject Value="True"/> 92 <UnitName Value="UGeometric"/> 92 93 </Unit3> 93 94 </Units> … … 118 119 <StackChecks Value="True"/> 119 120 </Checks> 121 <VerifyObjMethodCallValidity Value="True"/> 120 122 </CodeGeneration> 121 123 <Linking> -
trunk/UEngine.pas
r23 r24 31 31 Lines: TMetroLines; 32 32 ShapeDistance: array[TStationShape] of Integer; 33 OverloadDuration: TDateTime; 33 34 function IsBestStationForShape(Shape: TStationShape; Check, Current: TLineStation): Boolean; 34 35 constructor Create; … … 174 175 ImageLocomotive: TImage; 175 176 FTime: TDateTime; 177 FLastTime: TDateTime; 176 178 function GetExistStationShapes: TStationShapeSet; 177 179 function GetStationOnPos(Pos: TPoint): TMapStation; … … 218 220 clPurple, clGray, clOrange, clBrown); 219 221 StationSize = 30; 222 StationOverloadSize = 60; 220 223 PassengerSize = 15; 221 224 TrainSize = 40; … … 228 231 StationMaxDistance = 300; 229 232 MaxWaitingPassengers = 10; 233 MaxPassengersOveloadTime = 1; 230 234 MetroLineThickness = 13; 231 235 TrackClickDistance = 20; … … 1171 1175 while (Passenger.Shape = Passenger.Station.Shape) or not (Passenger.Shape in GetExistStationShapes) do 1172 1176 Passenger.Shape := TStationShape((Integer(Passenger.Shape) + 1) mod Integer(ShapeCount)); 1177 1178 end; 1179 end; 1180 1181 for I := 0 to Stations.Count - 1 do 1182 with TMapStation(Stations[I]) do begin 1183 if Passengers.Count > MaxWaitingPassengers then begin 1184 OverloadDuration := OverloadDuration + (FTime - FLastTime); 1185 if OverloadDuration > MaxPassengersOveloadTime then 1186 OverloadDuration := MaxPassengersOveloadTime; 1187 end; 1188 if Passengers.Count <= MaxWaitingPassengers then begin 1189 OverloadDuration := OverloadDuration - (FTime - FLastTime); 1190 if OverloadDuration < 0 then begin 1191 OverloadDuration := 0; 1192 end; 1173 1193 end; 1174 1194 end; … … 1179 1199 for I := 0 to Stations.Count - 1 do 1180 1200 with TMapStation(Stations[I]) do begin 1181 if Passengers.Count > MaxWaitingPassengersthen State := gsGameOver;1201 if OverloadDuration >= MaxPassengersOveloadTime then State := gsGameOver; 1182 1202 end; 1183 1203 1184 1204 end; 1185 1205 LastTickTime := Now; 1206 FLastTime := FTime; 1186 1207 end; 1187 1208 … … 1346 1367 SelectedLine := nil; 1347 1368 FTime := 0; 1369 FLastTime := 0; 1348 1370 LastNewStationTime := Time; 1349 1371 LastNewPassengerTime := Time; … … 1404 1426 Canvas.Brush.Style := bsSolid; 1405 1427 Canvas.Clear; 1428 1429 // Draw station passenger overload 1430 for I := 0 to Stations.Count - 1 do 1431 with TMapStation(Stations[I]) do begin 1432 if OverloadDuration > 0 then begin 1433 Canvas.Brush.Color := clSilver; 1434 Canvas.Brush.Style := bsSolid; 1435 Canvas.Pen.Color := clSilver; 1436 Canvas.Pen.Style := psSolid; 1437 Angle := OverloadDuration / MaxPassengersOveloadTime * 2 * Pi; 1438 Canvas.Pie(Position.X - StationOverloadSize, Position.Y - StationOverloadSize, 1439 Position.X + StationOverloadSize, Position.Y + StationOverloadSize, 1440 Trunc(Position.X + StationOverloadSize * Cos(Angle)), 1441 Trunc(Position.Y + StationOverloadSize * Sin(Angle)), Position.X + StationOverloadSize, Position.Y); 1442 end; 1443 end; 1406 1444 1407 1445 // Draw lines … … 1469 1507 DrawShape(Canvas, Position, Shape, StationSize + Canvas.Pen.Width + 6, 0); 1470 1508 end; 1509 1471 1510 Canvas.Brush.Color := clWhite; 1472 1511 Canvas.Brush.Style := bsSolid;
Note:
See TracChangeset
for help on using the changeset viewer.