diff --git a/engine/server/sv_move.c b/engine/server/sv_move.c index 9c9698b5f..7dbef3f9e 100644 --- a/engine/server/sv_move.c +++ b/engine/server/sv_move.c @@ -867,7 +867,13 @@ void Route_Calculated(void *ctx, void *data, size_t a, size_t b) //#define FLOODALL #define COST_INFINITE FLT_MAX -static qboolean Route_Completed(struct routecalc_s *r, int *nodecamefrom) +typedef struct +{ + int id; + int flags; +} nodefrom_t; + +static qboolean Route_Completed(struct routecalc_s *r, nodefrom_t *nodecamefrom) { size_t u; struct waypointnetwork_s *n = r->waynet; @@ -884,11 +890,11 @@ static qboolean Route_Completed(struct routecalc_s *r, int *nodecamefrom) for (;;) { VectorCopy(n->waypoints[u].org, r->resultnodes[r->numresultnodes].pos); - r->resultnodes[r->numresultnodes].linkflags = 0; + r->resultnodes[r->numresultnodes].linkflags = nodecamefrom[u].flags; r->numresultnodes++; if (u == r->startn) break; - u = nodecamefrom[u]; + u = nodecamefrom[u].id; } //and include the start point, because we can @@ -918,7 +924,7 @@ static qboolean Route_Process(struct routecalc_s *r) float cost; } *open = alloca(sizeof(*open)*n->numwaypoints); float *nodecost = alloca(sizeof(*nodecost)*n->numwaypoints); - int *nodecamefrom = alloca(sizeof(*nodecamefrom)*n->numwaypoints); + nodefrom_t *nodecamefrom = alloca(sizeof(*nodecamefrom)*n->numwaypoints); for(u = 0; u < n->numwaypoints; u++) nodecost[u] = COST_INFINITE; @@ -962,7 +968,8 @@ static qboolean Route_Process(struct routecalc_s *r) if (realcost >= nodecost[linkidx]) continue; - nodecamefrom[linkidx] = nodeidx; + nodecamefrom[linkidx].id = nodeidx; + nodecamefrom[linkidx].flags = l->linkflags; nodecost[linkidx] = realcost; for (j = opennodes-1; j >= 0; j--) @@ -1009,7 +1016,7 @@ static qboolean Route_Process(struct routecalc_s *r) //we use an open list in a desperate attempt to avoid recursing the entire network int *open = alloca(sizeof(*open)*n->numwaypoints); float *nodecost = alloca(sizeof(*nodecost)*n->numwaypoints); - int *nodecamefrom = alloca(sizeof(*nodecamefrom)*n->numwaypoints); + nodefrom_t *nodecamefrom = alloca(sizeof(*nodecamefrom)*n->numwaypoints); for(u = 0; u < n->numwaypoints; u++) nodecost[u] = COST_INFINITE; @@ -1035,7 +1042,8 @@ static qboolean Route_Process(struct routecalc_s *r) if (realcost >= nodecost[linkidx]) continue; - nodecamefrom[linkidx] = nodeidx; + nodecamefrom[linkidx].id = nodeidx; + nodecamefrom[linkidx].flags = l->linkflags; nodecost[linkidx] = realcost; for (j = 0; j < opennodes; j++)