src/industry_map.h
author celestar
Tue, 19 Jun 2007 07:21:01 +0000
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
child 7814 fe643468ad64
permissions -rw-r--r--
(svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
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
3495
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
     3
/** @file industry_map.h Accessors for industries */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
     4
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
     5
#ifndef INDUSTRY_MAP_H
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
     6
#define INDUSTRY_MAP_H
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
     7
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
     8
#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
     9
#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
    10
#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
    11
3545
3e66bf329257 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3538
diff changeset
    12
3553
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    13
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    14
/**
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    15
 * The following enums are indices used to know what to draw for this industry tile.
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    16
 * They all are pointing toward array _industry_draw_tile_data, in table/industry_land.h
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    17
 * How to calculate the correct position ? GFXid << 2 | IndustryStage (0 to 3)
b34eae3b8d0f (svn r4425) Fix bug introduced in r4411 : while IS_BYTE_INSIDE, max value is STRICKLY LESS THEN. This caused airports animations to stay unanimated. Industries were similarly affected.
belugas
parents: 3545
diff changeset
    18
 */
3545
3e66bf329257 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3538
diff changeset
    19
enum {
4583
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    20
	GFX_COAL_MINE_TOWER_NOT_ANIMATED   =   0,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    21
	GFX_COAL_MINE_TOWER_ANIMATED       =   1,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    22
	GFX_POWERPLANT_CHIMNEY             =   8,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    23
	GFX_POWERPLANT_SPARKS              =  10,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    24
	GFX_OILRIG_1                       =  24,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    25
	GFX_OILRIG_2                       =  25,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    26
	GFX_OILRIG_3                       =  26,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    27
	GFX_OILRIG_4                       =  27,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    28
	GFX_OILRIG_5                       =  28,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    29
	GFX_OILWELL_NOT_ANIMATED           =  29,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    30
	GFX_OILWELL_ANIMATED_1             =  30,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    31
	GFX_OILWELL_ANIMATED_2             =  31,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    32
	GFX_OILWELL_ANIMATED_3             =  32,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    33
	GFX_COPPER_MINE_TOWER_NOT_ANIMATED =  47,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    34
	GFX_COPPER_MINE_TOWER_ANIMATED     =  48,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    35
	GFX_COPPER_MINE_CHIMNEY            =  49,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    36
	GFX_GOLD_MINE_TOWER_NOT_ANIMATED   =  79,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    37
	GFX_GOLD_MINE_TOWER_ANIMATED       =  88,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    38
	GFX_TOY_FACTORY                    = 143,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    39
	GFX_PLASTIC_FOUNTAIN_ANIMATED_1    = 148,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    40
	GFX_PLASTIC_FOUNTAIN_ANIMATED_2    = 149,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    41
	GFX_PLASTIC_FOUNTAIN_ANIMATED_3    = 150,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    42
	GFX_PLASTIC_FOUNTAIN_ANIMATED_4    = 151,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    43
	GFX_PLASTIC_FOUNTAIN_ANIMATED_5    = 152,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    44
	GFX_PLASTIC_FOUNTAIN_ANIMATED_6    = 153,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    45
	GFX_PLASTIC_FOUNTAIN_ANIMATED_7    = 154,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    46
	GFX_PLASTIC_FOUNTAIN_ANIMATED_8    = 155,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    47
	GFX_BUBBLE_GENERATOR               = 161,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    48
	GFX_BUBBLE_CATCHER                 = 162,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    49
	GFX_TOFFEE_QUARY                   = 165,
45b8bf91b1e3 (svn r6433) -Codechange: replace some magic numbers (industry gfx indices) by enums.
rubidium
parents: 4330
diff changeset
    50
	GFX_SUGAR_MINE_SIEVE               = 174,
3545
3e66bf329257 (svn r4411) CodeChange : Define and use some Gfx for both stations and industries. More are still to come
belugas
parents: 3538
diff changeset
    51
};
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    52
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    53
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    54
 * Get the industry ID of the given tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    55
 * @param t the tile to get the industry ID from
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    56
 * @pre IsTileType(t, MP_INDUSTRY)
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    57
 * @return the industry ID
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    58
 */
4330
7306bda145ab (svn r6005) -Cleanup: introduce IndustryID and use it
rubidium
parents: 4077
diff changeset
    59
static inline IndustryID GetIndustryIndex(TileIndex t)
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    60
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    61
	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
    62
	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
    63
}
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    64
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    65
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    66
 * Get the industry of the given tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    67
 * @param t the tile to get the industry from
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    68
 * @pre IsTileType(t, MP_INDUSTRY)
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    69
 * @return the industry
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    70
 */
