mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-07 06:21:01 +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);
|
MAP_GC_WRITE_BARRIER(self);
|
||||||
GC::WriteBarrier(value);
|
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
|
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(val);
|
||||||
GC::WriteBarrier(value);
|
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
|
void PMap::InitializeValue(void *addr, const void *def) const
|
||||||
{
|
{
|
||||||
if (def != nullptr)
|
|
||||||
{
|
|
||||||
I_Error("Map cannot have default values");
|
|
||||||
}
|
|
||||||
Construct(addr);
|
Construct(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2475,7 +2471,6 @@ void PMap::DestroyValue(void *addr) const
|
||||||
|
|
||||||
void PMap::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
void PMap::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
||||||
{
|
{
|
||||||
assert(!(base && special));
|
|
||||||
if (base != nullptr)
|
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
|
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)
|
static bool PMapValueReader(FSerializer &ar, M *map, const PMap *m)
|
||||||
{
|
{
|
||||||
const char * k;
|
const char * k;
|
||||||
while(k = ar.GetKey())
|
while((k = ar.GetKey()))
|
||||||
{
|
{
|
||||||
typename M::ValueType * val;
|
typename M::ValueType * val;
|
||||||
if constexpr(std::is_same_v<typename M::KeyType,FString>)
|
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
|
void PMapIterator::InitializeValue(void *addr, const void *def) const
|
||||||
{
|
{
|
||||||
if (def != nullptr)
|
|
||||||
{
|
|
||||||
I_Error("Map cannot have default values");
|
|
||||||
}
|
|
||||||
Construct(addr);
|
Construct(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2944,7 +2935,6 @@ void PMapIterator::DestroyValue(void *addr) const
|
||||||
|
|
||||||
void PMapIterator::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
void PMapIterator::SetDefaultValue(void *base, unsigned offset, TArray<FTypeAndOffset> *special)
|
||||||
{
|
{
|
||||||
assert(!(base && special));
|
|
||||||
if (base != nullptr)
|
if (base != nullptr)
|
||||||
{
|
{
|
||||||
Construct(((uint8_t*)base)+offset);
|
Construct(((uint8_t*)base)+offset);
|
||||||
|
|
Loading…
Reference in a new issue