industry_map.h
author celestar
Wed, 29 Mar 2006 16:30:26 +0000
changeset 3355 a653b8e47f27
parent 3331 917914fbbf3c
child 3369 00c2ca209a89
permissions -rw-r--r--
(svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     1
/* $Id$ */
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     2
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     3
#include "industry.h"
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     4
#include "macros.h"
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     5
#include "tile.h"
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     6
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     7
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     8
static inline uint GetIndustryIndex(TileIndex t)
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     9
{
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    10
	return _m[t].m2;
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    11
}
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    12
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    13
static inline Industry* GetIndustryByTile(TileIndex t)
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    14
{
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    15
	return GetIndustry(GetIndustryIndex(t));
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    16
}
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    17
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    18
3321
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    19
static inline bool IsIndustryCompleted(TileIndex tile)
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    20
{
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    21
	return HASBIT(_m[tile].m1, 7);
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    22
}
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    23
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    24
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    25
static inline uint GetIndustryGfx(TileIndex t)
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    26
{
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    27
	return _m[t].m5;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    28
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    29
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    30
static inline void SetIndustryGfx(TileIndex t, uint gfx)
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    31
{
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    32
	_m[t].m5 = gfx;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    33
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    34
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    35
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    36
static inline void MakeIndustry(TileIndex t, uint index, uint gfx)
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    37
{
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    38
	SetTileType(t, MP_INDUSTRY);
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    39
	_m[t].m1 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    40
	_m[t].m2 = index;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    41
	_m[t].m3 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    42
	_m[t].m4 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    43
	_m[t].m5 = gfx;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    44
}