3314
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    71
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
    72
{
b8b234d4584f (svn r4077) Add GetIndustry{Index,ByTile}() to get the industry index resp. the industry from a tile
tron
parents:
diff changeset
    73
	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
    74
}
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
    75
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    76
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    77
 * Is this industry tile fully built?
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    78
 * @param t the tile to analyze
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    79
 * @pre IsTileType(t, MP_INDUSTRY)
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    80
 * @return true if and only if the industry tile is fully built
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
    81
 */
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    82
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
    83
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    84
	assert(IsTileType(t, MP_INDUSTRY));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
    85
	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
    86
}
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
    87
3499
e95d6e5f66ae (svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents: 3495
diff changeset
    88
IndustryType GetIndustryType(TileIndex tile);
e95d6e5f66ae (svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents: 3495
diff changeset
    89
3495
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    90
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    91
 * Set if the industry that owns the tile as under construction or not
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    92
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    93
 * @param isCompleted whether it is completed or not
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    94
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    95
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    96
static inline void SetIndustryCompleted(TileIndex tile, bool isCompleted)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    97
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    98
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
    99
	SB(_m[tile].m1, 7, 1, isCompleted ? 1 :0);
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   100
}
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   101
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   102
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   103
 * Returns the industry construction stage of the specified tile
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   104
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   105
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   106
 * @return the construction stage
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   107
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   108
static inline byte GetIndustryConstructionStage(TileIndex tile)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   109
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   110
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   111
	return GB(_m[tile].m1, 0, 2);
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   112
}
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   113
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   114
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   115
 * Sets the industry construction stage of the specified tile
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   116
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   117
 * @param value the new construction stage
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   118
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   119
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   120
static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   121
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   122
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   123
	SB(_m[tile].m1, 0, 2, value);
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   124
}
3321
c5f2375046bc (svn r4087) Add IsIndustryCompleted() to check if a industry tile is fully built
tron
parents: 3320
diff changeset
   125
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   126
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   127
 * Get the industry graphics ID for the given industry tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   128
 * @param t the tile to get the gfx for
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   129
 * @pre IsTileType(t, MP_INDUSTRY)
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   130
 * @return the gfx ID
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   131
 */
3499
e95d6e5f66ae (svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents: 3495
diff changeset
   132
static inline IndustryGfx GetIndustryGfx(TileIndex t)
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   133
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
   134
	assert(IsTileType(t, MP_INDUSTRY));
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   135
	return _m[t].m5;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   136
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   137
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   138
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   139
 * Set the industry graphics ID for the given industry tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   140
 * @param t   the tile to set the gfx for
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   141
 * @pre IsTileType(t, MP_INDUSTRY)
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   142
 * @param gfx the graphics ID
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   143
 */
3499
e95d6e5f66ae (svn r4350) CodeChange : Add and use accessors [G|S]etIndustrype. Define and use IndustryGfx type instead of uint
belugas
parents: 3495
diff changeset
   144
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   145
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3331
diff changeset
   146
	assert(IsTileType(t, MP_INDUSTRY));
3331
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   147
	_m[t].m5 = gfx;
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   148
}
917914fbbf3c (svn r4108) Add [GS]etIndustryGfx()
tron
parents: 3321
diff changeset
   149
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   150
/**
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   151
 * Make the given tile an industry tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   152
 * @param t     the tile to make an industry tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   153
 * @param index the industry this tile belongs to
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   154
 * @param gfx   the graphics to use for the tile
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   155
 */
4330
7306bda145ab (svn r6005) -Cleanup: introduce IndustryID and use it
rubidium
parents: 4077
diff changeset
   156
static inline void MakeIndustry(TileIndex t, IndustryID index, IndustryGfx gfx)
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   157
{
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   158
	SetTileType(t, MP_INDUSTRY);
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   159
	_m[t].m1 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   160
	_m[t].m2 = index;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   161
	_m[t].m3 = 0;
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   162
	_m[t].m4 = 0;
9913
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   163
	SetIndustryGfx(t, gfx);
3320
9814b97a8edb (svn r4086) Add MakeIndustry()
tron
parents: 3314
diff changeset
   164
}
3495
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   165
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   166
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   167
 * Returns this indutry tile's construction counter value
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   168
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   169
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   170
 * @return the construction counter
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   171
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   172
static inline byte GetIndustryConstructionCounter(TileIndex tile)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   173
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   174
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   175
	return GB(_m[tile].m1, 2, 2);
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   176
}
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   177
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   178
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   179
 * Sets this indutry tile's construction counter value
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   180
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   181
 * @param value the new value for the construction counter
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   182
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   183
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   184
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   185
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   186
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   187
	SB(_m[tile].m1, 2, 2, value);
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   188
}
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   189
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   190
/**
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   191
 * Reset the construction stage counter of the industry,
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   192
 * as well as the completion bit.
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   193
 * In fact, it is the same as restarting construction frmo ground up
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   194
 * @param tile the tile to query
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   195
 * @pre IsTileType(tile, MP_INDUSTRY)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   196
 */
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   197
static inline void ResetIndustryConstructionStage(TileIndex tile)
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   198
{
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   199
	assert(IsTileType(tile, MP_INDUSTRY));
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   200
	_m[tile].m1 = 0;
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   201
}
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   202
3538
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   203
/**
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   204
 * Get the animation loop number
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   205
 * @param tile the tile to get the animation loop number of
5685
b88aca81aa7b (svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
rubidium
parents: 4583
diff changeset
   206
 * @pre IsTileType(tile, MP_INDUSTRY)
3538
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   207
 */
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   208
static inline byte GetIndustryAnimationLoop(TileIndex tile)
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   209
{
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   210
	assert(IsTileType(tile, MP_INDUSTRY));
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   211
	return _m[tile].m4;
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   212
}
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   213
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   214
/**
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   215
 * Set the animation loop number
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   216
 * @param tile the tile to set the animation loop number of
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   217
 * @param count the new animation frame number
5685
b88aca81aa7b (svn r7640) -Codechange: move a table from industry_cmd.c to table/industry_land
rubidium
parents: 4583
diff changeset
   218
 * @pre IsTileType(tile, MP_INDUSTRY)
3538
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   219
 */
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   220
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   221
{
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   222
	assert(IsTileType(tile, MP_INDUSTRY));
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   223
	_m[tile].m4 = count;
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   224
}
3eb71c726341 (svn r4399) CodeChange : Add and make use of [G|S]etIndustryAnimationLoop accessors.
belugas
parents: 3499
diff changeset
   225
