Skip to content

Commit

Permalink
0
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Jan 21, 2024
1 parent 5c46132 commit 0965b4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
24 changes: 13 additions & 11 deletions src/Ext/RadSite/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ DEFINE_HOOK(0x5213B4, InfantryClass_AIDeployment_CheckRad, 0x7)
auto const pWeapon = pInf->GetDeployWeapon()->WeaponType;
int radLevel = 0;

if (RadSiteExt::ExtMap.size() > 0 && pWeapon)
if (RadSiteClass::Array->Count && pWeapon)
{
auto const pWeaponExt = WeaponTypeExt::ExtMap.Find(pWeapon);
auto const pRadType = pWeaponExt->RadType;
auto const warhead = pWeapon->Warhead;
auto currentCoord = pInf->GetCell()->MapCoords;

auto const it = std::find_if(RadSiteExt::ExtMap.begin(), RadSiteExt::ExtMap.end(),
[=](std::pair<RadSiteClass* const, RadSiteExt::ExtData* const> const& pair)
auto const it = std::find_if(RadSiteClass::Array->begin(), RadSiteClass::Array->end(),
[=](RadSiteClass* const rad)
{
auto const radExt = RadSiteExt::ExtMap.Find(rad);
return
pair.second->Type == pRadType &&
pair.first->BaseCell == currentCoord &&
pair.first->Spread == Game::F2I(warhead->CellSpread)
radExt->Type == pRadType &&
rad->BaseCell == currentCoord &&
rad->Spread == Game::F2I(warhead->CellSpread)
;
});

if (it != RadSiteExt::ExtMap.end())
if (it != RadSiteClass::Array->end())
{
//auto pRadExt = it->second;
auto pRadSite = it->first;
auto pRadSite = *it;
radLevel = pRadSite->GetRadLevel();
}
}
Expand Down Expand Up @@ -138,8 +138,9 @@ DEFINE_HOOK(0x43FB23, BuildingClass_AI_Radiation, 0x5)
{
CellStruct nCurrentCoord = buildingCoords + *pFoundation;

for (auto& [pRadSite, pRadExt] : RadSiteExt::ExtMap)
for (auto const pRadSite : *RadSiteClass::Array)
{
auto pRadExt = RadSiteExt::ExtMap.Find(pRadSite);
RadTypeClass* pType = pRadExt->Type;

// Check the distance, if not in range, just skip this one
Expand Down Expand Up @@ -190,8 +191,9 @@ DEFINE_HOOK(0x4DA59F, FootClass_AI_Radiation, 0x5)
CellStruct CurrentCoord = pFoot->GetCell()->MapCoords;

// Loop for each different radiation stored in the RadSites container
for (auto& [pRadSite, pRadExt] : RadSiteExt::ExtMap)
for (auto const pRadSite : *RadSiteClass::Array)
{
auto pRadExt = RadSiteExt::ExtMap.Find(pRadSite);
// Check the distance, if not in range, just skip this one
double orDistance = pRadSite->BaseCell.DistanceFrom(CurrentCoord);

Expand Down
8 changes: 1 addition & 7 deletions src/Phobos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ const char* Phobos::AppIconPath = nullptr;
bool Phobos::DisplayDamageNumbers = false;
bool Phobos::IsLoadingSaveGame = false;

#ifdef STR_GIT_COMMIT
const wchar_t* Phobos::VersionDescription = L"Phobos nightly build (" STR_GIT_COMMIT L" @ " STR_GIT_BRANCH L"). DO NOT SHIP IN MODS!";
#elif !defined(IS_RELEASE_VER)
const wchar_t* Phobos::VersionDescription = L"Phobos development build #" _STR(BUILD_NUMBER) L". Please test the build before shipping.";
#else
//const wchar_t* Phobos::VersionDescription = L"Phobos release build v" FILE_VERSION_STR L".";
#endif
const wchar_t* Phobos::VersionDescription = L"\u57fa\u4e8eb38\u6d4b\u8bd5\u8f90\u5c04RE\u539f\u56e0";


void Phobos::CmdLineParse(char** ppArgs, int nNumArgs)
Expand Down

0 comments on commit 0965b4f

Please sign in to comment.