Skip to content

Commit

Permalink
xrAI: Fix conformance in For loop scope (#104).
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Jan 15, 2016
1 parent b282c63 commit a934e66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils/xrAI/xr_graph_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ class CLevelGameGraph {
IReader *F = FS.r_open(fName);
u32 id;
IReader *O = F->open_chunk_iterator(id);
for (int i=0; O; O = F->open_chunk_iterator(id,O)) {
int vertexId = 0;
for (; O; O = F->open_chunk_iterator(id, O))
{
NET_Packet P;
P.B.count = O->length();
O->r (P.B.data,P.B.count);
Expand Down Expand Up @@ -233,9 +235,9 @@ class CLevelGameGraph {
S = xr_strdup(tpGraphPoint->name_replace());
T.caConnectName = xr_strdup(*tpGraphPoint->m_caConnectionPointName);
T.dwLevelID = dwfGetIDByLevelName(Ini,*tpGraphPoint->m_caConnectionLevelName);
// T.tGraphID = (GameGraph::_GRAPH_ID)i;
// T.tGraphID = (GameGraph::_GRAPH_ID)vertexId;
// T.tOldGraphID = tGraphID;
T.tOldGraphID = (GameGraph::_GRAPH_ID)i;
T.tOldGraphID = (GameGraph::_GRAPH_ID)vertexId;
T.tGraphID = tGraphID;

bool ok = true;
Expand All @@ -250,22 +252,23 @@ class CLevelGameGraph {

if (ok) {
m_tVertexMap.insert (mk_pair(S,T));
i++;
vertexId++;
}
}
}
F_entity_Destroy (E);
}
if (i != m_tpGraph->header().vertex_count())
Msg ("Graph for the level %s doesn't correspond to the graph points from Level Editor! (%d : %d)",*m_tLevel.name(),i,m_tpGraph->header().vertex_count());
if (vertexId!=m_tpGraph->header().vertex_count())
Msg("Graph for the level %s doesn't correspond to the graph points from Level Editor! (%d : %d)",
*m_tLevel.name(), vertexId, m_tpGraph->header().vertex_count());

VERTEX_MAP::const_iterator I = m_tVertexMap.begin();
VERTEX_MAP::const_iterator E = m_tVertexMap.end();
for ( ; I != E; ++I) {
R_ASSERT3 (!xr_strlen((*I).second.caConnectName) || ((*I).second.tGraphID < m_tpVertices.size()),"Rebuild graph for the level",*m_tLevel.name());
}

// VERIFY3 (i == m_tpGraph->header().vertex_count(), "Rebuild graph for the level ",m_tLevel.name());
// VERIFY3(vertexId==m_tpGraph->header().vertex_count(), "Rebuild graph for the level ",m_tLevel.name());
O->close ();
FS.r_close (F);
}
Expand Down
1 change: 1 addition & 0 deletions src/xrAICore/Navigation/vertex_path_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ TEMPLATE_SPECIALIZATION
inline void CVertexPathBuilder::get_node_path(xr_vector<Index> &path, Vertex *best)
{
Vertex *t1 = best, *t2 = best->back();
u32 i;
for (u32 i = 1; t2; t1 = t2, t2 = t2->back(), i++);
path.resize(i);
t1 = best;
Expand Down

0 comments on commit a934e66

Please sign in to comment.