Changeset - r3144:5b175fed4b0b
[Not reviewed]
master
4 15 4
tron - 18 years ago 2006-03-05 10:19:33
tron@openttd.org
(svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
23 files changed with 244 insertions and 244 deletions:
0 comments (0 inline, 0 general)
ai/default/default.c
Show inline comments
 
@@ -4,7 +4,7 @@
 
#include "../../openttd.h"
 
#include "../../functions.h"
 
#include "../../map.h"
 
#include "../../road.h"
 
#include "../../road_map.h"
 
#include "../../tile.h"
 
#include "../../player.h"
 
#include "../../vehicle.h"
ai/trolly/trolly.c
Show inline comments
 
@@ -21,7 +21,7 @@
 
#include "../../openttd.h"
 
#include "../../debug.h"
 
#include "../../functions.h"
 
#include "../../road.h"
 
#include "../../road_map.h"
 
#include "../../table/strings.h"
 
#include "../../map.h"
 
#include "../../tile.h"
clear.h
Show inline comments
 
deleted file
clear_cmd.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "table/strings.h"
 
#include "functions.h"
 
#include "map.h"
clear_map.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
#ifndef CLEAR_H
 
#define CLEAR_H
 

	
 
#include "macros.h"
 
#include "tile.h"
 

	
 
/* ground type, m5 bits 2...4
 
 * valid densities (bits 0...1) in comments after the enum
 
 */
 
typedef enum ClearGround {
 
	CL_GRASS  = 0, // 0-3
 
	CL_ROUGH  = 1, // 3
 
	CL_ROCKS  = 2, // 3
 
	CL_FIELDS = 3, // 3
 
	CL_SNOW   = 4, // 0-3
 
	CL_DESERT = 5  // 1,3
 
} ClearGround;
 

	
 
static inline ClearGround GetClearGround(TileIndex t) { return GB(_m[t].m5, 2, 3); }
 
static inline bool IsClearGround(TileIndex t, ClearGround ct) { return GetClearGround(t) == ct; }
 

	
 
static inline void AddClearDensity(TileIndex t, int d) { _m[t].m5 += d; }
 
static inline uint GetClearDensity(TileIndex t) { return GB(_m[t].m5, 0, 2); }
 

	
 
static inline void AddClearCounter(TileIndex t, int c) { _m[t].m5 += c << 5; }
 
static inline uint GetClearCounter(TileIndex t) { return GB(_m[t].m5, 5, 3); }
 
static inline void SetClearCounter(TileIndex t, uint c) { SB(_m[t].m5, 5, 3, c); }
 

	
 
/* Sets type and density in one go, also sets the counter to 0 */
 
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
 
{
 
	_m[t].m5 = 0 << 5 | type << 2 | density;
 
}
 

	
 
static inline uint GetFieldType(TileIndex t) { return GB(_m[t].m3, 0, 4); }
 
static inline void SetFieldType(TileIndex t, uint f) { SB(_m[t].m3, 0, 4, f); }
 

	
 
/* Is used by tree tiles, too */
 
static inline uint GetFenceSE(TileIndex t) { return GB(_m[t].m4, 2, 3); }
 
static inline void SetFenceSE(TileIndex t, uint h) { SB(_m[t].m4, 2, 3, h); }
 

	
 
static inline uint GetFenceSW(TileIndex t) { return GB(_m[t].m4, 5, 3); }
 
static inline void SetFenceSW(TileIndex t, uint h) { SB(_m[t].m4, 5, 3, h); }
 

	
 

	
 
static inline void MakeClear(TileIndex t, ClearGround g, uint density)
 
{
 
	SetTileType(t, MP_CLEAR);
 
	SetTileOwner(t, OWNER_NONE);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0 << 5 | 0 << 2;
 
	_m[t].m5 = 0 << 5 | g << 2 | density;
 
}
 

	
 
#endif
industry_cmd.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "functions.h"
landscape.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "functions.h"
 
#include "map.h"
 
#include "player.h"
 
@@ -14,7 +14,7 @@
 
#include "command.h"
 
#include "vehicle.h"
 
#include "variables.h"
 
#include "void.h"
 
#include "void_map.h"
 
#include "water_map.h"
 

	
 
extern const TileTypeProcs
openttd.c
Show inline comments
 
@@ -9,7 +9,7 @@
 
#include "strings.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "void.h"
 
#include "void_map.h"
 

	
 
#define VARDEF
 
#include "openttd.h"
order_gui.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "functions.h"
rail_cmd.c
Show inline comments
 
@@ -5,7 +5,7 @@
 
#include "debug.h"
 
#include "functions.h"
 
#include "rail_map.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "map.h"
road.h
Show inline comments
 
deleted file
road_cmd.c
Show inline comments
 
@@ -3,7 +3,7 @@
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "rail_map.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "functions.h"
road_map.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
#ifndef ROAD_H
 
#define ROAD_H
 

	
 
#include "macros.h"
 
#include "rail.h"
 
#include "tile.h"
 

	
 
typedef enum RoadBits {
 
	ROAD_NW  = 1,
 
	ROAD_SW  = 2,
 
	ROAD_SE  = 4,
 
	ROAD_NE  = 8,
 
	ROAD_X   = ROAD_SW | ROAD_NE,
 
	ROAD_Y   = ROAD_NW | ROAD_SE,
 
	ROAD_ALL = ROAD_X  | ROAD_Y
 
} RoadBits;
 

	
 
static inline RoadBits ComplementRoadBits(RoadBits r)
 
{
 
	return ROAD_ALL ^ r;
 
}
 

	
 
static inline RoadBits GetRoadBits(TileIndex tile)
 
{
 
	return GB(_m[tile].m5, 0, 4);
 
}
 

	
 
static inline RoadBits GetCrossingRoadBits(TileIndex tile)
 
{
 
	return _m[tile].m5 & 8 ? ROAD_Y : ROAD_X;
 
}
 

	
 
static inline TrackBits GetCrossingRailBits(TileIndex tile)
 
{
 
	return _m[tile].m5 & 8 ? TRACK_BIT_X : TRACK_BIT_Y;
 
}
 

	
 

	
 
typedef enum RoadType {
 
	ROAD_NORMAL,
 
	ROAD_CROSSING,
 
	ROAD_DEPOT
 
} RoadType;
 

	
 
static inline RoadType GetRoadType(TileIndex tile)
 
{
 
	return GB(_m[tile].m5, 4, 4);
 
}
 

	
 

	
 
static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
 
{
 
	SetTileType(t, MP_STREET);
 
	SetTileOwner(t, owner);
 
	_m[t].m2 = town;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0 << 7 | 0 << 4 | 0;
 
	_m[t].m5 = ROAD_NORMAL << 4 | bits;
 
}
 

	
 

	
 
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner rail, Axis roaddir, RailType rt, uint town)
 
