- Timestamp:
- Mar 26, 2015, 2:40:40 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UEngine.pas
r5 r6 664 664 SelectedStation := Station; 665 665 for I := 0 to Lines.Count - 1 do 666 if TMetroLine(Lines[I]).Stations.Count = 0 then 666 if TMetroLine(Lines[I]).Stations.Count = 0 then begin 667 667 SelectedLine := TMetroLine(Lines[I]); 668 Break; 669 end; 668 670 end; 669 671 … … 751 753 Pos: TPoint; 752 754 Text: string; 755 Angle: Double; 756 EndPoint: TPoint; 753 757 const 754 758 GameOverText = 'Game Over'; 755 759 GameOverReason = 'Overcrowding at this station has forced you to resign as metro manager.'; 756 760 GameOverStatistic = '%d passengers travelled on your metro over %d days.'; 761 EndStationLength = 50; 757 762 begin 758 763 Canvas.Brush.Color := $eff0e0; … … 769 774 for S := 1 to High(TrackPoints) do begin 770 775 Canvas.LineTo(TrackPoints[S]); 771 end; 776 if (S = High(TrackPoints)) then begin 777 Angle := arctan2((TrackPoints[S].Y - TrackPoints[S - 1].Y), (TrackPoints[S].X - TrackPoints[S - 1].X)); 778 EndPoint := Point(Round(TrackPoints[S].X + EndStationLength * Cos(Angle)), 779 Round(TrackPoints[S].Y + EndStationLength * Sin(Angle))); 780 Canvas.LineTo(EndPoint); 781 Canvas.MoveTo(Point(Round(EndPoint.X + Cos(Angle + Pi / 2) * EndStationLength / 3), 782 Round(EndPoint.Y + Sin(Angle + Pi / 2) * EndStationLength / 3))); 783 Canvas.LineTo(Point(Round(EndPoint.X + Cos(Angle - Pi / 2) * EndStationLength / 3), 784 Round(EndPoint.Y + Sin(Angle - Pi / 2) * EndStationLength / 3))); 785 end; 786 end; 787 if (Length(TrackPoints) > 1) then begin 788 Angle := arctan2((TrackPoints[1].Y - TrackPoints[0].Y), (TrackPoints[1].X - TrackPoints[0].X)); 789 Canvas.MoveTo(TrackPoints[0]); 790 EndPoint := Point(Round(TrackPoints[0].X - EndStationLength * Cos(Angle)), 791 Round(TrackPoints[0].Y - EndStationLength * Sin(Angle))); 792 Canvas.LineTo(EndPoint); 793 Canvas.MoveTo(Point(Round(EndPoint.X - Cos(Angle + Pi / 2) * EndStationLength / 3), 794 Round(EndPoint.Y - Sin(Angle + Pi / 2) * EndStationLength / 3))); 795 Canvas.LineTo(Point(Round(EndPoint.X - Cos(Angle - Pi / 2) * EndStationLength / 3), 796 Round(EndPoint.Y - Sin(Angle - Pi / 2) * EndStationLength / 3))); 797 end; 798 799 // Draw design line 772 800 if (SelectedLine = TMetroLine(Lines[I])) and Assigned(SelectedStation) then begin 773 801 Canvas.MoveTo(SelectedStation.Position); … … 847 875 848 876 Text := IntToStr(Trains.GetUnusedCount); 849 Canvas.Draw(Canvas.Width - 1 60, 20, ImageLocomotive.Picture.Bitmap);877 Canvas.Draw(Canvas.Width - 180, 20, ImageLocomotive.Picture.Bitmap); 850 878 Canvas.Brush.Style := bsClear; 851 Canvas.TextOut(Canvas.Width - 1 66 - Canvas.TextWidth(Text), 25, Text);879 Canvas.TextOut(Canvas.Width - 186 - Canvas.TextWidth(Text), 25, Text); 852 880 853 881 // Game over
Note:
See TracChangeset
for help on using the changeset viewer.