Fix whitespace

Convert to tabs and remove trailing whitespace
This commit is contained in:
TheMatt2
2022-01-15 14:02:14 -05:00
parent 4ff84e0730
commit 9dfa401b27
8 changed files with 108 additions and 108 deletions

View File

@@ -105,7 +105,7 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
outBitStream->Write0(); //Contains info about immunities this object has, but it's left out for now.
}
outBitStream->Write(m_DirtyHealth || bIsInitialUpdate);
outBitStream->Write(m_DirtyHealth || bIsInitialUpdate);
if (m_DirtyHealth || bIsInitialUpdate) {
outBitStream->Write(m_iHealth);
outBitStream->Write(m_fMaxHealth);
@@ -113,12 +113,12 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
outBitStream->Write(m_fMaxArmor);
outBitStream->Write(m_iImagination);
outBitStream->Write(m_fMaxImagination);
outBitStream->Write(m_DamageToAbsorb);
outBitStream->Write(IsImmune());
outBitStream->Write(m_IsGMImmune);
outBitStream->Write(m_IsShielded);
outBitStream->Write(m_fMaxHealth);
outBitStream->Write(m_fMaxArmor);
outBitStream->Write(m_fMaxImagination);
@@ -129,14 +129,14 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
}
outBitStream->Write(m_IsSmashable);
if (bIsInitialUpdate) {
outBitStream->Write(m_IsDead);
outBitStream->Write(m_IsSmashed);
if (m_IsSmashable) {
outBitStream->Write(m_HasBricks);
if (m_ExplodeFactor != 1.0f) {
outBitStream->Write1();
outBitStream->Write(m_ExplodeFactor);
@@ -145,10 +145,10 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
}
}
}
m_DirtyHealth = false;
}
if (m_DirtyThreatList || bIsInitialUpdate) {
outBitStream->Write1();
outBitStream->Write(m_HasThreats);
@@ -166,7 +166,7 @@ void DestroyableComponent::LoadFromXML(tinyxml2::XMLDocument* doc) {
}
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
if (buffComponent != nullptr) {
buffComponent->LoadFromXML(doc);
}
@@ -186,9 +186,9 @@ void DestroyableComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
Game::logger->Log("DestroyableComponent", "Failed to find dest tag!\n");
return;
}
auto* buffComponent = m_Parent->GetComponent<BuffComponent>();
if (buffComponent != nullptr) {
buffComponent->UpdateXml(doc);
}
@@ -233,7 +233,7 @@ void DestroyableComponent::SetMaxHealth(float value, bool playAnim) {
args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount;
delete type;
}
@@ -279,7 +279,7 @@ void DestroyableComponent::SetMaxArmor(float value, bool playAnim) {
args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount;
delete type;
}
@@ -325,7 +325,7 @@ void DestroyableComponent::SetMaxImagination(float value, bool playAnim) {
args.InsertValue("type", type);
GameMessages::SendUIMessageServerToSingleClient(m_Parent, m_Parent->GetParentUser()->GetSystemAddress(), "MaxPlayerBarUpdate", &args);
delete amount;
delete type;
}
@@ -340,7 +340,7 @@ void DestroyableComponent::SetDamageToAbsorb(int32_t value)
m_DamageToAbsorb = value;
}
void DestroyableComponent::SetDamageReduction(int32_t value)
void DestroyableComponent::SetDamageReduction(int32_t value)
{
m_DirtyHealth = true;
m_DamageReduction = value;
@@ -352,7 +352,7 @@ void DestroyableComponent::SetIsImmune(bool value)
m_ImmuneStacks = value ? 1 : 0;
}
void DestroyableComponent::SetIsGMImmune(bool value)
void DestroyableComponent::SetIsGMImmune(bool value)
{
m_DirtyHealth = true;
m_IsGMImmune = value;
@@ -375,7 +375,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT enemyList FROM Factions WHERE faction = ?;");
query.bind(1, (int) factionID);
query.bind(1, (int) factionID);
auto result = query.execQuery();
@@ -387,10 +387,10 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
std::stringstream ss(list_string);
std::string token;
while (std::getline(ss, token, ',')) {
if (token.empty()) continue;
auto id = std::stoi(token);
auto exclude = std::find(m_FactionIDs.begin(), m_FactionIDs.end(), id) != m_FactionIDs.end();
@@ -404,7 +404,7 @@ void DestroyableComponent::AddFaction(const int32_t factionID, const bool ignore
{
continue;
}
AddEnemyFaction(id);
}
@@ -521,7 +521,7 @@ bool DestroyableComponent::CheckValidity(const LWOOBJID target, const bool ignor
if (quickbuild != nullptr)
{
const auto state = quickbuild->GetState();
if (state != REBUILD_COMPLETED)
{
return false;
@@ -568,7 +568,7 @@ void DestroyableComponent::Imagine(const int32_t deltaImagination)
{
auto current = static_cast<int32_t>(GetImagination());
const auto max = static_cast<int32_t>(GetMaxImagination());
current += deltaImagination;
current = std::min(current, max);
@@ -641,7 +641,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
damage -= absorbDamage;
absorb -= absorbDamage;
const auto armorDamage = std::min(damage, armor);
damage -= armorDamage;
@@ -663,7 +663,7 @@ void DestroyableComponent::Damage(uint32_t damage, const LWOOBJID source, bool e
{
EntityManager::Instance()->SerializeEntity(m_Parent);
}
auto* attacker = EntityManager::Instance()->GetEntity(source);
m_Parent->OnHit(attacker);
m_Parent->OnHitOrHealResult(attacker, sourceDamage);
@@ -741,7 +741,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
}
}
}
const auto isPlayer = m_Parent->IsPlayer();
GameMessages::SendDie(
@@ -783,14 +783,14 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
auto* member = EntityManager::Instance()->GetEntity(specificOwner);
if (member) LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
}
}
else {
for (const auto memberId : team->members) { // Free for all
auto* member = EntityManager::Instance()->GetEntity(memberId);
if (member == nullptr) continue;
LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
LootGenerator::Instance().DropLoot(member, m_Parent, lootMatrixId, GetMinCoins(), GetMaxCoins());
}
}
}
@@ -821,7 +821,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
}
coinsTotal -= coinsToLoose;
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
}
@@ -862,7 +862,7 @@ void DestroyableComponent::PopImmunity(int32_t stacks)
m_ImmuneStacks -= stacks;
}
void DestroyableComponent::FixStats()
void DestroyableComponent::FixStats()
{
auto* entity = GetParent();
@@ -920,7 +920,7 @@ void DestroyableComponent::FixStats()
// Add the stats
const auto& info = mission->GetClientInfo();
maxHealth += info.reward_maxhealth;
maxImagination += info.reward_maximagination;
}

