summaryrefslogtreecommitdiff
path: root/src/KingSystem/Event/evtOrderParam.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-02-07 14:55:57 +0100
committerLéo Lam <leo@leolam.fr>2021-02-07 16:09:02 +0100
commit37d4a0695cb941078f00d0fd6958ce6fa1b51616 (patch)
treeedac7ea0be28e8da418e588a4aee858b1b54d8b5 /src/KingSystem/Event/evtOrderParam.cpp
parentf41d668cff4998259880529f4f188eb2f9c9e9c3 (diff)
ksys/evt: Fix matching issue in OrderParam::tryAlloc
Diffstat (limited to 'src/KingSystem/Event/evtOrderParam.cpp')
-rw-r--r--src/KingSystem/Event/evtOrderParam.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/KingSystem/Event/evtOrderParam.cpp b/src/KingSystem/Event/evtOrderParam.cpp
index 2ae33304..5ff22d1d 100644
--- a/src/KingSystem/Event/evtOrderParam.cpp
+++ b/src/KingSystem/Event/evtOrderParam.cpp
@@ -215,44 +215,44 @@ OrderParamEntry* OrderParam::getFreeEntry() {
}
return nullptr;
}
-// This one does not match
+
OrderParamEntry* OrderParam::tryAlloc(OrderParamType type, u32 size, const sead::SafeString& name) {
sead::FixedSafeString<0x100> error_message;
error_message.format("[%s] tryAlloc_(%d, %d, %s) is failed.", "ksys::evt::OrderParam",
static_cast<u16>(type), size, name.cstr());
- OrderParamEntry* entry = getFreeEntry(); // inlining here fixed the for loop
+ OrderParamEntry* entry = getFreeEntry();
if (!entry)
return nullptr;
auto* heap = mHeap;
if (!heap)
return nullptr;
- std::nothrow_t nothrow;
- entry->mName =
- new (heap, nothrow) sead::FixedSafeString<0x20>(name); // scheduling mismatches here
- // entry->mName = new_name;
- // inlining here doesn't fix the mismatch
+ entry->mName = new (heap, std::nothrow_t()) sead::FixedSafeString<0x20>(name);
switch (type) {
case OrderParamType::INT:
case OrderParamType::INT_2:
- doAlloc(entry, new (heap, nothrow) s32(0));
+ entry->mPointer = new (heap, std::nothrow_t()) s32();
+ entry->mSize = sizeof(s32);
break;
case OrderParamType::STRING:
- doAlloc(entry,
- new (heap, nothrow) sead::FixedSafeString<0x40>); // scheduling mismatches here
+ entry->mPointer = new (heap, std::nothrow_t()) sead::FixedSafeString<0x40>;
+ entry->mSize = sizeof(sead::FixedSafeString<0x40>);
break;
case OrderParamType::BYTE:
- doAlloc(entry, new (heap, nothrow) char(0));
+ entry->mPointer = new (heap, std::nothrow_t()) bool();
+ entry->mSize = sizeof(bool);
break;
case OrderParamType::ACTOR:
- doAlloc(entry, new (heap, nothrow) ksys::act::BaseProcLink);
+ entry->mPointer = new (heap, std::nothrow_t()) ksys::act::BaseProcLink;
+ entry->mSize = sizeof(act::BaseProcLink);
break;
case OrderParamType::ARRAY:
- doAlloc(entry, new (heap, nothrow) char[size], size);
+ entry->mPointer = new (heap, std::nothrow_t()) char[size];
+ entry->mSize = size;
break;
default:
break;