5686
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   226
/**
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   227
 * Get the animation state
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   228
 * @param tile the tile to get the animation state of
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   229
 * @pre IsTileType(tile, MP_INDUSTRY)
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   230
 */
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   231
static inline byte GetIndustryAnimationState(TileIndex tile)
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   232
{
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   233
	assert(IsTileType(tile, MP_INDUSTRY));
5687
a6f0e780d714 (svn r7642) -Codechange: unify all the different locations where the animation state is stored into a single location.
rubidium
parents: 5686
diff changeset
   234
	return _m[tile].m3;
5686
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   235
}
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   236
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   237
/**
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   238
 * Set the animation state
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   239
 * @param tile the tile to set the animation state of
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   240
 * @param state the new animation state
5686
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   241
 * @pre IsTileType(tile, MP_INDUSTRY)
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   242
 */
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   243
static inline void SetIndustryAnimationState(TileIndex tile, byte state)
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   244
{
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   245
	assert(IsTileType(tile, MP_INDUSTRY));
5687
a6f0e780d714 (svn r7642) -Codechange: unify all the different locations where the animation state is stored into a single location.
rubidium
parents: 5686
diff changeset
   246
	_m[tile].m3 = state;
5686
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   247
}
03c3d3b3e7eb (svn r7641) -Codechange: remove the last direct map accesses from industry_cmd.
rubidium
parents: 5685
diff changeset
   248
9913
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   249
/**
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   250
 * Get the random bits for this tile.
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   251
 * Used for grf callbacks
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   252
 * @param tile TileIndex of the tile to query
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   253
 * @pre IsTileType(tile, MP_INDUSTRY)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   254
 * @return requested bits
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   255
 * @todo implement the storage in map array
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   256
 */
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   257
static inline byte GetIndustryRandomBits(TileIndex tile)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   258
{
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   259
	assert(IsTileType(tile, MP_INDUSTRY));
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   260
	return 0;
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   261
}
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   262
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   263
/**
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   264
 * Get the activated triggers bits for this industry tile
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   265
 * Used for grf callbacks
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   266
 * @param tile TileIndex of the tile to query
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   267
 * @pre IsTileType(tile, MP_INDUSTRY)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   268
 * @return requested triggers
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   269
 * @todo implement the storage in map array
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   270
 */
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   271
static inline byte GetIndustryTriggers(TileIndex tile)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   272
{
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   273
	assert(IsTileType(tile, MP_INDUSTRY));
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   274
	return 0;
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   275
}
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   276
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   277
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   278
/**
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   279
 * Set the activated triggers bits for this industry tile
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   280
 * Used for grf callbacks
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   281
 * @param tile TileIndex of the tile to query
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   282
 * @pre IsTileType(tile, MP_INDUSTRY)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   283
 * @todo implement the storage in map array
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   284
 */
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   285
static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   286
{
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   287
	assert(IsTileType(tile, MP_INDUSTRY));
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   288
}
e79cd19772dd (svn r10213) [gamebalance] -Sync: r10100:10200 from trunk
celestar
parents: 9912
diff changeset
   289
3495
f7d3ae07f4aa (svn r4346) CodeChange : Add and Use Accessors to Industry's Stage and Counter construction. Removed last direct map access from Disaster_cmd.c as well. Based on work from Rubidium in tfc_newmap
belugas
parents: 3369
diff changeset
   290
#endif /* INDUSTRY_MAP_H */