View File

@@ -19,11 +19,11 @@
RocketLaunchpadControlComponent::RocketLaunchpadControlComponent(Entity* parent, int rocketId) : Component(parent) {
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;");
"SELECT targetZone, defaultZoneID, targetScene, altLandingPrecondition, altLandingSpawnPointName FROM RocketLaunchpadControlComponent WHERE id = ?;");
query.bind(1, rocketId);
auto result = query.execQuery();
if (!result.eof() && !result.fieldIsNull(0))
{
m_TargetZone = result.getIntField(0);
@@ -59,7 +59,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
{
return;
}
TellMasterToPrepZone(zone);
// This also gets triggered by a proximity monitor + item equip, I will set that up when havok is ready
@@ -80,7 +80,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
{
rocket = inventoryComponent->FindItemById(optionalRocketID);
}
if (rocket == nullptr)
{
rocket = inventoryComponent->FindItemById(characterComponent->GetLastRocketItemID());
@@ -131,7 +131,7 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
}
}
}
// Store the last used rocket item's ID
characterComponent->SetLastRocketItemID(rocket->GetId());
@@ -140,13 +140,13 @@ void RocketLaunchpadControlComponent::Launch(Entity* originator, LWOOBJID option
character->SaveXMLToDatabase();
SetSelectedMapId(originator->GetObjectID(), zone);
GameMessages::SendFireEventClientSide(m_Parent->GetObjectID(), originator->GetSystemAddress(), u"RocketEquipped", rocket->GetId(), cloneId, -1, originator->GetObjectID());
rocket->Equip(true);
GameMessages::SendChangeObjectWorldState(rocket->GetId(), WORLDSTATE_ATTACHED, UNASSIGNED_SYSTEM_ADDRESS);
EntityManager::Instance()->SerializeEntity(originator);
}
@@ -167,7 +167,7 @@ void RocketLaunchpadControlComponent::OnProximityUpdate(Entity* entering, std::s
// Proximity rockets are handled by item equipment
}
void RocketLaunchpadControlComponent::SetSelectedMapId(LWOOBJID player, LWOMAPID mapID)
void RocketLaunchpadControlComponent::SetSelectedMapId(LWOOBJID player, LWOMAPID mapID)
{
m_SelectedMapIds[player] = mapID;
}
@@ -181,7 +181,7 @@ LWOMAPID RocketLaunchpadControlComponent::GetSelectedMapId(LWOOBJID player) cons
return index->second;
}
void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId)
void RocketLaunchpadControlComponent::SetSelectedCloneId(LWOOBJID player, LWOCLONEID cloneId)
{
m_SelectedCloneIds[player] = cloneId;
}

