mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-22 01:01:04 +00:00
- pulled in the ZScript map fixes from GZDoom.
This commit is contained in:
parent
e412a34f4e
commit
fbf5cdc18f
2 changed files with 19 additions and 13 deletions
|
@ -162,7 +162,15 @@ template<typename M> void MapInsert(M * self, expand_types_vm<typename M::KeyTyp
|
|||
MAP_GC_WRITE_BARRIER(self);
|
||||
GC::WriteBarrier(value);
|
||||
}
|
||||
self->Insert(key, value);
|
||||
|
||||
if constexpr(std::is_same_v<typename M::ValueType, float>)
|
||||
{
|
||||
self->Insert(key,static_cast<float>(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
self->Insert(key, value);
|
||||
}
|
||||
self->info->rev++; // invalidate iterators
|
||||
}
|
||||
|
||||
|
@ -246,7 +254,15 @@ template<typename I> void MapIteratorSetValue(I * self, expand_types_vm<typename
|
|||
GC::WriteBarrier(val);
|
||||
GC::WriteBarrier(value);
|
||||
}
|
||||
val = value;
|
||||
|
||||
if constexpr(std::is_same_v<typename I::ValueType, float>)
|
||||
{
|
||||
val = static_cast<float>(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
val = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2399,10 +2399,6 @@ void PMap::Construct(void * addr) const {
|
|||
|
||||
void PMap::InitializeValue(void *addr, const void *def) const
|
||||
{
|
||||
if (def != nullptr)
|
||||
{
|
||||
I_Error("Map cannot have default values");
|
||||
}
|
||||
Construct(addr);
|
||||
}
|
||||
|
||||
|
@ -2475,7 +2471,6 @@ void PMap::DestroyValue(void *addr) const
|
|||
|
||||
void PMap::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
||||
{
|
||||
assert(!(base && special));
|
||||
if (base != nullptr)
|
||||
{
|
||||
Construct(((uint8_t*)base)+offset); // is this needed? string/dynarray do this initialization if base != nullptr, but their initialization doesn't need to allocate
|
||||
|
@ -2603,7 +2598,7 @@ template<typename M>
|
|||
static bool PMapValueReader(FSerializer &ar, M *map, const PMap *m)
|
||||
{
|
||||
const char * k;
|
||||
while(k = ar.GetKey())
|
||||
while((k = ar.GetKey()))
|
||||
{
|
||||
typename M::ValueType * val;
|
||||
if constexpr(std::is_same_v<typename M::KeyType,FString>)
|
||||
|
@ -2868,10 +2863,6 @@ void PMapIterator::Construct(void * addr) const {
|
|||
|
||||
void PMapIterator::InitializeValue(void *addr, const void *def) const
|
||||
{
|
||||
if (def != nullptr)
|
||||
{
|
||||
I_Error("Map cannot have default values");
|
||||
}
|
||||
Construct(addr);
|
||||
}
|
||||
|
||||
|
@ -2944,7 +2935,6 @@ void PMapIterator::DestroyValue(void *addr) const
|
|||
|
||||
void PMapIterator::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
||||
{
|
||||
assert(!(base && special));
|
||||
if (base != nullptr)
|
||||
{
|
||||
Construct(((uint8_t*)base)+offset);
|
||||
|
|
Loading…
Reference in a new issue