Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef AESOP_AESOP_CLIENT_H__
00034 #define AESOP_AESOP_CLIENT_H__
00035
00036
00037 #include "aesop-map/map.h"
00038 #include "aesop-physics/aesop-physics.h"
00039 #include "conversation/conversation.h"
00040 #include "crypto/crypto.h"
00041 #include "dialog/dialog.h"
00042 #include "netlib/netlib.h"
00043 #include "story/story.h"
00044 #include "threadsafe/threadsafe_map.h"
00045 #include "xdrbuf/xdrbuf.h"
00046
00047
00048
00049 class Datahash;
00050 namespace aesop {
00051 class MapDynamics;
00052 };
00053
00054
00055 namespace aesop {
00056
00085
00088
00089 enum eClientState {
00090 eClientState_Searching = 1,
00091 eClientState_Connecting = 2,
00092 eClientState_Connected = 3,
00093
00094
00095 eClientState_Invalid = 0
00096 };
00097
00098
00099
00102 class ClientHost {
00103 public:
00104
00105 virtual void notifyKey(IN smart_ptr<crypto::DESKey>& desKey) = 0;
00106
00108 virtual void requestDialog(IN const char * guid,
00109 IN int playerId,
00110 IN const Datahash * dialog,
00111 IN dialog::Host * host) = 0;
00112
00114 virtual void destroyDialog(IN const char * guid,
00115 IN int playerId) = 0;
00116
00119 virtual void notifyPlayerMap(IN int playerId,
00120 IN smart_ptr<MapDynamics>& dyn) = 0;
00121
00123 virtual void appendGameData(IN xdrbuf::Output * outbuf) = 0;
00124
00126 virtual void updateAnimation(IN smart_ptr<PhysicsObject>& obj,
00127 IN const char * animationState) = 0;
00128
00129 protected:
00130
00133 virtual ~ClientHost(void) throw();
00134 };
00135
00136
00137
00139 struct server_info_t {
00140
00141 server_info_t(void) throw() { this->clear(); }
00142 void clear(void) throw() {
00143 publicName = "";
00144 address.clear();
00145 }
00146 bool isValid(void) const throw() {
00147 return address.isValid();
00148 }
00149
00150
00151 std::string publicName;
00152 netlib::address_t address;
00153 };
00154
00155
00156
00159 typedef threadsafe_map<std::string, server_info_t> server_map_t;
00160
00161
00162
00164 class Client {
00165 public:
00166
00167 virtual ~Client(void) throw();
00168
00169
00170
00172 virtual story::Story * getStory(void) throw() = 0;
00173
00175 virtual eClientState getState(void) throw() = 0;
00176
00179 virtual bool getServer(OUT server_info_t& server) = 0;
00180
00183 virtual const server_map_t& getDiscoveredServers(void) = 0;
00184
00194 virtual bool requestConnect(IN const char * serverKey) = 0;
00195
00198 virtual float tick(void) = 0;
00199
00203 virtual bool createPlayer(IN int playerId) = 0;
00204
00207 virtual void startLocalConversation(IN const char * guid,
00208 IN int playerId,
00209 IN smart_ptr<converse::ConversationHost> host) = 0;
00210
00212 virtual bool isConversationUnderway(IN const char * guid) = 0;
00213
00216 virtual void newGame(IN int playerId) = 0;
00217
00219 virtual void requestMove(IN int playerId,
00220 IN const point3d_t& delta,
00221 IN const point3d_t& euler,
00222 OUT point3d_t& newPosition) = 0;
00223
00225 virtual bool getPlacement(IN int playerId,
00226 OUT placement_t& placement) = 0;
00227
00229 virtual smart_ptr<PhysicsObject> getPlayerObject(IN int playerId) = 0;
00230
00231
00232 static smart_ptr<Client> create(IN ClientHost * host,
00233 IN smart_ptr<story::Story>& story,
00234 IN smart_ptr<Datahash>& op_params);
00235 };
00236
00237
00238
00239 };
00240
00241 #endif // AESOP_AESOP_CLIENT_H__
00242