View File

@@ -36,11 +36,11 @@ bool SkillComponent::CastPlayerSkill(const uint32_t behaviorId, const uint32_t s
auto* behavior = Behavior::CreateBehavior(behaviorId);
const auto branch = BehaviorBranchContext(target, 0);
behavior->Handle(context, bitStream, branch);
context->ExecuteUpdates();
return !context->failed;
}
@@ -76,11 +76,11 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
break;
}
}
if (index == -1)
{
Game::logger->Log("SkillComponent", "Failed to find projectile id (%llu)!\n", projectileId);
return;
}
@@ -88,7 +88,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT behaviorID FROM SkillBehavior WHERE skillID = (SELECT skillID FROM ObjectSkills WHERE objectTemplate = ?);");
query.bind(1, (int) sync_entry.lot);
query.bind(1, (int) sync_entry.lot);
auto result = query.execQuery();
@@ -112,7 +112,7 @@ void SkillComponent::SyncPlayerProjectile(const LWOOBJID projectileId, RakNet::B
{
branch.target = target;
}
behavior->Handle(sync_entry.context, bitStream, branch);
this->m_managedProjectiles.erase(this->m_managedProjectiles.begin() + index);
@@ -126,7 +126,7 @@ void SkillComponent::RegisterPlayerProjectile(const LWOOBJID projectileId, Behav
entry.branchContext = branch;
entry.lot = lot;
entry.id = projectileId;
this->m_managedProjectiles.push_back(entry);
}
@@ -138,7 +138,7 @@ void SkillComponent::Update(const float deltaTime)
}
std::map<uint32_t, BehaviorContext*> keep {};
for (const auto& pair : this->m_managedBehaviors)
{
auto* context = pair.second;
@@ -147,7 +147,7 @@ void SkillComponent::Update(const float deltaTime)
{
continue;
}
if (context->clientInitalized)
{
context->CalculateUpdate(deltaTime);
@@ -161,7 +161,7 @@ void SkillComponent::Update(const float deltaTime)
if (context->syncEntries.empty() && context->timerEntries.empty())
{
auto any = false;
for (const auto& projectile : this->m_managedProjectiles)
{
if (projectile.context == context)
@@ -177,13 +177,13 @@ void SkillComponent::Update(const float deltaTime)
context->Reset();
delete context;
context = nullptr;
continue;
}
}
keep.insert_or_assign(pair.first, context);
}
@@ -251,9 +251,9 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
context->caster = m_Parent->GetObjectID();
context->clientInitalized = clientInitalized;
context->foundTarget = target != LWOOBJID_EMPTY || ignoreTarget || clientInitalized;
behavior->Calculate(context, bitStream, { target, 0});
for (auto* script : CppScripts::GetEntityScripts(m_Parent)) {
@@ -275,7 +275,7 @@ SkillExecutionResult SkillComponent::CalculateBehavior(const uint32_t skillId, c
{
// Echo start skill
GameMessages::EchoStartSkill start;
start.iCastType = 0;
start.skillID = skillId;
start.uiSkillHandle = context->skillUId;
@@ -350,7 +350,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
const auto targetPosition = target->GetPosition();
const auto closestPoint = Vector3::ClosestPointOnLine(entry.lastPosition, position, targetPosition);
const auto distance = Vector3::DistanceSquared(targetPosition, closestPoint);
if (distance > 3 * 3)
@@ -396,12 +396,12 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
}
entry.lastPosition = position;
managedProjectile = entry;
}
std::vector<ProjectileSyncEntry> valid;
for (auto& entry : this->m_managedProjectiles)
{
if (entry.calculation)
@@ -409,7 +409,7 @@ void SkillComponent::CalculateUpdate(const float deltaTime)
if (entry.time >= entry.maxTime)
{
entry.branchContext.target = LWOOBJID_EMPTY;
SyncProjectileCalculation(entry);
continue;
@@ -450,13 +450,13 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry)
const auto behaviorId = static_cast<uint32_t>(result.getIntField(0));
result.finalize();
auto* behavior = Behavior::CreateBehavior(behaviorId);
auto* bitStream = new RakNet::BitStream();
behavior->Calculate(entry.context, bitStream, entry.branchContext);
GameMessages::DoClientProjectileImpact projectileImpact;
projectileImpact.sBitStream.assign((char*) bitStream->GetData(), bitStream->GetNumberOfBytesUsed());
@@ -492,19 +492,19 @@ void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID t
delete bitStream;
delete context;
delete context;
}
void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target)
{
auto* context = new BehaviorContext(target);
context->caster = target;
auto* behavior = Behavior::CreateBehavior(behaviorId);
behavior->UnCast(context, { target });
delete context;
}