Skip to content

Commit 376e015

Browse files
committed
WIP of xrAI and xrSE_Factory. Fix Debug crash. Fix some strange things.
1 parent d58139f commit 376e015

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/utils/xrAI/compiler_cover.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,14 @@ void compute_non_covers()
516516

517517
float cumulative_weight = 0.f;
518518
{
519-
COVERS::const_iterator i = nearest.begin();
520-
COVERS::const_iterator e = nearest.end();
521-
for (; i != e; ++i)
519+
for (auto &i : nearest)
522520
{
523-
if (!vertex_in_direction(u32(I - B), (*i)->level_vertex_id()))
521+
if (!vertex_in_direction(u32(I - B), i->level_vertex_id()))
524522
continue;
525523

526-
float weight = 1.f / (*i)->position().distance_to((*I).Pos);
524+
float weight = 1.f / i->position().distance_to((*I).Pos);
527525
cumulative_weight += weight;
528-
cover_pairs.push_back(std::make_pair(weight, *i));
526+
cover_pairs.push_back(std::make_pair(weight, i));
529527
}
530528
}
531529

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

555-
COVER_PAIRS::const_iterator i = cover_pairs.begin();
556-
COVER_PAIRS::const_iterator e = cover_pairs.end();
557-
for (; i != e; ++i)
553+
for (auto &i : cover_pairs)
558554
{
559-
vertex& current = g_nodes[(*i).second->level_vertex_id()];
560-
float factor = (*i).first / cumulative_weight;
555+
vertex& current = g_nodes[i.second->level_vertex_id()];
556+
float factor = i.first / cumulative_weight;
561557
for (int j = 0; j < 4; ++j)
562558
{
563559
(*I).high_cover[j] += factor * current.high_cover[j];
564560
(*I).low_cover[j] += factor * current.low_cover[j];
565561
}
566562
}
567563

568-
for (int i2 = 0; i2 < 4; ++i)
564+
for (int i2 = 0; i2 < 4; ++i2)
569565
{
570566
clamp((*I).high_cover[i2], 0.f, 1.f);
571567
clamp((*I).low_cover[i2], 0.f, 1.f);

src/utils/xrSE_Factory/xrSE_Factory.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ BOOL APIENTRY DllMain(HANDLE module_handle, DWORD call_reason, LPVOID reserved)
5050
case DLL_PROCESS_ATTACH:
5151
{
5252
//g_temporary_stuff = &trivial_encryptor::decode;
53-
xrDebug::Initialize(false);
54-
Core.Initialize("xrSE_Factory", nullptr, true, "fsfactory.ltx");
53+
//xrDebug::Initialize(false);
54+
//Core.Initialize("xrSE_Factory", nullptr, true, "fsfactory.ltx");
5555
string_path SYSTEM_LTX;
5656
FS.update_path(SYSTEM_LTX, "$game_config$", "system.ltx");
5757
pSettings = new CInifile(SYSTEM_LTX);
@@ -76,7 +76,7 @@ BOOL APIENTRY DllMain(HANDLE module_handle, DWORD call_reason, LPVOID reserved)
7676
xr_delete(g_object_factory);
7777
if (prop_helper_module)
7878
prop_helper_module->close();
79-
Core._destroy();
79+
//Core._destroy();
8080
break;
8181
}
8282
}

0 commit comments

Comments
 (0)