industry_map.h
author bjarni
Thu, 30 Mar 2006 20:14:06 +0000
changeset 3380 f473785f812c
parent 3369 00c2ca209a89
child 3495 f7d3ae07f4aa
permissions -rw-r--r--
(svn r4183) -Codechange: [Makefile]: removed MANUAL_CONFIG as it's not used anymore
This should hopefully fix the issue where WITH_SDL can be defined while SDL-CONFIG is not
Added an error if WITH_SDL is defined but SDL-CONFIG is not. The same goes for WITH_PNG even though nobody reported this as a problem
removed STATIC_ZLIB_PATH as it turns out that nobody used it
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
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    10
	assert(IsTileType(t, MP_INDUSTRY));
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    11
	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
    12
}
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    13
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    14
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
    15
{
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    16
	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
    17
}
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    18
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    19
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    20
static inline bool IsIndustryCompleted(TileIndex t)
3321
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    21
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    22
	assert(IsTileType(t, MP_INDUSTRY));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    23
	return HASBIT(_m[t].m1, 7);
3321
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    24
}
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    25
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    26
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    27
static inline uint GetIndustryGfx(TileIndex t)
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    28
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    29
	assert(IsTileType(t, MP_INDUSTRY));
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    30
	return _m[t].m5;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    31
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    32
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    33
static inline void SetIndustryGfx(TileIndex t, uint gfx)
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    34
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    35
	assert(IsTileType(t, MP_INDUSTRY));
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    36
	_m[t].m5 = gfx;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    37
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    38
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
    39
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    40
static inline void MakeIndustry(TileIndex t, uint index, uint gfx)
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    41
{
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    42
	SetTileType(t, MP_INDUSTRY);
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    43
	_m[t].m1 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    44
	_m[t].m2 = index;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    45
	_m[t].m3 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    46
	_m[t].m4 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    47
	_m[t].m5 = gfx;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    48
}