{
 
	SetTileType(t, MP_STREET);
 
	SetTileOwner(t, rail);
 
	_m[t].m2 = town;
 
	_m[t].m3 = road;
 
	_m[t].m4 = 0 << 7 | 0 << 4 | rt;
 
	_m[t].m5 = ROAD_CROSSING << 4 | roaddir << 3 | 0 << 2;
 
}
 

	
 

	
 
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir)
 
{
 
	SetTileType(t, MP_STREET);
 
	SetTileOwner(t, owner);
 
	_m[t].m2 = 0;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = ROAD_DEPOT << 4 | dir;
 
}
 

	
 
#endif
roadveh_cmd.c
Show inline comments
 
@@ -4,7 +4,7 @@
 
#include "openttd.h"
 
#include "debug.h"
 
#include "functions.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/strings.h"
 
#include "map.h"
 
#include "tile.h"
smallmap_gui.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "functions.h"
 
#include "spritecache.h"
 
#include "table/strings.h"
 
@@ -10,7 +10,7 @@
 
#include "map.h"
 
#include "tile.h"
 
#include "gui.h"
 
#include "tree.h"
 
#include "tree_map.h"
 
#include "window.h"
 
#include "gfx.h"
 
#include "viewport.h"
terraform_gui.c
Show inline comments
 
@@ -2,7 +2,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "functions.h"
town_cmd.c
Show inline comments
 
@@ -4,7 +4,7 @@
 
#include "openttd.h"
 
#include "functions.h"
 
#include "strings.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "map.h"
tree.h
Show inline comments
 
deleted file
tree_cmd.c
Show inline comments
 
@@ -2,14 +2,14 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "clear.h"
 
#include "clear_map.h"
 
#include "table/strings.h"
 
#include "table/sprites.h"
 
#include "table/tree_land.h"
 
#include "functions.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "tree.h"
 
#include "tree_map.h"
 
