Skip to content

Commit 0ea46af

Browse files
committed
Fix functions that return structs to return structs, not pointers
1 parent 4e67ea4 commit 0ea46af

25 files changed

+46
-205
lines changed

AbstractClass.h

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ class NOVTABLE AbstractClass : public IPersistStream, public IRTTITypeInfo, publ
8787
virtual HouseClass* GetOwningHouse() const R0;
8888
virtual int GetArrayIndex() const R0;
8989
virtual bool IsDead() const R0;
90-
virtual CoordStruct* GetCoords(CoordStruct* pCrd) const R0;
91-
virtual CoordStruct* GetDestination(CoordStruct* pCrd, TechnoClass* pDocker = nullptr) const R0; // where this is moving, or a building's dock for a techno. iow, a rendez-vous point
90+
virtual CoordStruct GetCoords() const RT(CoordStruct);
91+
virtual CoordStruct GetDestination(TechnoClass* pDocker = nullptr) const RT(CoordStruct); // where this is moving, or a building's dock for a techno. iow, a rendez-vous point
9292
virtual bool IsOnFloor() const R0;
9393
virtual bool IsInAir() const R0;
94-
virtual CoordStruct* GetCenterCoords(CoordStruct* pCrd) const R0;
94+
virtual CoordStruct GetCenterCoords() const RT(CoordStruct);
9595
virtual void Update() RX;
9696

9797
//non-virtual
@@ -104,24 +104,6 @@ class NOVTABLE AbstractClass : public IPersistStream, public IRTTITypeInfo, publ
104104
AnnounceExpiredPointer(this, removed);
105105
}
106106

107-
CoordStruct GetCoords() const {
108-
CoordStruct ret;
109-
this->GetCoords(&ret);
110-
return ret;
111-
}
112-
113-
CoordStruct GetDestination(TechnoClass* pDocker = nullptr) const {
114-
CoordStruct ret;
115-
this->GetDestination(&ret, pDocker);
116-
return ret;
117-
}
118-
119-
CoordStruct GetCenterCoords() const {
120-
CoordStruct ret;
121-
this->GetCenterCoords(&ret);
122-
return ret;
123-
}
124-
125107
DirStruct* GetTargetDirection(DirStruct* pDir, AbstractClass* pTarget) const
126108
{ JMP_THIS(0x5F3DB0); }
127109

BounceClass.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,12 @@ class BounceClass
2929
double maxVelocity, const Vector3D<float>& velocity, double angularVelocity)
3030
{ JMP_THIS(0x4397E0); }
3131

32-
CoordStruct* GetCoords(CoordStruct* pBuffer) const
32+
CoordStruct GetCoords() const
3333
{ JMP_THIS(0x4399A0); }
3434

35-
CoordStruct GetCoords() const {
36-
CoordStruct buffer;
37-
this->GetCoords(&buffer);
38-
return buffer;
39-
}
40-
41-
Matrix3D* GetDrawingMatrix(Matrix3D* pBuffer) const
35+
Matrix3D GetDrawingMatrix() const
4236
{ JMP_THIS(0x4399E0); }
4337

44-
Matrix3D GetDrawingMatrix() const {
45-
Matrix3D buffer;
46-
this->GetDrawingMatrix(&buffer);
47-
return buffer;
48-
}
49-
5038
Status Update()
5139
{ JMP_THIS(0x439B00); }
5240

BuildingClass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class NOVTABLE BuildingClass : public TechnoClass
200200
bool CheckFog()
201201
{ JMP_THIS(0x457A10); }
202202

203-
Matrix3D* GetVoxelBarrelOffsetMatrix(Matrix3D& ret)
203+
Matrix3D GetVoxelBarrelOffsetMatrix()
204204
{ JMP_THIS(0x458810); }
205205

206206
// returns false if this is a gate that is closed, true otherwise

CCINIClass.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ class NOVTABLE INIClass
150150
//Reads three integer values.
151151
int* Read3Integers(int* pBuffer, const char* pSection, const char* pKey, int* pDefault)
152152
{ JMP_THIS(0x529CA0); }
153-
CoordStruct* ReadPoint3D(CoordStruct& ret, const char* pSection, const char* pKey, CoordStruct& defValue)
153+
CoordStruct ReadPoint3D(const char* pSection, const char* pKey, CoordStruct& defValue)
154154
{ JMP_THIS(0x529CA0); }
155155
void GetPoint3D(const char* pSection, const char* pKey, CoordStruct& value)
156-
{ ReadPoint3D(value, pSection, pKey, value); }
156+
{ value = ReadPoint3D(pSection, pKey, value); }
157157

158158
//Reads three byte values.
159159
byte* Read3Bytes(byte* pBuffer, const char* pSection, const char* pKey, byte* pDefault)

