Changeset 3099 for code/trunk/src/orxonox/objects/infos
- Timestamp:
- May 28, 2009, 1:58:22 AM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects/infos
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/infos/GametypeInfo.cc
r2826 r3099 31 31 32 32 #include "core/CoreIncludes.h" 33 #include "core/GameMode.h" 34 #include "network/NetworkFunction.h" 35 #include "network/Host.h" 36 #include "objects/GametypeMessageListener.h" 33 37 34 38 namespace orxonox 35 39 { 36 40 CreateUnloadableFactory(GametypeInfo); 41 42 registerMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage); 43 registerMemberNetworkFunction(GametypeInfo, dispatchKillMessage); 44 registerMemberNetworkFunction(GametypeInfo, dispatchDeathMessage); 37 45 38 46 GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator) … … 60 68 registerVariable(this->hudtemplate_, variableDirection::toclient); 61 69 } 70 71 void GametypeInfo::sendAnnounceMessage(const std::string& message) const 72 { 73 if (GameMode::isMaster()) 74 { 75 callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), CLIENTID_UNKNOWN, message); 76 this->dispatchAnnounceMessage(message); 77 } 78 } 79 80 void GametypeInfo::sendAnnounceMessage(const std::string& message, unsigned int clientID) const 81 { 82 if (GameMode::isMaster()) 83 { 84 if (clientID == CLIENTID_SERVER) 85 this->dispatchAnnounceMessage(message); 86 else 87 callMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage, this->getObjectID(), clientID, message); 88 } 89 } 90 91 void GametypeInfo::sendKillMessage(const std::string& message, unsigned int clientID) const 92 { 93 if (GameMode::isMaster()) 94 { 95 if (clientID == CLIENTID_SERVER) 96 this->dispatchKillMessage(message); 97 else 98 callMemberNetworkFunction(GametypeInfo, dispatchKillMessage, this->getObjectID(), clientID, message); 99 } 100 } 101 102 void GametypeInfo::sendDeathMessage(const std::string& message, unsigned int clientID) const 103 { 104 if (GameMode::isMaster()) 105 { 106 if (clientID == CLIENTID_SERVER) 107 this->dispatchDeathMessage(message); 108 else 109 callMemberNetworkFunction(GametypeInfo, dispatchDeathMessage, this->getObjectID(), clientID, message); 110 } 111 } 112 113 void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const 114 { 115 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) 116 it->announcemessage(this, message); 117 } 118 119 void GametypeInfo::dispatchKillMessage(const std::string& message) const 120 { 121 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) 122 it->killmessage(this, message); 123 } 124 125 void GametypeInfo::dispatchDeathMessage(const std::string& message) const 126 { 127 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) 128 it->deathmessage(this, message); 129 } 62 130 } -
code/trunk/src/orxonox/objects/infos/GametypeInfo.h
r2826 r3099 59 59 { return this->hudtemplate_; } 60 60 61 void sendAnnounceMessage(const std::string& message) const; 62 void sendAnnounceMessage(const std::string& message, unsigned int clientID) const; 63 void sendKillMessage(const std::string& message, unsigned int clientID) const; 64 void sendDeathMessage(const std::string& message, unsigned int clientID) const; 65 66 void dispatchAnnounceMessage(const std::string& message) const; 67 void dispatchKillMessage(const std::string& message) const; 68 void dispatchDeathMessage(const std::string& message) const; 69 61 70 private: 62 71 bool bStarted_;
Note: See TracChangeset
for help on using the changeset viewer.