From bdf0b9491de344b8b71aabbdc4d23b5f8f3d3725 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 May 2009 15:23:55 +0000 Subject: [PATCH] (svn r16267) -Documentation: [NoAI] Explain how to deal with IDs of various objects. --- src/ai/api/ai_types.hpp | 71 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/src/ai/api/ai_types.hpp b/src/ai/api/ai_types.hpp index 45db6b324f..9653cda03c 100644 --- a/src/ai/api/ai_types.hpp +++ b/src/ai/api/ai_types.hpp @@ -1,6 +1,75 @@ /* $Id$ */ -/** @file ai_types.hpp Defines all the types of the game, like VehicleID, .... */ +/** @file ai_types.hpp Defines all the types of the game, like IDs of various objects. + * + * IDs are used to identify certain objects. They are only unique within the object type, so for example a vehicle may have VehicleID 2009, + * while a station has StationID 2009 at the same time. Also IDs are assigned arbitrary, you cannot assume them to be consecutive. + * Also note, that some IDs are static and never change, while others are allocated dynamically and might be + * reused for other objects once they are released. So be careful, which IDs you store for which purpose and whether they stay valid all the time. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
type object acquired released reused
#BridgeID bridge type introduction \ref newgrf_changes "(1)" never \ref newgrf_changes "(1)" no \ref newgrf_changes "(1)"
#CargoID cargo type game start \ref newgrf_changes "(1)" never \ref newgrf_changes "(1)" no \ref newgrf_changes "(1)"
#EngineID engine type introduction, preview \ref dynamic_engines "(2)" engines retires \ref dynamic_engines "(2)" no \ref dynamic_engines "(2)"
#GroupID vehicle group creation deletion yes
#IndustyID industry construction closure yes
#IndustyType industry type game start \ref newgrf_changes "(1)" never \ref newgrf_changes "(1)" no
#SignID sign construction deletion yes
#StationID station construction expiration of 'grey' station sign after deletion yes
#SubsidyID subsidy offer announcement (offer) expiration yes
#TileIndex tile on map game start never no
#TownID town game start never no
#VehicleID vehicle construction, autorenew, autoreplace destruction, autorenew, autoreplace yes
#WaypointID waypoint construction destruction yes
+ * + * @remarks + * \li \anchor newgrf_changes (1) in-game changes of newgrfs may reassign/invalidate IDs (will also cause other trouble though). + * \li \anchor dynamic_engines (2) engine IDs are reassigned/invalidated on changing 'allow multiple newgrf engine sets' (only allowed as long as no vehicles are built). + */ #ifndef AI_TYPES_HPP #define AI_TYPES_HPP