Routing: We forgot to pass the linkflags a way-file may define, fixed that
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5796 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f152acaa12
commit
a98bd4eaf6
1 changed files with 15 additions and 7 deletions
|
@ -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++)
|
||||
|
|
Loading…
Reference in a new issue