src/engine.h
branchnoai
changeset 9624 b71483f2330f
parent 9620 31e38d28a0af
child 9625 3301b1b3889c
equal deleted inserted replaced
9623:ee0173281563 9624:b71483f2330f
   103 	byte climates;
   103 	byte climates;
   104 	uint32 refit_mask;
   104 	uint32 refit_mask;
   105 	byte refit_cost;
   105 	byte refit_cost;
   106 	byte misc_flags;
   106 	byte misc_flags;
   107 	byte callbackmask;
   107 	byte callbackmask;
       
   108 	byte retire_early; ///< Number of years early to retire vehicle
   108 };
   109 };
   109 
   110 
   110 struct Engine {
   111 struct Engine {
   111 	Date intro_date;
   112 	Date intro_date;
   112 	Date age;
   113 	Date age;
   117 	byte lifelength;
   118 	byte lifelength;
   118 	byte flags;
   119 	byte flags;
   119 	PlayerByte preview_player;
   120 	PlayerByte preview_player;
   120 	byte preview_wait;
   121 	byte preview_wait;
   121 	byte player_avail;
   122 	byte player_avail;
   122 	byte type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h
   123 	VehicleType type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h
   123 };
   124 };
   124 
   125 
   125 /**
   126 /**
   126  * EngineInfo.misc_flags is a bitmask, with the following values
   127  * EngineInfo.misc_flags is a bitmask, with the following values
   127  */
   128  */
   269 struct EngineRenew {
   270 struct EngineRenew {
   270 	EngineRenewID index;
   271 	EngineRenewID index;
   271 	EngineID from;
   272 	EngineID from;
   272 	EngineID to;
   273 	EngineID to;
   273 	EngineRenew *next;
   274 	EngineRenew *next;
       
   275 	GroupID group_id;
   274 };
   276 };
   275 
   277 
   276 /**
   278 /**
   277  * Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
   279  * Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
   278  * placed here so the only exception to this rule, the saveload code, can use
   280  * placed here so the only exception to this rule, the saveload code, can use
   314  * @param  erl The renewlist to search in.
   316  * @param  erl The renewlist to search in.
   315  * @param  engine Engine type to be replaced.
   317  * @param  engine Engine type to be replaced.
   316  * @return The engine type to replace with, or INVALID_ENGINE if no
   318  * @return The engine type to replace with, or INVALID_ENGINE if no
   317  * replacement is in the list.
   319  * replacement is in the list.
   318  */
   320  */
   319 EngineID EngineReplacement(EngineRenewList erl, EngineID engine);
   321 EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
   320 
   322 
   321 /**
   323 /**
   322  * Add an engine replacement to the given renewlist.
   324  * Add an engine replacement to the given renewlist.
   323  * @param erl The renewlist to add to.
   325  * @param erl The renewlist to add to.
   324  * @param old_engine The original engine type.
   326  * @param old_engine The original engine type.
   325  * @param new_engine The replacement engine type.
   327  * @param new_engine The replacement engine type.
   326  * @param flags The calling command flags.
   328  * @param flags The calling command flags.
   327  * @return 0 on success, CMD_ERROR on failure.
   329  * @return 0 on success, CMD_ERROR on failure.
   328  */
   330  */
   329 int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags);
   331 int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags);
   330 
   332 
   331 /**
   333 /**
   332  * Remove an engine replacement from a given renewlist.
   334  * Remove an engine replacement from a given renewlist.
   333  * @param erl The renewlist from which to remove the replacement
   335  * @param erl The renewlist from which to remove the replacement
   334  * @param engine The original engine type.
   336  * @param engine The original engine type.
   335  * @param flags The calling command flags.
   337  * @param flags The calling command flags.
   336  * @return 0 on success, CMD_ERROR on failure.
   338  * @return 0 on success, CMD_ERROR on failure.
   337  */
   339  */
   338 int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags);
   340 int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, GroupID group, uint32 flags);
   339 
   341 
   340 /** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists
   342 /** When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists
   341  * @param type The type of engine
   343  * @param type The type of engine
   342  */
   344  */
   343 void AddRemoveEngineFromAutoreplaceAndBuildWindows(byte type);
   345 void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type);
   344 
   346 
   345 /* Engine list manipulators - current implementation is only C wrapper of CBlobT<EngineID> class (helpers.cpp) */
   347 /* Engine list manipulators - current implementation is only C wrapper of CBlobT<EngineID> class (helpers.cpp) */
   346 void EngList_Create(EngineList *el);            ///< Creates engine list
   348 void EngList_Create(EngineList *el);            ///< Creates engine list
   347 void EngList_Destroy(EngineList *el);           ///< Deallocate and destroy engine list
   349 void EngList_Destroy(EngineList *el);           ///< Deallocate and destroy engine list
   348 uint EngList_Count(const EngineList *el);       ///< Returns number of items in the engine list
   350 uint EngList_Count(const EngineList *el);       ///< Returns number of items in the engine list