[5523] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
[5547] | 11 | |
---|
[5523] | 12 | ### File Specific: |
---|
| 13 | main-programmer: Silvan Nellen |
---|
[5997] | 14 | co-programmer: Benjamin Wuest |
---|
[5547] | 15 | */ |
---|
[5523] | 16 | |
---|
[5547] | 17 | #include "synchronizeable.h" |
---|
| 18 | #include "netdefs.h" |
---|
[5529] | 19 | |
---|
[5996] | 20 | |
---|
[5547] | 21 | /** |
---|
[5807] | 22 | * default constructor |
---|
[5547] | 23 | */ |
---|
[5996] | 24 | Synchronizeable::Synchronizeable() |
---|
[5997] | 25 | { |
---|
[5996] | 26 | |
---|
[5997] | 27 | //owner = ?; |
---|
| 28 | //hostID = ?; |
---|
| 29 | //state = ?; |
---|
| 30 | |
---|
| 31 | } |
---|
| 32 | |
---|
[5996] | 33 | /** |
---|
| 34 | * default constructor |
---|
| 35 | */ |
---|
[5804] | 36 | Synchronizeable::Synchronizeable(const char* name) |
---|
[5523] | 37 | { |
---|
[5807] | 38 | this->setName(name); |
---|
[5523] | 39 | } |
---|
| 40 | |
---|
[5996] | 41 | |
---|
[5547] | 42 | /** |
---|
[5807] | 43 | * default destructor deletes all unneded stuff |
---|
[5547] | 44 | */ |
---|
| 45 | Synchronizeable::~Synchronizeable() |
---|
[5807] | 46 | {} |
---|
[5523] | 47 | |
---|
[5547] | 48 | /** |
---|
[5807] | 49 | * write data to NetworkStream |
---|
[5547] | 50 | */ |
---|
[5807] | 51 | void Synchronizeable::writeBytes(const byte* data, int length) |
---|
| 52 | {} |
---|
[5523] | 53 | |
---|
[5547] | 54 | /** |
---|
[5807] | 55 | * read data from NetworkStream |
---|
[5547] | 56 | */ |
---|
[5996] | 57 | int Synchronizeable::readBytes(byte* data) |
---|
[5807] | 58 | {} |
---|
[5547] | 59 | |
---|
| 60 | |
---|
[5807] | 61 | void Synchronizeable::writeDebug() const |
---|
| 62 | {} |
---|
[5547] | 63 | |
---|
| 64 | |
---|
[5807] | 65 | void Synchronizeable::readDebug() const |
---|
| 66 | {} |
---|
[5997] | 67 | |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Sets the server flag to a given value |
---|
| 74 | * @param isServer: the boolean value which the server flag is to set to |
---|
| 75 | */ |
---|
| 76 | void Synchronizeable::setIsServer(bool isServer) |
---|
| 77 | { |
---|
| 78 | if( isServer ) |
---|
| 79 | this->state = this->state | STATE_SERVER; |
---|
| 80 | else |
---|
| 81 | this->state = this->state & (~STATE_SERVER); |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | /** |
---|
| 85 | * Sets the outofsync flag to a given value |
---|
| 86 | * @param outOfSync: the boolean value which the outofsync flag is to set to |
---|
| 87 | */ |
---|
| 88 | void Synchronizeable::setIsOutOfSync(bool outOfSync) |
---|
| 89 | { |
---|
| 90 | if( outOfSync ) |
---|
| 91 | this->state = this->state | STATE_OUTOFSYNC; |
---|
| 92 | else |
---|
| 93 | this->state = this->state & (~STATE_OUTOFSYNC); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | /** |
---|
| 97 | * Determines if the server flag is set |
---|
| 98 | * @return true, if the server flag is true, false else |
---|
| 99 | */ |
---|
| 100 | bool Synchronizeable::isServer() |
---|
| 101 | { |
---|
| 102 | return this->state & STATE_SERVER == STATE_SERVER; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | /** |
---|
| 106 | * Determines if the outofsync flag is set |
---|
| 107 | * @return true, if the outofsync flag is true, false else |
---|
| 108 | */ |
---|
| 109 | bool Synchronizeable::isOutOfSync() |
---|
| 110 | { |
---|
| 111 | return this->state & STATE_OUTOFSYNC == STATE_OUTOFSYNC; |
---|
| 112 | } |
---|