- declared the sectorplanes in Sector as read only and marked all relevant functions in the planes themselves const.

This is to block modification of the planes directly. For future-proofness with renderer changes everything that alters these values should go through he function interface.
This commit is contained in:
Christoph Oelckers 2017-03-04 11:48:36 +01:00
parent 3879e67cee
commit 5551f3a8c5
3 changed files with 10 additions and 11 deletions

View file

@ -858,8 +858,8 @@ void InitThingdef()
// As a result, the size has to be set to something large and arbritrary because it can change between maps. This will need some serious improvement when things get cleaned up. // As a result, the size has to be set to something large and arbritrary because it can change between maps. This will need some serious improvement when things get cleaned up.
sectorstruct->AddNativeField("lines", NewPointer(NewResizableArray(NewPointer(linestruct, false)), false), myoffsetof(sector_t, Lines), VARF_Native); sectorstruct->AddNativeField("lines", NewPointer(NewResizableArray(NewPointer(linestruct, false)), false), myoffsetof(sector_t, Lines), VARF_Native);
sectorstruct->AddNativeField("ceilingplane", secplanestruct, myoffsetof(sector_t, ceilingplane), VARF_Native); sectorstruct->AddNativeField("ceilingplane", secplanestruct, myoffsetof(sector_t, ceilingplane), VARF_Native | VARF_ReadOnly);
sectorstruct->AddNativeField("floorplane", secplanestruct, myoffsetof(sector_t, floorplane), VARF_Native); sectorstruct->AddNativeField("floorplane", secplanestruct, myoffsetof(sector_t, floorplane), VARF_Native | VARF_ReadOnly);

View file

@ -386,7 +386,6 @@ class Thinker : Object native play
class ThinkerIterator : Object native class ThinkerIterator : Object native
{ {
native static ThinkerIterator Create(class<Object> type = "Actor", int statnum=Thinker.MAX_STATNUM+1); native static ThinkerIterator Create(class<Object> type = "Actor", int statnum=Thinker.MAX_STATNUM+1);
native Thinker Next(bool exact = false); native Thinker Next(bool exact = false);
native void Reinit(); native void Reinit();

View file

@ -143,7 +143,7 @@ struct Line native play
native int special; native int special;
native int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width) native int args[5]; // <--- hexen-style arguments (expanded to ZDoom's full width)
native double alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque) native double alpha; // <--- translucency (0=invisibile, FRACUNIT=opaque)
native Side sidedef[2]; native readonly Side sidedef[2];
native readonly double bbox[4]; // bounding box, for the extent of the LineDef. native readonly double bbox[4]; // bounding box, for the extent of the LineDef.
native readonly Sector frontsector, backsector; native readonly Sector frontsector, backsector;
native int validcount; // if == validcount, already checked native int validcount; // if == validcount, already checked
@ -177,15 +177,15 @@ struct SecPlane native play
native double D; native double D;
native double negiC; native double negiC;
native bool isSlope(); native bool isSlope() const;
native int PointOnSide(Vector3 pos); native int PointOnSide(Vector3 pos) const;
native double ZatPoint (Vector2 v); native double ZatPoint (Vector2 v) const;
native double ZatPointDist(Vector2 v, double dist); native double ZatPointDist(Vector2 v, double dist) const;
native bool isEqual(Secplane other); native bool isEqual(Secplane other) const;
native void ChangeHeight(double hdiff); native void ChangeHeight(double hdiff);
native double GetChangedHeight(double hdiff); native double GetChangedHeight(double hdiff) const;
native double HeightDiff(double oldd, double newd = 0.0); native double HeightDiff(double oldd, double newd = 0.0);
native double PointToDist(Vector2 xy, double z); native double PointToDist(Vector2 xy, double z) const;
} }
// This encapsulates all info Doom's original 'special' field contained - for saving and transferring. // This encapsulates all info Doom's original 'special' field contained - for saving and transferring.