mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Fix readonly native structs
This commit is contained in:
parent
d8ef27e0ed
commit
bc26c54b15
2 changed files with 17 additions and 5 deletions
|
@ -1940,6 +1940,12 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
bool writable;
|
||||
basex->RequestAddress(ctx, &writable);
|
||||
|
||||
if(!writable && !ValueType->toPointer()->IsConst && ctx.Version >= MakeVersion(4, 12))
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Trying to assign readonly value to writable type.");
|
||||
}
|
||||
|
||||
basex->ValueType = ValueType;
|
||||
auto x = basex;
|
||||
basex = nullptr;
|
||||
|
@ -8739,6 +8745,12 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
if (Self->ValueType->isRealPointer())
|
||||
{
|
||||
auto pointedType = Self->ValueType->toPointer()->PointedType;
|
||||
|
||||
if(pointedType && pointedType->isStruct() && Self->ValueType->toPointer()->IsConst && ctx.Version >= MakeVersion(4, 12))
|
||||
{
|
||||
isreadonly = true;
|
||||
}
|
||||
|
||||
if (pointedType && (pointedType->isDynArray() || pointedType->isMap() || pointedType->isMapIterator()))
|
||||
{
|
||||
Self = new FxOutVarDereference(Self, Self->ScriptPosition);
|
||||
|
@ -9268,7 +9280,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
else if (Self->ValueType->isStruct())
|
||||
else if (Self->ValueType->isStruct() && !isreadonly)
|
||||
{
|
||||
bool writable;
|
||||
|
||||
|
|
|
@ -583,10 +583,10 @@ struct State native
|
|||
native readonly bool bCanRaise;
|
||||
native readonly bool bDehacked;
|
||||
|
||||
native int DistanceTo(state other);
|
||||
native bool ValidateSpriteFrame();
|
||||
native TextureID, bool, Vector2 GetSpriteTexture(int rotation, int skin = 0, Vector2 scale = (0,0), int spritenum = -1, int framenum = -1);
|
||||
native bool InStateSequence(State base);
|
||||
native int DistanceTo(state other) const;
|
||||
native bool ValidateSpriteFrame() const;
|
||||
native TextureID, bool, Vector2 GetSpriteTexture(int rotation, int skin = 0, Vector2 scale = (0,0), int spritenum = -1, int framenum = -1) const;
|
||||
native bool InStateSequence(State base) const;
|
||||
}
|
||||
|
||||
struct TerrainDef native
|
||||
|
|
Loading…
Reference in a new issue