include "UBahnStation.gs"
  

class SmallStation isclass UBahnStation
{
  
  bool TriggerSupportsMassStoppedLoad(Vehicle vehicle, string triggerName)
  {
    bool vehicleToTrain = !vehicle.GetDirectionRelativeToTrain();

    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_one");
      if (!vehicleToTrain)
	      direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_one_c")
        return true;
    
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_one_a")
        return true;
    }

    if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_c")
    {
      int direction = vehicle.GetRelationToTrack(me, "track_two");
      if (!vehicleToTrain)
	      direction = -direction;

      if (direction == Vehicle.DIRECTION_BACKWARD and triggerName == "trigger_track_two_c")
        return true;
    
      if (direction == Vehicle.DIRECTION_FORWARD and triggerName == "trigger_track_two_a")
        return true;
    }


    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c" or triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      if (vehicle.GetMyTrain().IsStopped())
        return true;
    }

    return false;
  }


	void GetTrackAndSide(Vehicle vehicle, string triggerName, TrackLoadInfo retInfo)
	{
    if (triggerName == "trigger_track_one_a" or triggerName == "trigger_track_one_b" or triggerName == "trigger_track_one_c")
    {
      retInfo.trackName = "track_one";
			retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
			retInfo.platformIndex = 0;
    }
		else if (triggerName == "trigger_track_two_a" or triggerName == "trigger_track_two_b" or triggerName == "trigger_track_two_c")
    {
      retInfo.trackName = "track_two";
			retInfo.trainLeftSide = (vehicle.GetRelationToTrack(me, retInfo.trackName) != Vehicle.DIRECTION_BACKWARD) == vehicle.GetDirectionRelativeToTrain();
			retInfo.platformIndex = 1;
    }
	}


  public void Init(void)
  {
    inherited();
		
		InitPassengerStation(2);
		
    StationMain();
  }


  public void AppendDriverDestinations(string[] destNames, string[] destTracks)
  {
    StringTable stringTable = GetAsset().GetStringTable();

    destNames[destNames.size()] = stringTable.GetString("smallStation_plat1");
    destTracks[destTracks.size()] = "track_one";

    destNames[destNames.size()] = stringTable.GetString("smallStation_plat2");
    destTracks[destTracks.size()] = "track_two";
  }
	
};

