summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-05-23 19:00:16 +0000
committermatthijs <matthijs@openttd.org>2005-05-23 19:00:16 +0000
commita2f691b24ae9de208fa997ac5766c59cc26dd7fa (patch)
treeb3cb09e2076d5931bdacfa8040e1bdb1314d8e01
parent5e040110fc7ef481caa536e8fe183bda2b5f4314 (diff)
downloadopenttd-a2f691b24ae9de208fa997ac5766c59cc26dd7fa.tar.xz
(svn r2363) - Codechange: [NPF] Removed caching the endnode check. The code for this was buggy, fundamentally flawed and barely useful. (Hackykid)
-rw-r--r--npf.c8
-rw-r--r--npf.h7
-rw-r--r--order_gui.c2
3 files changed, 1 insertions, 16 deletions
diff --git a/npf.c b/npf.c
index c63c0f3fc..fd331ae96 100644
--- a/npf.c
+++ b/npf.c
@@ -443,22 +443,14 @@ int32 NPFFindStationOrTile(AyStar* as, OpenListNode *current) {
AyStarNode *node = &current->path.node;
TileIndex tile = node->tile;
- /* See if we checked this before */
- if (NPFGetFlag(node, NPF_FLAG_TARGET_CHECKED))
- return NPFGetFlag(node, NPF_FLAG_IS_TARGET);
- /* We're gonna check this now and store the result, let's mark that */
- NPFSetFlag(node, NPF_FLAG_TARGET_CHECKED, true);
-
/* If GetNeighbours said we could get here, we assume the station type
* is correct */
if (
(fstd->station_index == -1 && tile == fstd->dest_coords) || /* We've found the tile, or */
(IsTileType(tile, MP_STATION) && _map2[tile] == fstd->station_index) /* the station */
) {
- NPFSetFlag(node, NPF_FLAG_TARGET_CHECKED, true);
return AYSTAR_FOUND_END_NODE;
} else {
- NPFSetFlag(node, NPF_FLAG_TARGET_CHECKED, false);
return AYSTAR_DONE;
}
}
diff --git a/npf.h b/npf.h
index 9c290d360..a065797b3 100644
--- a/npf.h
+++ b/npf.h
@@ -43,13 +43,6 @@ typedef enum { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit()
NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */
NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */
NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */
- NPF_FLAG_TARGET_CHECKED, /* Used by end node checking function of npf to mark
- that they have evaluated this node. When this
- flag is on, NPF_FLAG_IS_TARGET is on when the
- node is a target, and off when it is not. Should
- never be used directly, only by the end node
- checking functions for caching of results. */
- NPF_FLAG_IS_TARGET, /* See comment for NPF_FLAG_TARGET_CHECKED */
} NPFNodeFlag;
typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
diff --git a/order_gui.c b/order_gui.c
index 9ec762475..966a84839 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -52,7 +52,7 @@ static void DrawOrdersWindow(Window *w)
shared_orders = IsOrderListShared(v);
- if ((uint)v->num_orders + shared_orders <= (uint)WP(w,order_d).sel)
+ if ((uint)v->num_orders + (shared_orders?1:0) <= (uint)WP(w,order_d).sel)
SETBIT(w->disabled_state, 5); /* delete */
if (v->num_orders == 0)