#include "viewport.h"
 
#include "command.h"
 
#include "town.h"
tree_map.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
#ifndef TREE_H
 
#define TREE_H
 

	
 
#include "macros.h"
 

	
 
typedef enum TreeType {
 
	TR_INVALID      = -1,
 
	TR_TEMPERATE    = 0,
 
	TR_SUB_ARCTIC   = 12,
 
	TR_RAINFOREST   = 20,
 
	TR_CACTUS       = 27,
 
	TR_SUB_TROPICAL = 28,
 
	TR_TOYLAND      = 32
 
} TreeType;
 

	
 
enum {
 
	TR_COUNT_TEMPERATE    = TR_SUB_ARCTIC   - TR_TEMPERATE,
 
	TR_COUNT_SUB_ARCTIC   = TR_RAINFOREST   - TR_SUB_ARCTIC,
 
	TR_COUNT_RAINFOREST   = TR_CACTUS       - TR_RAINFOREST,
 
	TR_COUNT_SUB_TROPICAL = TR_SUB_TROPICAL - TR_CACTUS,
 
	TR_COUNT_TOYLAND      = 9
 
};
 

	
 
/* ground type, m2 bits 4...5
 
 * valid densities (bits 6...7) in comments after the enum */
 
typedef enum TreeGround {
 
	TR_GRASS       = 0, // 0
 
	TR_ROUGH       = 1, // 0
 
	TR_SNOW_DESERT = 2  // 0-3 for snow, 3 for desert
 
} TreeGround;
 

	
 
static inline TreeType GetTreeType(TileIndex t) { return _m[t].m3; }
 
static inline void SetTreeType(TileIndex t, TreeType r) { _m[t].m3 = r; }
 

	
 
static inline TreeGround GetTreeGround(TileIndex t) { return GB(_m[t].m2, 4, 2); }
 

	
 
static inline uint GetTreeDensity(TileIndex t) { return GB(_m[t].m2, 6, 2); }
 

	
 
static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
 
{
 
	SB(_m[t].m2, 4, 2, g);
 
	SB(_m[t].m2, 6, 2, d);
 
}
 

	
 
static inline void AddTreeCount(TileIndex t, int c) { _m[t].m5 += c << 6; }
 
static inline uint GetTreeCount(TileIndex t) { return GB(_m[t].m5, 6, 2); }
 
static inline void SetTreeCount(TileIndex t, uint c) { SB(_m[t].m5, 6, 2, c); }
 

	
 
static inline void AddTreeGrowth(TileIndex t, int a) { _m[t].m5 += a; }
 
static inline uint GetTreeGrowth(TileIndex t) { return GB(_m[t].m5, 0, 3); }
 
static inline void SetTreeGrowth(TileIndex t, uint g) { SB(_m[t].m5, 0, 3, g); }
 

	
 
static inline void AddTreeCounter(TileIndex t, int a) { _m[t].m2 += a; }
 
static inline uint GetTreeCounter(TileIndex t) { return GB(_m[t].m2, 0, 4); }
 
static inline void SetTreeCounter(TileIndex t, uint c) { SB(_m[t].m2, 0, 4, c); }
 

	
 

	
 
static inline void MakeTree(TileIndex t, TreeType type, uint count, uint growth, TreeGround ground, uint density)
 
{
 
	SetTileType(t, MP_TREES);
 
	SetTileOwner(t, OWNER_NONE);
 
	_m[t].m2 = density << 6 | ground << 4 | 0;
 
	_m[t].m3 = type;
 
	_m[t].m4 = 0 << 5 | 0 << 2;
 
	_m[t].m5 = count << 6 | growth;
 
}
 

	
 
#endif
tunnelbridge_cmd.c
Show inline comments
 
@@ -7,7 +7,7 @@
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "road.h"
 
#include "road_map.h"
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "functions.h"
void.h
Show inline comments
 
deleted file
void_map.h
Show inline comments
 
new file 100644
 
/* $Id$ */
 

	
 
static inline void MakeVoid(TileIndex t)
 
{
 
	SetTileType(t, MP_VOID);
 
	SetTileHeight(t, 0);
 
	_m[t].m1 = 0;
 
	_m[t].m2 = 0;
 
	_m[t].m3 = 0;
 
	_m[t].m4 = 0;
 
	_m[t].m5 = 0;
 
	_m[t].extra = 0;
 
}
0 comments (0 inline, 0 general)