Merge branch 'newui' of https://github.com/nullworks/cathook into newui

This commit is contained in:
LightCat 2018-08-25 19:52:33 +02:00
commit 78c5b743f4
2 changed files with 9 additions and 6 deletions

View File

@ -25,7 +25,7 @@ bool Prepare();
void CreateMove(); void CreateMove();
void Draw(); void Draw();
size_t FindInVector(size_t id); int FindInVector(size_t id);
class inactivityTracker class inactivityTracker
{ {
@ -131,8 +131,8 @@ public:
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || if (CE_BAD(ent) ||
ent->m_iClassID() != CL_CLASS(CObjectSentrygun) /*|| ent->m_iClassID() != CL_CLASS(CObjectSentrygun) ||
ent->m_iTeam() == LOCAL_E->m_iTeam()*/) ent->m_iTeam() == LOCAL_E->m_iTeam())
continue; continue;
Vector sentryloc = GetBuildingPosition(ent); Vector sentryloc = GetBuildingPosition(ent);
sentries.push_back(sentryloc); sentries.push_back(sentryloc);
@ -303,9 +303,12 @@ struct MAP : public micropather::Graph
if (inactiveTracker.IsIgnored( if (inactiveTracker.IsIgnored(
std::pair{ area->m_id, i.area->m_id })) std::pair{ area->m_id, i.area->m_id }))
continue; continue;
int id = FindInVector(i.area->m_id);
if (id == -1)
return;
micropather::StateCost cost; micropather::StateCost cost;
cost.state = cost.state =
static_cast<void *>(&areas.at(FindInVector(i.area->m_id))); static_cast<void *>(&areas.at(id));
cost.cost = area->m_center.DistTo(i.area->m_center); cost.cost = area->m_center.DistTo(i.area->m_center);
adjacent->push_back(cost); adjacent->push_back(cost);
} }

View File

@ -17,9 +17,9 @@ static std::unique_ptr<MAP> TF2MAP;
// Function to get place in Vector by connection ID // Function to get place in Vector by connection ID
// Todo: find an alternative for this, maybe a map for storing ptrs to the // Todo: find an alternative for this, maybe a map for storing ptrs to the
// std::vector? // std::vector?
size_t FindInVector(size_t id) int FindInVector(size_t id)
{ {
for (size_t i = 0; i < areas.size(); i++) for (int i = 0; i < areas.size(); i++)
{ {
if (areas.at(i).m_id == id) if (areas.at(i).m_id == id)
return i; return i;