summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-01-31 11:23:10 +0000
committermatthijs <matthijs@openttd.org>2005-01-31 11:23:10 +0000
commita2dec6c32a8a7907fc3faaae761c97132c11a088 (patch)
treed44a0a41fee496e1abc2bb31d1f29e733309f757 /macros.h
parentb64c375f2f9cbe0dca4f88e3fe3f613db03b84a4 (diff)
downloadopenttd-a2dec6c32a8a7907fc3faaae761c97132c11a088.tar.xz
(svn r1751) - Feature: New PathFinder (NPF).
- Supports trains, road vehicles and ships. - Uses A* pathfinding (same codebase as the new ai). - Currently unlimited search depth, so might perform badly on large maps/networks (especially ships). - Will always find a route if there is one. - Allows custom penalties for obstacles to be set in openttd.cfg (npf_ values). - With NPF enabled, ships can have orders that are very far apart. Be careful, this will break (ships get lost) when the old pathfinder is used again. - Feature: Disabling 90 degree turns for trains and ships. - Requires NPF to be enabled. - Ships and trains can no longer make weird 90 degree turns on tile borders. - Codechange: Removed table/directions.h. - table/directions.h contained ugly static tables but was included more than once. The tables, along with a few new ones are in npf.[ch] now. Better suggestions for a location? - Fix: Binary heap in queue.c did not allocate enough space, resulting in a segfault. - Codechange: Rewritten FindFirstBit2x64, added KillFirstBit2x64. - Codechange: Introduced constant INVALID_TILE, to replace the usage of 0 as an invalid tile. Also replaces TILE_WRAPPED. - Codechange: Moved TileAddWrap() to map.[ch] - Add TileIndexDiffCByDir(), TileIndexDiffCByDir(). - Codechange: Moved IsTrainStationTile() to station.h - Add: IsRoadStationTile() and GetRoadStationDir().
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 19194ac86..71f015bdb 100644
--- a/macros.h
+++ b/macros.h
@@ -110,14 +110,32 @@ extern const byte _ffb_64[128];
static inline int FindFirstBit2x64(int value)
{
+/*
int i = 0;
if ( (byte) value == 0) {
i += 8;
value >>= 8;
}
return i + FIND_FIRST_BIT(value & 0x3F);
+
+Faster ( or at least cleaner ) implementation below?
+*/
+ if ( (byte) value == 0) {
+ return FIND_FIRST_BIT((value >> 8) & 0x3F) + 8;
+ } else {
+ return FIND_FIRST_BIT(value & 0x3F);
+ }
+
}
+static inline int KillFirstBit2x64(int value)
+{
+ if ( (byte) value == 0) {
+ return KILL_FIRST_BIT((value >> 8) & 0x3F) << 8;
+ } else {
+ return value & (KILL_FIRST_BIT(value & 0x3F)|0x3F00);
+ }
+}
/* [min,max), strictly less than */
#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))