Skip to content

Commit

Permalink
fixed mapbased kp
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Mar 21, 2024
1 parent b125261 commit c9a2f4d
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions killproof_me/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace {

bool lastFrameShow = false;
bool initFailed = false;

bool mumbleReloadMapPending = false;
}

BOOL APIENTRY DllMain(HMODULE pModule,
Expand Down Expand Up @@ -82,6 +84,23 @@ uintptr_t mod_imgui(uint32_t not_charsel_or_loading) {
loadAllKillproofs();
}
lastFrameShow = showKillproof;

if (mumbleReloadMapPending) {
mumbleReloadMapPending = false;
if (mapViewOfMumbleFile) {
LinkedMem* linkedMem = static_cast<LinkedMem*>(mapViewOfMumbleFile);
uint32_t mapId = linkedMem->getMumbleContext()->mapId;

ARC_LOG(std::format("current mapId: {}", mapId).c_str());

const auto& setup = mapIdToColumnSetup.find(mapId);
if (setup == mapIdToColumnSetup.end()) {
KillproofUI::instance().GetTable()->ResetSpecificColumnSetup();
} else {
KillproofUI::instance().GetTable()->SetSpecificColumnSetup(setup->second);
}
}
}
}

#if PERFORMANCE_LOG
Expand Down Expand Up @@ -357,17 +376,7 @@ uintptr_t mod_combat_local(cbtevent* ev, ag* src, ag* dst, const char* skillname
if (dst->self) {
ARC_LOG("self added!");

if (mapViewOfMumbleFile) {
LinkedMem* linkedMem = static_cast<LinkedMem*>(mapViewOfMumbleFile);
uint32_t mapId = linkedMem->getMumbleContext()->mapId;

const auto& setup = mapIdToColumnSetup.find(mapId);
if (setup == mapIdToColumnSetup.end()) {
KillproofUI::instance().GetTable()->ResetSpecificColumnSetup();
} else {
KillproofUI::instance().GetTable()->SetSpecificColumnSetup(setup->second);
}
}
mumbleReloadMapPending = true;
}
}
}
Expand Down

0 comments on commit c9a2f4d

Please sign in to comment.