summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-03-01 17:35:01 +0000
committerpeter1138 <peter1138@openttd.org>2006-03-01 17:35:01 +0000
commit5a9f6081dd0a3f8451779ae44d4704f6b1acd3cb (patch)
tree993377b5b8a18faa473f63bfde192481ddb2262e
parentb2c5ecaa22c0600a68530d3b89347ab0f7903a4e (diff)
downloadopenttd-5a9f6081dd0a3f8451779ae44d4704f6b1acd3cb.tar.xz
(svn r3701) [2cc] move vehicle/engine palette functions out of header file and document the remaining definitions
-rw-r--r--vehicle.c12
-rw-r--r--vehicle.h25
2 files changed, 24 insertions, 13 deletions
diff --git a/vehicle.c b/vehicle.c
index 57867185e..fa8ba9893 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -2041,11 +2041,21 @@ UnitID GetFreeUnitNumber(byte type)
}
// XXX Temporary stub -- will be expanded
-PalSpriteID GetEngineColourMap(PlayerID player)
+static PalSpriteID GetEngineColourMap(PlayerID player)
{
return SPRITE_PALETTE(PLAYER_SPRITE_COLOR(player));
}
+PalSpriteID GetEnginePalette(EngineID engine_type, PlayerID player)
+{
+ return GetEngineColourMap(player);
+}
+
+PalSpriteID GetVehiclePalette(const Vehicle *v)
+{
+ return GetEngineColourMap(v->owner);
+}
+
// Save and load of vehicles
const SaveLoad _common_veh_desc[] = {
SLE_VAR(Vehicle,subtype, SLE_UINT8),
diff --git a/vehicle.h b/vehicle.h
index 9e001d7bc..fb9329aee 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -422,19 +422,20 @@ VARDEF uint16 _returned_refit_capacity;
#define INVALID_VEHICLE 0xFFFF
-// XXX Temporary interface -- will be expanded
-PalSpriteID GetEngineColourMap(PlayerID player);
-
-static inline PalSpriteID GetEnginePalette(EngineID engine_type, PlayerID player)
-{
- return GetEngineColourMap(player);
-}
-
-static inline PalSpriteID GetVehiclePalette(const Vehicle *v)
-{
- return GetEngineColourMap(v->owner);
-}
+/**
+ * Get the colour map for an engine. This used for unbuilt engines in the user interface.
+ * @param engine_type ID of engine
+ * @param player ID of player
+ * @return A ready-to-use palette modifier
+ */
+PalSpriteID GetEnginePalette(EngineID engine_type, PlayerID player);
+/**
+ * Get the colour map for a vehicle.
+ * @param v Vehicle to get colour map for
+ * @return A ready-to-use palette modifier
+ */
+PalSpriteID GetVehiclePalette(const Vehicle *v);
/* A lot of code calls for the invalidation of the status bar, which is widget 5.
* Best is to have a virtual value for it when it needs to change again */