Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
ReferencerClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE__REFERENCERCLASS_H
13#define TT_INCLUDE__REFERENCERCLASS_H
14
15#include "PostLoadableClass.h"
16#include "ReferenceableClass.h"
17template <class T> class ReferenceableClass;
18class SCRIPTS_API ReferencerClass : public PostLoadableClass
19{
20
21private:
22 ReferenceableClass<ScriptableGameObj>* ReferenceTarget;
23 ReferencerClass* TargetReferencerListNext;
24
25public:
26 friend class ReferenceableClass<ScriptableGameObj>;
27 ~ReferencerClass();
28
29 bool Save (ChunkSaveClass& chunkSaver);
30 bool Load (ChunkLoadClass& chunkLoader);
31 void On_Post_Load ();
32
33 ReferencerClass& operator = (ScriptableGameObj* object);
34 ReferencerClass& operator = (const ReferencerClass& referencer);
35
36 operator ScriptableGameObj* () const;
37 inline ScriptableGameObj* operator ->() { return Get_Ptr(); }
38
39 inline ReferencerClass()
40 : ReferenceTarget(0), TargetReferencerListNext(0)
41 {
42 }
43
44
45 inline ReferencerClass
46 (ScriptableGameObj* object)
47 : ReferenceTarget(0), TargetReferencerListNext(0)
48 {
49 *this = object;
50 }
51
52
53 inline ScriptableGameObj* Get_Ptr() const
54 {
55 return ReferenceTarget ? ReferenceTarget->Get_Data() : NULL;
56 }
57
58
59 inline void Set_Ptr
60 (ScriptableGameObj* object)
61 {
62 *this = object;
63 }
64
65
66}; // size: 16
67
68#endif