src/vehicle.cpp
branchgamebalance
changeset 9909 dce9a6923bb7
parent 9908 0fa543611bbe
child 9910 0b2aebc8283e
equal deleted inserted replaced
9908:0fa543611bbe 9909:dce9a6923bb7
   765 {
   765 {
   766 	return HASBIT(EngInfo(engine_type)->refit_mask, cid_to);
   766 	return HASBIT(EngInfo(engine_type)->refit_mask, cid_to);
   767 }
   767 }
   768 
   768 
   769 /** Find the first cargo type that an engine can be refitted to.
   769 /** Find the first cargo type that an engine can be refitted to.
   770  * @param engine Which engine to find cargo for.
   770  * @param engine_type Which engine to find cargo for.
   771  * @return A climate dependent cargo type. CT_INVALID is returned if not refittable.
   771  * @return A climate dependent cargo type. CT_INVALID is returned if not refittable.
   772  */
   772  */
   773 CargoID FindFirstRefittableCargo(EngineID engine_type)
   773 CargoID FindFirstRefittableCargo(EngineID engine_type)
   774 {
   774 {
   775 	uint32 refit_mask = EngInfo(engine_type)->refit_mask;
   775 	uint32 refit_mask = EngInfo(engine_type)->refit_mask;
   782 
   782 
   783 	return CT_INVALID;
   783 	return CT_INVALID;
   784 }
   784 }
   785 
   785 
   786 /** Learn the price of refitting a certain engine
   786 /** Learn the price of refitting a certain engine
   787 * @param engine Which engine to refit
   787 * @param engine_type Which engine to refit
   788 * @return Price for refitting
   788 * @return Price for refitting
   789 */
   789 */
   790 int32 GetRefitCost(EngineID engine_type)
   790 int32 GetRefitCost(EngineID engine_type)
   791 {
   791 {
   792 	int32 base_cost = 0;
   792 	int32 base_cost = 0;
  1902 }
  1902 }
  1903 
  1903 
  1904 /** Generates a list of vehicles inside a depot
  1904 /** Generates a list of vehicles inside a depot
  1905  * Will enlarge allocated space for the list if they are too small, so it's ok to call with (pointer to NULL array, pointer to uninitised uint16, pointer to 0)
  1905  * Will enlarge allocated space for the list if they are too small, so it's ok to call with (pointer to NULL array, pointer to uninitised uint16, pointer to 0)
  1906  * If one of the lists is not needed (say wagons when finding ships), all the pointers regarding that list should be set to NULL
  1906  * If one of the lists is not needed (say wagons when finding ships), all the pointers regarding that list should be set to NULL
  1907  * @param Type type of vehicle
  1907  * @param type Type of vehicle
  1908  * @param tile The tile the depot is located in
  1908  * @param tile The tile the depot is located in
  1909  * @param ***engine_list Pointer to a pointer to an array of vehicles in the depot (old list is freed and a new one is malloced)
  1909  * @param ***engine_list Pointer to a pointer to an array of vehicles in the depot (old list is freed and a new one is malloced)
  1910  * @param *engine_list_length Allocated size of engine_list. Needs to be set to 0 when engine_list points to a NULL array
  1910  * @param *engine_list_length Allocated size of engine_list. Needs to be set to 0 when engine_list points to a NULL array
  1911  * @param *engine_count The number of engines stored in the list
  1911  * @param *engine_count The number of engines stored in the list
  1912  * @param ***wagon_list Pointer to a pointer to an array of free wagons in the depot (old list is freed and a new one is malloced)
  1912  * @param ***wagon_list Pointer to a pointer to an array of free wagons in the depot (old list is freed and a new one is malloced)
  1984 /**
  1984 /**
  1985 * @param sort_list list to store the list in. Either NULL or the length length_of_array tells
  1985 * @param sort_list list to store the list in. Either NULL or the length length_of_array tells
  1986 * @param length_of_array informs the length allocated for sort_list. This is not the same as the number of vehicles in the list. Needs to be 0 when sort_list is NULL
  1986 * @param length_of_array informs the length allocated for sort_list. This is not the same as the number of vehicles in the list. Needs to be 0 when sort_list is NULL
  1987 * @param type type of vehicle
  1987 * @param type type of vehicle
  1988 * @param owner PlayerID of owner to generate a list for
  1988 * @param owner PlayerID of owner to generate a list for
  1989 * @param index This parameter got different meanings depending on window_type
  1989 * @param index This parameter has different meanings depending on window_type
  1990 			VLW_STATION_LIST:  index of station to generate a list for
  1990     <ul>
  1991 			VLW_SHARED_ORDERS: index of order to generate a list for
  1991       <li>VLW_STATION_LIST:  index of station to generate a list for</li>
  1992 			VLW_STANDARD: not used
  1992       <li>VLW_SHARED_ORDERS: index of order to generate a list for<li>
  1993 			VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for
  1993       <li>VLW_STANDARD: not used<li>
       
  1994       <li>VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for</li>
       
  1995     </ul>
  1994 * @param window_type tells what kind of window the list is for. Use the VLW flags in vehicle_gui.h
  1996 * @param window_type tells what kind of window the list is for. Use the VLW flags in vehicle_gui.h
  1995 * @return the number of vehicles added to the list
  1997 * @return the number of vehicles added to the list
  1996 */
  1998 */
  1997 uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, uint32 index, uint16 window_type)
  1999 uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, uint32 index, uint16 window_type)
  1998 {
  2000 {
  2086 /** send all vehicles of type to depots
  2088 /** send all vehicles of type to depots
  2087  * @param type type of vehicle
  2089  * @param type type of vehicle
  2088  * @param flags the flags used for DoCommand()
  2090  * @param flags the flags used for DoCommand()
  2089  * @param service should the vehicles only get service in the depots
  2091  * @param service should the vehicles only get service in the depots
  2090  * @param owner PlayerID of owner of the vehicles to send
  2092  * @param owner PlayerID of owner of the vehicles to send
  2091  * @param VLW_flag tells what kind of list requested the goto depot
  2093  * @param vlw_flag tells what kind of list requested the goto depot
  2092  * @return 0 for success and CMD_ERROR if no vehicle is able to go to depot
  2094  * @return 0 for success and CMD_ERROR if no vehicle is able to go to depot
  2093  */
  2095  */
  2094 int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id)
  2096 int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id)
  2095 {
  2097 {
  2096 	const Vehicle **sort_list = NULL;
  2098 	const Vehicle **sort_list = NULL;