chore: Eradicate C-style casts and further clean up some code (#1361)

* cast and code cleanup

* cast cleanup

* bug fixes and improvements

* no getBoolField method exists

* fixes

* unbroke sg cannon scoring

* removing comments

* Remove the c-style cast warning I added from CMakeLists now that they're gone (it triggers on 3rd party dependencies and slows down compilation)

* (Hopefully) fix MacOS compilation error

* partially-implemented feedback

* more updates to account for feedback

* change bool default

---------

Co-authored-by: jadebenn <jonahebenn@yahoo.com>
This commit is contained in:
jadebenn
2023-12-27 22:18:20 -06:00
committed by GitHub
parent 46ac039a3b
commit ef6f2f133e
68 changed files with 281 additions and 270 deletions

View File

@@ -53,9 +53,9 @@ void NjMonastryBossInstance::OnPlayerLoaded(Entity* self, Entity* player) {
// Buff the player
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
if (destroyableComponent != nullptr) {
destroyableComponent->SetHealth((int32_t)destroyableComponent->GetMaxHealth());
destroyableComponent->SetArmor((int32_t)destroyableComponent->GetMaxArmor());
destroyableComponent->SetImagination((int32_t)destroyableComponent->GetMaxImagination());
destroyableComponent->SetHealth(static_cast<int32_t>(destroyableComponent->GetMaxHealth()));
destroyableComponent->SetArmor(static_cast<int32_t>(destroyableComponent->GetMaxArmor()));
destroyableComponent->SetImagination(static_cast<int32_t>(destroyableComponent->GetMaxImagination()));
}
// Add player ID to instance
@@ -117,7 +117,7 @@ void NjMonastryBossInstance::OnPlayerExit(Entity* self, Entity* player) {
void NjMonastryBossInstance::OnActivityTimerDone(Entity* self, const std::string& name) {
auto split = GeneralUtils::SplitString(name, TimerSplitChar);
auto timerName = split[0];
auto objectID = split.size() > 1 ? (LWOOBJID)std::stoull(split[1]) : LWOOBJID_EMPTY;
auto objectID = split.size() > 1 ? static_cast<LWOOBJID>(std::stoull(split[1])) : LWOOBJID_EMPTY;
if (timerName == WaitingForPlayersTimer) {
StartFight(self);
@@ -309,7 +309,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* low
if (destroyableComponent != nullptr) {
const auto doubleHealth = destroyableComponent->GetHealth() * 2;
destroyableComponent->SetHealth(doubleHealth);
destroyableComponent->SetMaxHealth((float_t)doubleHealth);
destroyableComponent->SetMaxHealth(static_cast<float_t>(doubleHealth));
}
ActivityTimerStart(self, FrakjawSpawnInTimer + std::to_string(lowerFrakjaw->GetObjectID()),
@@ -328,7 +328,7 @@ void NjMonastryBossInstance::HandleLowerFrakjawHit(Entity* self, Entity* lowerFr
return;
// Progress the fight to the last wave if frakjaw has less than 50% of his health left
if (destroyableComponent->GetHealth() <= (uint32_t)destroyableComponent->GetMaxHealth() / 2 && !self->GetVar<bool>(OnLastWaveVarbiale)) {
if (destroyableComponent->GetHealth() <= static_cast<uint32_t>(destroyableComponent->GetMaxHealth()) / 2 && !self->GetVar<bool>(OnLastWaveVarbiale)) {
self->SetVar<bool>(OnLastWaveVarbiale, true);
// Stun frakjaw during the cinematic