Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
ExtendedNetworkObject.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//
13// This class is to allow virtuals to be added to a NetworkObjectClass without
14// having to change the offsets of the base class.
15//
16// To use this class, declare the original class abstract (so that no instances
17// can be created), add IMPLEMENT_EXTENDED_NETWORK_OBJECT(ClassName) to your
18// class header file, and prefix all instantiations with "Extended", ie. replace
19// "new ClassName()" with "new ExtendedClassName()".
20//
21
22#pragma once
23
24
25class GenericExtendedNetworkObject
26{
27public:
28
29 GenericExtendedNetworkObject();
30 ~GenericExtendedNetworkObject();
31
32 virtual void setDirtyBitsForClient(const int clientId) = 0;
33};
34
35
36template<class BaseClass>
37class ExtendedNetworkObject :
38 public BaseClass,
39 public GenericExtendedNetworkObject
40{
41public:
42
43 virtual void setDirtyBitsForClient(const int clientId) { return BaseClass::setDirtyBitsForClient(clientId); }
44
45};
46
47
48#define CONCAT(a, b) CONCAT_(a, b)
49#define CONCAT_(a, b) a ## b
50#define IMPLEMENT_EXTENDED_NETWORK_OBJECT(BaseClass) \
51 typedef ExtendedNetworkObject<BaseClass> CONCAT(Extended, BaseClass);