CellClass.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,8 @@ class NOVTABLE CellClass : public AbstractClass
186186
{ JMP_THIS(0x47B3A0); }
187187

188188
// Factors in cell height from ramps, level etc.
189-
CoordStruct* GetCellCoords(CoordStruct* pOutBuffer) const
190-
{ JMP_THIS(0x480A30); }
191-
192189
CoordStruct GetCellCoords() const
193-
{
194-
CoordStruct buffer;
195-
GetCellCoords(&buffer);
196-
return buffer;
197-
}
190+
{ JMP_THIS(0x480A30); }
198191

199192
void ActivateVeins()
200193
{ JMP_THIS(0x486920); }
@@ -337,7 +330,7 @@ class NOVTABLE CellClass : public AbstractClass
337330
CALL(0x489270);
338331
}
339332

340-
CoordStruct* FindInfantrySubposition(CoordStruct* pOutBuffer, const CoordStruct& coords, bool ignoreContents, bool alt, bool useCellCoords)
333+
CoordStruct FindInfantrySubposition(CoordStruct* pOutBuffer, const CoordStruct& coords, bool ignoreContents, bool alt, bool useCellCoords)
341334
{ JMP_THIS(0x481180); }
342335

343336
CoordStruct FindInfantrySubposition(const CoordStruct& coords, bool ignoreContents, bool alt, bool useCellCoords)

DisplayClass.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,9 @@ class NOVTABLE DisplayClass : public MapClass
5656
{ JMP_THIS(0x692610); }
5757

5858
/* pass in CurrentFoundationData and receive the width/height of a bounding rectangle in cells */
59-
CellStruct* FoundationBoundsSize(CellStruct& outBuffer, CellStruct const* const pFoundationData) const
59+
CellStruct FoundationBoundsSize(CellStruct const* const pFoundationData) const
6060
{ JMP_THIS(0x4A94F0); }
6161

62-
CellStruct FoundationBoundsSize(CellStruct const* const pFoundationData) const {
63-
CellStruct outBuffer;
64-
FoundationBoundsSize(outBuffer, pFoundationData);
65-
return outBuffer;
66-
}
67-
6862
/* marks or unmarks the cells pointed to by CurrentFoundationData as containing a building */
6963
void MarkFoundation(CellStruct * BaseCell, bool Mark)
7064
{ JMP_THIS(0x4A95A0); }

DropPodLocomotionClass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NOVTABLE DropPodLocomotionClass : public LocomotionClass, public IPiggybac
1919

2020
//ILocomotion
2121
virtual bool __stdcall Is_Moving() R0;
22-
virtual CoordStruct* __stdcall Destination(CoordStruct* pcoord) R0;
22+
virtual CoordStruct __stdcall Destination() RT(CoordStruct);
2323
virtual bool __stdcall Process() R0;
2424
virtual void __stdcall Move_To(CoordStruct to) RX;
2525
virtual void __stdcall Stop_Moving() RX;

EBolt.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@ class EBolt
2727
void ClearOwner()
2828
{ JMP_THIS(0x4C1E50); }
2929

30-
CoordStruct* GetSourceCoords(CoordStruct* outBuffer) const
30+
CoordStruct GetSourceCoords() const
3131
{ JMP_THIS(0x4C2B40); }
3232

33-
CoordStruct GetSourceCoords() const {
34-
CoordStruct buffer;
35-
GetSourceCoords(&buffer);
36-
return buffer;
37-
}
38-
3933
void Fire(CoordStruct P1, CoordStruct P2, DWORD arg18)
4034
{ JMP_THIS(0x4C2A60); }
4135

FlyLocomotionClass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class NOVTABLE FlyLocomotionClass : public LocomotionClass
1616

1717
//ILocomotion
1818
virtual bool __stdcall Is_Moving() R0;
19-
virtual CoordStruct* __stdcall Destination(CoordStruct* pcoord) R0;
19+
virtual CoordStruct __stdcall Destination() RT(CoordStruct);
2020
virtual bool __stdcall Process() R0;
2121
virtual void __stdcall Move_To(CoordStruct to) RX;
2222
virtual void __stdcall Stop_Moving() RX;

FootClass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NOVTABLE FootClass : public TechnoClass
4141
virtual bool CanDeployNow() const R0;
4242
virtual void AddSensorsAt(CellStruct cell) RX;
4343
virtual void RemoveSensorsAt(CellStruct cell) RX;
44-
virtual CoordStruct* vt_entry_4F0(CoordStruct* pCrd) R0;
44+
virtual CoordStruct vt_entry_4F0() RT(CoordStruct);
4545
virtual void vt_entry_4F4() RX;
4646
virtual bool vt_entry_4F8() R0;
4747
virtual bool MoveTo(CoordStruct* pCrd) R0;

0 commit comments

Comments
 (0)