mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-27 08:29:11 +00:00
(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h
This commit is contained in:
1
ai.c
1
ai.c
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "player.h"
|
||||
#include "vehicle.h"
|
||||
#include "engine.h"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "command.h"
|
||||
#include "ai.h"
|
||||
#include "engine.h"
|
||||
|
1
ai_new.c
1
ai_new.c
@@ -17,6 +17,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "command.h"
|
||||
#include "ai.h"
|
||||
#include "town.h"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "command.h"
|
||||
#include "ai.h"
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "engine.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "vehicle.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "command.h"
|
||||
#include "news.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
#include "industry.h"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include <stdarg.h>
|
||||
#include "gfx.h"
|
||||
#include "viewport.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
|
38
map.h
38
map.h
@@ -76,42 +76,4 @@ static inline TileIndexDiff TileOffsByDir(uint dir)
|
||||
return ToTileIndexDiff(_tileoffs_by_dir[dir]);
|
||||
}
|
||||
|
||||
|
||||
static inline uint TileHeight(TileIndex tile)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
return _map_type_and_height[tile] & 0xf;
|
||||
}
|
||||
|
||||
static inline void SetTileHeight(TileIndex tile, uint height)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
assert(height < 16);
|
||||
_map_type_and_height[tile] &= ~0x0F;
|
||||
_map_type_and_height[tile] |= height;
|
||||
}
|
||||
|
||||
static inline uint TilePixelHeight(TileIndex tile)
|
||||
{
|
||||
return TileHeight(tile) * 8;
|
||||
}
|
||||
|
||||
static inline int TileType(TileIndex tile)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
return _map_type_and_height[tile] >> 4;
|
||||
}
|
||||
|
||||
static inline void SetTileType(TileIndex tile, uint type)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
_map_type_and_height[tile] &= ~0xF0;
|
||||
_map_type_and_height[tile] |= type << 4;
|
||||
}
|
||||
|
||||
static inline bool IsTileType(TileIndex tile, int type)
|
||||
{
|
||||
return TileType(tile) == type;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "town.h"
|
||||
#include "industry.h"
|
||||
#include "station.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "gfx.h"
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "pathfind.h"
|
||||
|
||||
// remember which tiles we have already visited so we don't visit them again.
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "table/strings.h"
|
||||
#include "gfx.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "engine.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "command.h"
|
||||
#include "pathfind.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "gui.h"
|
||||
#include "window.h"
|
||||
#include "gfx.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "station.h"
|
||||
#include "gfx.h"
|
||||
#include "window.h"
|
||||
|
43
tile.h
Normal file
43
tile.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef TILE_H
|
||||
#define TILE_H
|
||||
|
||||
#include "map.h"
|
||||
|
||||
static inline uint TileHeight(TileIndex tile)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
return _map_type_and_height[tile] & 0xf;
|
||||
}
|
||||
|
||||
static inline void SetTileHeight(TileIndex tile, uint height)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
assert(height < 16);
|
||||
_map_type_and_height[tile] &= ~0x0F;
|
||||
_map_type_and_height[tile] |= height;
|
||||
}
|
||||
|
||||
static inline uint TilePixelHeight(TileIndex tile)
|
||||
{
|
||||
return TileHeight(tile) * 8;
|
||||
}
|
||||
|
||||
static inline int TileType(TileIndex tile)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
return _map_type_and_height[tile] >> 4;
|
||||
}
|
||||
|
||||
static inline void SetTileType(TileIndex tile, uint type)
|
||||
{
|
||||
assert(tile < MapSize());
|
||||
_map_type_and_height[tile] &= ~0xF0;
|
||||
_map_type_and_height[tile] |= type << 4;
|
||||
}
|
||||
|
||||
static inline bool IsTileType(TileIndex tile, int type)
|
||||
{
|
||||
return TileType(tile) == type;
|
||||
}
|
||||
|
||||
#endif
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "viewport.h"
|
||||
#include "town.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "command.h"
|
||||
#include "pathfind.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
#include "town.h"
|
||||
|
1
ttd.c
1
ttd.c
@@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
|
||||
#define VARDEF
|
||||
#include "ttd.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "command.h"
|
||||
#include "viewport.h"
|
||||
#include "player.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "gfx.h"
|
||||
#include "viewport.h"
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "ttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
|
Reference in New Issue
Block a user