src/clear_map.h
author celestar
Mon, 19 Mar 2007 09:33:17 +0000
branchgamebalance
changeset 9894 70d78ac95d6c
parent 6449 e520244dc71e
child 6298 c30fe89622df
permissions -rw-r--r--
(svn r9310) [gamebalance] -Feature: Player performance now influences the wealth level of a town (albeit only on a small scale). This is the first feedback effect that the player has on the local and global economy. Please refrain from using the AI too much for the time being because it'll trash the ratings most likely.
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
     1
/* $Id$ */
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
     2
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
     3
/** @file clear_map.h */
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
     4
3145
349b745dfbf4 (svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents: 3144
diff changeset
     5
#ifndef CLEAR_MAP_H
349b745dfbf4 (svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents: 3144
diff changeset
     6
#define CLEAR_MAP_H
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
     7
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
     8
#include "macros.h"
3076
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
     9
#include "tile.h"
5828
d54db61cc830 (svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
maedhros
parents: 5726
diff changeset
    10
#include "bridge_map.h"
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    11
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    12
/* ground type, m5 bits 2...4
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    13
 * valid densities (bits 0...1) in comments after the enum
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    14
 */
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    15
typedef enum ClearGround {
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    16
	CLEAR_GRASS  = 0, ///< 0-3
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    17
	CLEAR_ROUGH  = 1, ///< 3
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    18
	CLEAR_ROCKS  = 2, ///< 3
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    19
	CLEAR_FIELDS = 3, ///< 3
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    20
	CLEAR_SNOW   = 4, ///< 0-3
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
    21
	CLEAR_DESERT = 5  ///< 1,3
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    22
} ClearGround;
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    23
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    24
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    25
static inline ClearGround GetClearGround(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    26
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    27
	assert(IsTileType(t, MP_CLEAR));
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5828
diff changeset
    28
	return (ClearGround)GB(_m[t].m5, 2, 3);
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    29
}
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    30
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    31
static inline bool IsClearGround(TileIndex t, ClearGround ct)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    32
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    33
	return GetClearGround(t) == ct;
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    34
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    35
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    36
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    37
static inline uint GetClearDensity(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    38
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    39
	assert(IsTileType(t, MP_CLEAR));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    40
	return GB(_m[t].m5, 0, 2);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    41
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    42
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    43
static inline void AddClearDensity(TileIndex t, int d)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    44
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    45
	assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    46
	_m[t].m5 += d;
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    47
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    48
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    49
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    50
static inline uint GetClearCounter(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    51
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    52
	assert(IsTileType(t, MP_CLEAR));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    53
	return GB(_m[t].m5, 5, 3);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    54
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    55
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    56
static inline void AddClearCounter(TileIndex t, int c)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    57
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    58
	assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    59
	_m[t].m5 += c << 5;
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    60
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    61
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    62
static inline void SetClearCounter(TileIndex t, uint c)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    63
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    64
	assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    65
	SB(_m[t].m5, 5, 3, c);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    66
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    67
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    68
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    69
/* Sets type and density in one go, also sets the counter to 0 */
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    70
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    71
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    72
	assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
2955
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    73
	_m[t].m5 = 0 << 5 | type << 2 | density;
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    74
}
27221592ebbc (svn r3514) -Codechange: Replace direct fiddling of bits for the ground type and density of clear tiles with symbolic names and accessors.
tron
parents:
diff changeset
    75
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    76
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    77
static inline uint GetFieldType(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    78
{
3447
d136931464f7 (svn r4279) s/\<CL_/CLEAR_/
tron
parents: 3369
diff changeset
    79
	assert(GetClearGround(t) == CLEAR_FIELDS);
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    80
	return GB(_m[t].m3, 0, 4);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    81
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    82
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    83
static inline void SetFieldType(TileIndex t, uint f)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    84
{
3447
d136931464f7 (svn r4279) s/\<CL_/CLEAR_/
tron
parents: 3369
diff changeset
    85
	assert(GetClearGround(t) == CLEAR_FIELDS); // XXX incomplete
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    86
	SB(_m[t].m3, 0, 4, f);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    87
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
    88
4328
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    89
static inline uint16 GetIndustryIndexOfField(TileIndex t)
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    90
{
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    91
	assert(GetClearGround(t) == CLEAR_FIELDS);
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    92
	return _m[t].m2;
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    93
}
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    94
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    95
static inline void SetIndustryIndexOfField(TileIndex t, uint16 i)
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    96
{
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    97
	assert(GetClearGround(t) == CLEAR_FIELDS);
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    98
	_m[t].m2 = i;
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
    99
}
2979
883788245931 (svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents: 2955
diff changeset
   100
883788245931 (svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents: 2955
diff changeset
   101
/* Is used by tree tiles, too */
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   102
static inline uint GetFenceSE(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   103
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   104
	assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   105
	return GB(_m[t].m4, 2, 3);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   106
}
2979
883788245931 (svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents: 2955
diff changeset
   107
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   108
static inline void SetFenceSE(TileIndex t, uint h)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   109
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   110
	assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)); // XXX incomplete
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   111
	SB(_m[t].m4, 2, 3, h);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   112
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   113
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   114
static inline uint GetFenceSW(TileIndex t)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   115
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   116
	assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   117
	return GB(_m[t].m4, 5, 3);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   118
}
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   119
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   120
static inline void SetFenceSW(TileIndex t, uint h)
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   121
{
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   122
	assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)); // XXX incomplete
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   123
	SB(_m[t].m4, 5, 3, h);
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3291
diff changeset
   124
}
2979
883788245931 (svn r3554) Add accessors for the field type and fences of clear tiles
tron
parents: 2955
diff changeset
   125
3076
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   126
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   127
static inline void MakeClear(TileIndex t, ClearGround g, uint density)
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   128
{
5828
d54db61cc830 (svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
maedhros
parents: 5726
diff changeset
   129
	/* If this is a non-bridgeable tile, clear the bridge bits while the rest
d54db61cc830 (svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
maedhros
parents: 5726
diff changeset
   130
	 * of the tile information is still here. */
5847
9ce114e1d90d (svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents: 5838
diff changeset
   131
	if (!MayHaveBridgeAbove(t)) SB(_m[t].m6, 6, 2, 0);
5828
d54db61cc830 (svn r8014) -Codechange (r7573): When a tile is cleared, empty the general purpose bits in
maedhros
parents: 5726
diff changeset
   132
3076
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   133
	SetTileType(t, MP_CLEAR);
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   134
	SetTileOwner(t, OWNER_NONE);
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   135
	_m[t].m2 = 0;
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   136
	_m[t].m3 = 0;
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   137
	_m[t].m4 = 0 << 5 | 0 << 2;
3291
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   138
	SetClearGroundDensity(t, g, density);
6449
e520244dc71e (svn r8859) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 5847
diff changeset
   139
	SB(_m[t].m6, 2, 4, 0); // Clear the rest of m6, bits 2 to 5
3291
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   140
}
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   141
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   142
4328
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
   143
static inline void MakeField(TileIndex t, uint field_type, uint16 industry)
3291
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   144
{
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   145
	SetTileType(t, MP_CLEAR);
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   146
	SetTileOwner(t, OWNER_NONE);
4328
23dd79414386 (svn r6001) -Feature: when removing a farm, his farmland is removed too (over time) (based on peter1138's patch, FS#82)
truelight
parents: 3516
diff changeset
   147
	_m[t].m2 = industry;
3291
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   148
	_m[t].m3 = field_type;
e0b2c01649f7 (svn r4007) Add a function to make a farm field tile
tron
parents: 3145
diff changeset
   149
	_m[t].m4 = 0 << 5 | 0 << 2;
3447
d136931464f7 (svn r4279) s/\<CL_/CLEAR_/
tron
parents: 3369
diff changeset
   150
	SetClearGroundDensity(t, CLEAR_FIELDS, 3);
3076
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   151
}
9584f34a83dc (svn r3665) Add a function to turn a tile into a clear tile
tron
parents: 2979
diff changeset
   152
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4328
diff changeset
   153
#endif /* CLEAR_MAP_H */