From b8369523567f6eab19971d4a82131469785a3f1f Mon Sep 17 00:00:00 2001 From: Jade Date: Fri, 27 Nov 2020 23:29:44 +0000 Subject: [PATCH] Restructured Arrays to Vectors --- src/MobManager.cpp | 12 ++++++------ src/MobManager.hpp | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/MobManager.cpp b/src/MobManager.cpp index bf8ad82..1689928 100644 --- a/src/MobManager.cpp +++ b/src/MobManager.cpp @@ -1468,7 +1468,7 @@ void MobManager::followToCombat(Mob *mob) { void MobManager::useAbilities(Mob *mob, time_t currTime) { if (mob->skillStyle >= 0) { // corruption hit int skillID = (int)mob->data["m_iCorruptionType"]; - int targetData[5] = {1, mob->target->plr->iID, 0, 0, 0}; + std::vector targetData = {1, mob->target->plr->iID, 0, 0, 0}; int temp = mob->skillStyle; mob->skillStyle = -3; // corruption cooldown mob->nextAttack = currTime + 1000; @@ -1478,7 +1478,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) { if (mob->skillStyle == -2) { // eruption hit int skillID = (int)mob->data["m_iMegaType"]; - int targetData[5] = {0, 0, 0, 0, 0}; + std::vector targetData = {0, 0, 0, 0, 0}; // find the players within range of eruption for (auto it = mob->viewableChunks->begin(); it != mob->viewableChunks->end(); it++) { @@ -1519,7 +1519,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) { if (random < prob1) { // active skill hit int skillID = (int)mob->data["m_iActiveSkill1"]; - int targetData[5] = {1, mob->target->plr->iID, 0, 0, 0}; + std::vector targetData = {1, mob->target->plr->iID, 0, 0, 0}; for (auto& pwr : MobPowers) if (pwr.skillType == NanoManager::SkillTable[skillID].skillType) pwr.handle(mob, targetData, skillID, NanoManager::SkillTable[skillID].durationTime[0], NanoManager::SkillTable[skillID].powerIntensity[0]); @@ -1563,7 +1563,7 @@ void MobManager::useAbilities(Mob *mob, time_t currTime) { return; } -void MobManager::dealCorruption(Mob *mob, int targetData[], int skillID, int style) { +void MobManager::dealCorruption(Mob *mob, std::vector targetData, int skillID, int style) { size_t resplen = sizeof(sP_FE2CL_NPC_SKILL_CORRUPTION_HIT) + targetData[0] * sizeof(sCAttackResult); // validate response packet @@ -1629,7 +1629,7 @@ void MobManager::dealCorruption(Mob *mob, int targetData[], int skillID, int sty if (plr->Nanos[plr->activeNano].iStamina > 150) respdata[i].iNanoStamina = plr->Nanos[plr->activeNano].iStamina = 150; // fire damage power disguised as a corruption attack back at the enemy - int targetData2[5] = {1, mob->appearanceData.iNPC_ID, 0, 0, 0}; + std::vector targetData2 = {1, mob->appearanceData.iNPC_ID, 0, 0, 0}; for (auto& pwr : NanoManager::NanoPowers) if (pwr.skillType == EST_DAMAGE) pwr.handle(sock, targetData2, plr->activeNano, skillID, 0, 100); @@ -1850,7 +1850,7 @@ bool doBatteryDrain(Mob *mob, sSkillResult_BatteryDrain *respdata, int i, int32_ template -void mobPower(Mob *mob, int targetData[], +void mobPower(Mob *mob, std::vector targetData, int16_t skillID, int16_t duration, int16_t amount, int16_t skillType, int32_t bitFlag, int16_t timeBuffID) { size_t resplen; diff --git a/src/MobManager.hpp b/src/MobManager.hpp index c329d95..b63985c 100644 --- a/src/MobManager.hpp +++ b/src/MobManager.hpp @@ -123,7 +123,7 @@ struct Bullet { int bulletType; }; -typedef void (*MobPowerHandler)(Mob*, int*, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t); +typedef void (*MobPowerHandler)(Mob*, std::vector, int16_t, int16_t, int16_t, int16_t, int32_t, int16_t); struct MobPower { int16_t skillType; @@ -133,7 +133,7 @@ struct MobPower { MobPower(int16_t s, int32_t b, int16_t t, MobPowerHandler h) : skillType(s), bitFlag(b), timeBuffID(t), handler(h) {} - void handle(Mob *mob, int* targetData, int16_t skillID, int16_t duration, int16_t amount) { + void handle(Mob *mob, std::vector targetData, int16_t skillID, int16_t duration, int16_t amount) { if (handler == nullptr) return; @@ -189,5 +189,5 @@ namespace MobManager { void followToCombat(Mob *mob); void useAbilities(Mob *mob, time_t currTime); - void dealCorruption(Mob *mob, int *targetData, int skillID, int style); + void dealCorruption(Mob *mob, std::vector targetData, int skillID, int style); }