/* * PVVMUD a 3D MUD * Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "server.H" #include <iostream.h> #include "srvcliprotocol.H" #include "msgmsg.H" #include "srvclimessage.H" #include "msgworld.H" #include "action.H" #include "msgactionlist.H" CSrvProtocol::CSrvProtocol(CSocket * socket,CTimeKeeper * timeKeeper) : CCommunicate(socket,timeKeeper) { addMsg((MsgCreateFunc_t)CMsgLoginSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgByeSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgGetWorldSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgCommandSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgSelectionSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgActionSrv::createMsg); addMsg((MsgCreateFunc_t)CMsgMsgSrv::createMsg); } CSrvProtocol::~CSrvProtocol(){ } void CSrvProtocol::quit(){ CClientManager * manager = (CClientManager*)getManager(); manager->quit(); } void CSrvProtocol::sendHello(){ CMsgHello * msg = new CMsgHello(PROTOCOL_VERSION); sendMessage(msg,TRUE); } void CSrvProtocol::sendServerInfo(CInetAddress &worldSrvAddress, CInetAddress &gosAddress){ CMsgServerInfo * msg = new CMsgServerInfo(worldSrvAddress,gosAddress); sendMessage(msg,TRUE); } void CSrvProtocol::sendBye(WORD reason){ CMsgBye * msg = new CMsgBye(reason); sendMessage(msg,TRUE); } void CSrvProtocol::sendViewpoint(CViewpoint * viewpoint){ CMsgViewpoint * msg = new CMsgViewpoint( *viewpoint ); sendMessage(msg,TRUE); } void CSrvProtocol::sendClearWorld(){ CMsgCommand * msg = new CMsgCommand(MSGCOMMAND_CLIENTCLEARWORLD); sendMessage(msg,TRUE); } void CSrvProtocol::sendPlayerInfo( DWORD masterCellId ){ CMsgPlayerInfo * msg = new CMsgPlayerInfo(masterCellId); sendMessage(msg,TRUE); } void CSrvProtocol::sendObjectCommands( CWorldObject * object ){ CMsgActionList * msg = new CMsgActionList(object->getGeometryId()); cdebug << "Get action list in sendObjectCommands not implemented!!!!\n"; /* CActionList * actionList = object->getActionList(); if (actionList != NULL){ CObjectListItem * item = actionList->getFirst(); while (item != NULL){ CAction * action = (CAction*)item->getObject(); msg->addAction(action); item = item->getNext(); } } */ sendMessage(msg,TRUE); } void CSrvProtocol::sendMsg( const char * message ){ CMsgMsg * msg = new CMsgMsg(message); sendMessage(msg,TRUE); }