src/ai/api/ai_road.hpp
branchnoai
changeset 9551 d015a5b4b0a8
parent 9541 4bb34cea7fad
child 9556 65417763fa24
equal deleted inserted replaced
9550:31e558ce0c04 9551:d015a5b4b0a8
    34 	 * @return true if and only if the tile has road.
    34 	 * @return true if and only if the tile has road.
    35 	 */
    35 	 */
    36 	bool IsRoadTile(TileIndex tile);
    36 	bool IsRoadTile(TileIndex tile);
    37 
    37 
    38 	/**
    38 	/**
       
    39 	 * Checks whether the given tile is actually a tile with a road depot.
       
    40 	 * @param tile the tile to check.
       
    41 	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
       
    42 	 * @return true if and only if the tile has a road depot.
       
    43 	 */
       
    44 	bool IsRoadDepotTile(TileIndex tile);
       
    45 
       
    46 	/**
       
    47 	 * Checks whether the given tile is actually a tile with a road station.
       
    48 	 * @param tile the tile to check.
       
    49 	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
       
    50 	 * @return true if and only if the tile has a road station.
       
    51 	 */
       
    52 	bool IsRoadStationTile(TileIndex tile);
       
    53 
       
    54 	/**
       
    55 	 * Checks whether the given tile is actually a tile with a drive through
       
    56 	 * road station.
       
    57 	 * @param tile the tile to check.
       
    58 	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
       
    59 	 * @return true if and only if the tile has a drive through road station.
       
    60 	 */
       
    61 	bool IsDriveThroughRoadStationTile(TileIndex tile);
       
    62 
       
    63 	/**
       
    64 	 * Checks whether the given tiles are directly connected, i.e. whether
       
    65 	 * a road vehicle can travel from the center of the first tile to the
       
    66 	 * center of the second tile.
       
    67 	 * @param t1 the source tile.
       
    68 	 * @param t2 the destination tile.
       
    69 	 * @pre t1 is always positive and smaller than AIMap::GetMapSize().
       
    70 	 * @pre t2 is always positive and smaller than AIMap::GetMapSize().
       
    71 	 * @pre t1 and t2 are directly neighbouring tiles.
       
    72 	 * @return true if and only if a road vehicle can go from t1 to t2.
       
    73 	 */
       
    74 	bool AreRoadTilesConnected(TileIndex t1, TileIndex t2);
       
    75 
       
    76 	/**
       
    77 	 * Gets the tile in front of a road depot.
       
    78 	 * @param depot the road depot tile.
       
    79 	 * @pre IsRoadDepotTile(depot).
       
    80 	 * @return the tile in front of the depot.
       
    81 	 */
       
    82 	TileIndex GetRoadDepotFrontTile(TileIndex depot);
       
    83 
       
    84 	/**
       
    85 	 * Gets the tile in front of a road station.
       
    86 	 * @param station the road station tile.
       
    87 	 * @pre IsRoadStationTile(station).
       
    88 	 * @return the tile in front of the road station.
       
    89 	 */
       
    90 	TileIndex GetRoadStationFrontTile(TileIndex station);
       
    91 
       
    92 	/**
       
    93 	 * Gets the tile at the back of a drive through road station.
       
    94 	 * So, one side of the drive through station is retrieved with
       
    95 	 * GetTileInFrontOfStation, the other with this function.
       
    96 	 * @param station the road station tile.
       
    97 	 * @pre IsDriveThroughRoadStationTile(station).
       
    98 	 * @return the tile at the back of the drive through road station.
       
    99 	 */
       
   100 	TileIndex GetDriveThroughBackTile(TileIndex station);
       
   101 
       
   102 	/**
    39 	 * Builds a road from the center of tile start to the
   103 	 * Builds a road from the center of tile start to the
    40 	 * center of tile end.
   104 	 * center of tile end.
    41 	 * @param start the start tile of the road.
   105 	 * @param start the start tile of the road.
    42 	 * @param end   the end tile of the road.
   106 	 * @param end   the end tile of the road.
    43 	 * @pre start is not equal to end
   107 	 * @pre start is not equal to end
   119 	SQAIRoad.PreRegister(engine);
   183 	SQAIRoad.PreRegister(engine);
   120 	SQAIRoad.AddConstructor(engine);
   184 	SQAIRoad.AddConstructor(engine);
   121 
   185 
   122 	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetClassName, "GetClassName", 1, "x");
   186 	SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetClassName, "GetClassName", 1, "x");
   123 
   187 
   124 	SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadTile,        "IsRoadTile",        2, "xi");
   188 	SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadTile,                    "IsRoadTile",                    2, "xi");
   125 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoad,         "BuildRoad",         3, "xii");
   189 	SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadDepotTile,               "IsRoadDepotTile",               2, "xi");
   126 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadDepot,    "BuildRoadDepot",    3, "xii");
   190 	SQAIRoad.DefSQMethod(engine, &AIRoad::IsRoadStationTile,             "IsRoadStationTile",             2, "xi");
   127 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadStation,  "BuildRoadStation",  5, "xiibb");
   191 	SQAIRoad.DefSQMethod(engine, &AIRoad::IsDriveThroughRoadStationTile, "IsDriveThroughRoadStationTile", 2, "xi");
   128 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoad,        "RemoveRoad",        3, "xii");
   192 	SQAIRoad.DefSQMethod(engine, &AIRoad::AreRoadTilesConnected,         "AreRoadTilesConnected",         3, "xii");
   129 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadDepot,   "RemoveRoadDepot",   2, "xi");
   193 	SQAIRoad.DefSQMethod(engine, &AIRoad::GetRoadDepotFrontTile,         "GetRoadDepotFrontTile",         2, "xi");
   130 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadStation, "RemoveRoadStation", 2, "xi");
   194 	SQAIRoad.DefSQMethod(engine, &AIRoad::GetRoadStationFrontTile,       "GetRoadStationFrontTile",       2, "xi");
       
   195 	SQAIRoad.DefSQMethod(engine, &AIRoad::GetDriveThroughBackTile,       "GetDriveThroughBackTile",       2, "xi");
       
   196 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoad,                     "BuildRoad",                     3, "xii");
       
   197 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadDepot,                "BuildRoadDepot",                3, "xii");
       
   198 	SQAIRoad.DefSQMethod(engine, &AIRoad::BuildRoadStation,              "BuildRoadStation",              5, "xiibb");
       
   199 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoad,                    "RemoveRoad",                    3, "xii");
       
   200 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadDepot,               "RemoveRoadDepot",               2, "xi");
       
   201 	SQAIRoad.DefSQMethod(engine, &AIRoad::RemoveRoadStation,             "RemoveRoadStation",             2, "xi");
   131 
   202 
   132 	SQAIRoad.PostRegister(engine);
   203 	SQAIRoad.PostRegister(engine);
   133 }
   204 }
   134 #endif /* DEFINE_SQUIRREL_CLASS */
   205 #endif /* DEFINE_SQUIRREL_CLASS */
   135 
   206