diff options
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. |