diff options
author | frosch <frosch@openttd.org> | 2011-08-27 08:42:24 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-08-27 08:42:24 +0000 |
commit | c6e29a5b8971e004d9b794fa2eaa928f0bcbbc38 (patch) | |
tree | 0f50c999bfe00a2301fa3b50c61baeafb1c4de41 /src/newgrf_commons.cpp | |
parent | b642b4a881ef645842242d389ff90a1d8cfc7e61 (diff) | |
download | openttd-c6e29a5b8971e004d9b794fa2eaa928f0bcbbc38.tar.xz |
(svn r22848) -Add: The missing bits in station variable 43.
Diffstat (limited to 'src/newgrf_commons.cpp')
-rw-r--r-- | src/newgrf_commons.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index f4161fc82..0867b2675 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -25,6 +25,8 @@ #include "genworld.h" #include "newgrf_spritegroup.h" #include "newgrf_text.h" +#include "livery.h" +#include "company_base.h" #include "table/strings.h" @@ -453,6 +455,18 @@ uint32 GetNearbyTileInformation(TileIndex tile) } /** + * Returns company information like in vehicle var 43 or station var 43. + * @param owner Owner of the object. + * @param l Livery of the object; NULL to use default. + * @return NewGRF company information. + */ +uint32 GetCompanyInfo(CompanyID owner, const Livery *l) +{ + if (l == NULL && Company::IsValidID(owner)) l = &Company::Get(owner)->livery[LS_DEFAULT]; + return owner | (Company::IsValidAiID(owner) ? 0x10000 : 0) | (l != NULL ? (l->colour1 << 24) | (l->colour2 << 28) : 0); +} + +/** * Get the error message from a shape/location/slope check callback result. * @param cb_res Callback result to translate. If bit 10 is set this is a standard error message, otherwise a NewGRF provided string. * @param grfid grfID to use to resolve a custom error message. |