Make skill result size check an assertion

This commit is contained in:
gsemaj 2023-07-23 10:46:53 -04:00 committed by gsemaj
parent e3c3da87b2
commit 13e71de785
2 changed files with 4 additions and 8 deletions

View File

@ -5,8 +5,6 @@
#include "Buffs.hpp"
#include "Nanos.hpp"
#include <assert.h>
using namespace Abilities;
std::map<int32_t, SkillData> Abilities::SkillTable;

View File

@ -7,6 +7,7 @@
#include <map>
#include <vector>
#include <assert.h>
constexpr size_t MAX_SKILLRESULT_SIZE = sizeof(sSkillResult_BatteryDrain);
@ -75,12 +76,9 @@ struct SkillResult {
size_t size;
uint8_t payload[MAX_SKILLRESULT_SIZE];
SkillResult(size_t len, void* dat) {
if(len <= MAX_SKILLRESULT_SIZE) {
size = len;
memcpy(payload, dat, len);
} else {
size = 0;
}
assert(len <= MAX_SKILLRESULT_SIZE);
size = len;
memcpy(payload, dat, len);
}
SkillResult() {
size = 0;