[2246] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Dumeni Manatschal, (C) 2007 |
---|
| 24 | * Oliver Scheuss, (C) 2007 |
---|
| 25 | * Co-authors: |
---|
| 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
[2307] | 30 | #include "network/synchronisable/Synchronisable.h" |
---|
[3084] | 31 | #include <string> |
---|
[2246] | 32 | |
---|
| 33 | // ================ template spezialisation |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | namespace orxonox{ |
---|
| 37 | |
---|
[3084] | 38 | // template <> void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
---|
| 39 | // { |
---|
| 40 | // if (bidirectional) |
---|
| 41 | // syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb)); |
---|
| 42 | // else |
---|
| 43 | // syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb)); |
---|
| 44 | // stringList.push_back(syncList.back()); |
---|
| 45 | // } |
---|
| 46 | |
---|
| 47 | template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
---|
| 48 | { |
---|
| 49 | if (bidirectional) |
---|
| 50 | syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb)); |
---|
| 51 | else |
---|
| 52 | syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb)); |
---|
| 53 | stringList.push_back(syncList.back()); |
---|
| 54 | } |
---|
| 55 | |
---|
[2246] | 56 | template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 57 | { |
---|
[2309] | 58 | registerVariable(variable.r, mode, cb, bidirectional); |
---|
| 59 | registerVariable(variable.g, mode, cb, bidirectional); |
---|
| 60 | registerVariable(variable.b, mode, cb, bidirectional); |
---|
[2246] | 61 | registerVariable(variable.a, mode, cb, bidirectional); |
---|
| 62 | } |
---|
| 63 | template <> void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 64 | { |
---|
| 65 | return Synchronisable::registerVariable( (const ColourValue&)variable, mode, cb, bidirectional); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | template <> void Synchronisable::registerVariable( const Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 69 | { |
---|
[2309] | 70 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
[2246] | 71 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
| 72 | } |
---|
[3084] | 73 | // template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 74 | // { |
---|
| 75 | // registerVariable( (const ColourValue&)variable, mode, cb, bidirectional); |
---|
| 76 | // } |
---|
[2246] | 77 | |
---|
| 78 | template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 79 | { |
---|
[2309] | 80 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 81 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
[2246] | 82 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
| 83 | } |
---|
| 84 | template <> void Synchronisable::registerVariable( Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 85 | { |
---|
| 86 | registerVariable( (const Vector3&)variable, mode, cb, bidirectional); |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | template <> void Synchronisable::registerVariable( const Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 90 | { |
---|
[2309] | 91 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 92 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
| 93 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
[2246] | 94 | registerVariable(variable.w, mode, cb, bidirectional); |
---|
| 95 | } |
---|
| 96 | template <> void Synchronisable::registerVariable( Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 97 | { |
---|
| 98 | registerVariable( (const Vector4&)variable, mode, cb, bidirectional); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | template <> void Synchronisable::registerVariable( mbool& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 102 | { |
---|
| 103 | registerVariable(variable.getMemory(), mode, cb, bidirectional); |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | template <> void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 107 | { |
---|
[2309] | 108 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 109 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
[2246] | 110 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
[2309] | 111 | registerVariable(variable.w, mode, cb, bidirectional); |
---|
[2246] | 112 | } |
---|
| 113 | template <> void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 114 | { |
---|
| 115 | registerVariable( (const Quaternion&)variable, mode, cb, bidirectional); |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
[2355] | 120 | } //namespace |
---|