[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 | |
---|
[3084] | 30 | #include <string> |
---|
[3214] | 31 | #include "util/Math.h" |
---|
| 32 | #include "Synchronisable.h" |
---|
| 33 | #include "SynchronisableVariable.h" |
---|
[2246] | 34 | |
---|
| 35 | // ================ template spezialisation |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | namespace orxonox{ |
---|
| 39 | |
---|
[3084] | 40 | // template <> void Synchronisable::registerVariable( const std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
---|
| 41 | // { |
---|
| 42 | // if (bidirectional) |
---|
| 43 | // syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb)); |
---|
| 44 | // else |
---|
| 45 | // syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb)); |
---|
| 46 | // stringList.push_back(syncList.back()); |
---|
| 47 | // } |
---|
| 48 | |
---|
| 49 | template <> void Synchronisable::registerVariable( std::string& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
---|
| 50 | { |
---|
| 51 | if (bidirectional) |
---|
| 52 | syncList.push_back(new SynchronisableVariableBidirectional<const std::string>(variable, mode, cb)); |
---|
| 53 | else |
---|
| 54 | syncList.push_back(new SynchronisableVariable<const std::string>(variable, mode, cb)); |
---|
| 55 | stringList.push_back(syncList.back()); |
---|
| 56 | } |
---|
| 57 | |
---|
[2246] | 58 | template <> void Synchronisable::registerVariable( const ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 59 | { |
---|
[2309] | 60 | registerVariable(variable.r, mode, cb, bidirectional); |
---|
| 61 | registerVariable(variable.g, mode, cb, bidirectional); |
---|
| 62 | registerVariable(variable.b, mode, cb, bidirectional); |
---|
[2246] | 63 | registerVariable(variable.a, mode, cb, bidirectional); |
---|
| 64 | } |
---|
| 65 | template <> void Synchronisable::registerVariable( ColourValue& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 66 | { |
---|
| 67 | return Synchronisable::registerVariable( (const ColourValue&)variable, mode, cb, bidirectional); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | template <> void Synchronisable::registerVariable( const Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 71 | { |
---|
[2309] | 72 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
[2246] | 73 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
| 74 | } |
---|
[3084] | 75 | // template <> void Synchronisable::registerVariable( Vector2& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 76 | // { |
---|
| 77 | // registerVariable( (const ColourValue&)variable, mode, cb, bidirectional); |
---|
| 78 | // } |
---|
[2246] | 79 | |
---|
| 80 | template <> void Synchronisable::registerVariable( const Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 81 | { |
---|
[2309] | 82 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 83 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
[2246] | 84 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
| 85 | } |
---|
| 86 | template <> void Synchronisable::registerVariable( Vector3& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 87 | { |
---|
| 88 | registerVariable( (const Vector3&)variable, mode, cb, bidirectional); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | template <> void Synchronisable::registerVariable( const Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 92 | { |
---|
[2309] | 93 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 94 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
| 95 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
[2246] | 96 | registerVariable(variable.w, mode, cb, bidirectional); |
---|
| 97 | } |
---|
| 98 | template <> void Synchronisable::registerVariable( Vector4& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 99 | { |
---|
| 100 | registerVariable( (const Vector4&)variable, mode, cb, bidirectional); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | template <> void Synchronisable::registerVariable( mbool& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 104 | { |
---|
| 105 | registerVariable(variable.getMemory(), mode, cb, bidirectional); |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | template <> void Synchronisable::registerVariable( const Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 109 | { |
---|
[2309] | 110 | registerVariable(variable.x, mode, cb, bidirectional); |
---|
| 111 | registerVariable(variable.y, mode, cb, bidirectional); |
---|
[2246] | 112 | registerVariable(variable.z, mode, cb, bidirectional); |
---|
[2309] | 113 | registerVariable(variable.w, mode, cb, bidirectional); |
---|
[2246] | 114 | } |
---|
| 115 | template <> void Synchronisable::registerVariable( Quaternion& variable, uint8_t mode, NetworkCallbackBase* cb, bool bidirectional) |
---|
| 116 | { |
---|
| 117 | registerVariable( (const Quaternion&)variable, mode, cb, bidirectional); |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
[2355] | 122 | } //namespace |
---|