(svn r22848) -Add: The missing bits in station variable 43.

This commit is contained in:
frosch
2011-08-27 08:42:24 +00:00
parent b642b4a881
commit c6e29a5b89
4 changed files with 32 additions and 7 deletions

View File

@@ -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"
@@ -452,6 +454,18 @@ uint32 GetNearbyTileInformation(TileIndex tile)
return tile_type << 24 | z << 16 | terrain_type << 8 | tileh;
}
/**
* 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.