format codebase

This commit is contained in:
aronwk-aaron
2022-07-28 08:39:57 -05:00
parent 4f7aa11067
commit 19e77a38d8
881 changed files with 34700 additions and 38689 deletions

View File

@@ -4,79 +4,65 @@
#include "Spawner.h"
#include "RebuildComponent.h"
void FvBrickPuzzleServer::OnStartup(Entity* self)
{
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
void FvBrickPuzzleServer::OnStartup(Entity* self) {
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
int32_t pipeNum = 0;
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum))
{
return;
}
int32_t pipeNum = 0;
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
return;
}
if (pipeNum != 1)
{
self->AddTimer("reset", 30);
}
if (pipeNum != 1) {
self->AddTimer("reset", 30);
}
}
void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer)
{
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
void FvBrickPuzzleServer::OnDie(Entity* self, Entity* killer) {
const auto myGroup = GeneralUtils::UTF16ToWTF8(self->GetVar<std::u16string>(u"spawner_name"));
int32_t pipeNum = 0;
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum))
{
return;
}
int32_t pipeNum = 0;
if (!GeneralUtils::TryParse<int32_t>(myGroup.substr(10, 1), pipeNum)) {
return;
}
const auto pipeGroup = myGroup.substr(0, 10);
const auto pipeGroup = myGroup.substr(0, 10);
const auto nextPipeNum = pipeNum + 1;
const auto nextPipeNum = pipeNum + 1;
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
const auto samePipeSpawners = dZoneManager::Instance()->GetSpawnersByName(myGroup);
if (!samePipeSpawners.empty())
{
samePipeSpawners[0]->SoftReset();
if (!samePipeSpawners.empty()) {
samePipeSpawners[0]->SoftReset();
samePipeSpawners[0]->Deactivate();
}
samePipeSpawners[0]->Deactivate();
}
if (killer != nullptr && killer->IsPlayer())
{
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
if (killer != nullptr && killer->IsPlayer()) {
const auto nextPipe = pipeGroup + std::to_string(nextPipeNum);
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
const auto nextPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
if (!nextPipeSpawners.empty())
{
nextPipeSpawners[0]->Activate();
}
}
else
{
const auto nextPipe = pipeGroup + "1";
if (!nextPipeSpawners.empty()) {
nextPipeSpawners[0]->Activate();
}
} else {
const auto nextPipe = pipeGroup + "1";
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
const auto firstPipeSpawners = dZoneManager::Instance()->GetSpawnersByName(nextPipe);
if (!firstPipeSpawners.empty()) {
firstPipeSpawners[0]->Activate();
}
}
if (!firstPipeSpawners.empty())
{
firstPipeSpawners[0]->Activate();
}
}
}
void FvBrickPuzzleServer::OnTimerDone(Entity* self, std::string timerName)
{
if (timerName == "reset")
{
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
void FvBrickPuzzleServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "reset") {
auto* rebuildComponent = self->GetComponent<RebuildComponent>();
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_OPEN)
{
self->Smash(self->GetObjectID(), SILENT);
}
}
if (rebuildComponent != nullptr && rebuildComponent->GetState() == REBUILD_OPEN) {
self->Smash(self->GetObjectID(), SILENT);
}
}
}