Skip to content

Commit

Permalink
WIP of xrAI and xrSE_Factory. Fix Debug crash. Fix some strange things.
Browse files Browse the repository at this point in the history
  • Loading branch information
intorr committed Dec 30, 2017
1 parent d58139f commit 376e015
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
20 changes: 8 additions & 12 deletions src/utils/xrAI/compiler_cover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,14 @@ void compute_non_covers()

float cumulative_weight = 0.f;
{
COVERS::const_iterator i = nearest.begin();
COVERS::const_iterator e = nearest.end();
for (; i != e; ++i)
for (auto &i : nearest)
{
if (!vertex_in_direction(u32(I - B), (*i)->level_vertex_id()))
if (!vertex_in_direction(u32(I - B), i->level_vertex_id()))
continue;

float weight = 1.f / (*i)->position().distance_to((*I).Pos);
float weight = 1.f / i->position().distance_to((*I).Pos);
cumulative_weight += weight;
cover_pairs.push_back(std::make_pair(weight, *i));
cover_pairs.push_back(std::make_pair(weight, i));
}
}

Expand All @@ -552,20 +550,18 @@ void compute_non_covers()
(*I).low_cover[j] = 0.f;
}

COVER_PAIRS::const_iterator i = cover_pairs.begin();
COVER_PAIRS::const_iterator e = cover_pairs.end();
for (; i != e; ++i)
for (auto &i : cover_pairs)
{
vertex& current = g_nodes[(*i).second->level_vertex_id()];
float factor = (*i).first / cumulative_weight;
vertex& current = g_nodes[i.second->level_vertex_id()];
float factor = i.first / cumulative_weight;
for (int j = 0; j < 4; ++j)
{
(*I).high_cover[j] += factor * current.high_cover[j];
(*I).low_cover[j] += factor * current.low_cover[j];
}
}

for (int i2 = 0; i2 < 4; ++i)
for (int i2 = 0; i2 < 4; ++i2)
{
clamp((*I).high_cover[i2], 0.f, 1.f);
clamp((*I).low_cover[i2], 0.f, 1.f);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/xrSE_Factory/xrSE_Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ BOOL APIENTRY DllMain(HANDLE module_handle, DWORD call_reason, LPVOID reserved)
case DLL_PROCESS_ATTACH:
{
//g_temporary_stuff = &trivial_encryptor::decode;
xrDebug::Initialize(false);
Core.Initialize("xrSE_Factory", nullptr, true, "fsfactory.ltx");
//xrDebug::Initialize(false);
//Core.Initialize("xrSE_Factory", nullptr, true, "fsfactory.ltx");
string_path SYSTEM_LTX;
FS.update_path(SYSTEM_LTX, "$game_config$", "system.ltx");
pSettings = new CInifile(SYSTEM_LTX);
Expand All @@ -76,7 +76,7 @@ BOOL APIENTRY DllMain(HANDLE module_handle, DWORD call_reason, LPVOID reserved)
xr_delete(g_object_factory);
if (prop_helper_module)
prop_helper_module->close();
Core._destroy();
//Core._destroy();
break;
}
}
Expand Down

0 comments on commit 376e015

Please sign in to comment.