00001 /* 00002 svas_server -- virtual World Server of Svas 00003 Copyright (c) 2001, 2002 David Moreno Montero 00004 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00019 02111-1307, USA. 00020 00021 */ 00022 00023 #ifndef __CLIENT__ 00024 #define __CLIENT__ 00025 00026 #include "baseClient.h" 00027 #include "message.h" 00028 00029 class Client : public baseClient{ 00030 protected: 00031 /** The name and version of the client */ 00032 string name; 00033 00034 /** 00035 * @name Functions 00036 * The functions that the protocol may need 00037 * @{ 00038 */ 00039 void newCylinder(Message &msg); 00040 void grow(Message &msg); 00041 void sendEnergy(Message &msg); 00042 void move(Message &msg); 00043 void dropCylinder(Message &msg); 00044 void sendMessage(Message &msg); 00045 void clientLog(Message &msg); 00046 void endOfTurn(Message &msg); 00047 /** @} */ 00048 00049 public: 00050 Client(ost::TCPSocket &sock, World *w); 00051 ~Client(); 00052 00053 void sendMessage(const Message &msg){ ((Message *)&msg)->sendTo(stream); stream->sync(); }; 00054 virtual void Run(void); 00055 void initialize(); 00056 00057 string getName(){ return name; }; 00058 }; 00059 00060 00061 #endif