76 lines
2.4 KiB
C
76 lines
2.4 KiB
C
/*
|
|
* 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 "pvvmud.H"
|
|
#include "clisrvprotocol.H"
|
|
#include "clisrvmessage.H"
|
|
|
|
CCliSrvProtocol::CCliSrvProtocol(CSocket * socket,CTimeKeeper * timeKeeper)
|
|
:CCommunicate(socket,timeKeeper){
|
|
addMsg((MsgCreateFunc_t)CMsgHelloCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgByeCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgCommandCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgViewpointCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgMsgCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgActionListCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgServerInfoCli::createMsg);
|
|
addMsg((MsgCreateFunc_t)CMsgPlayerInfoCli::createMsg);
|
|
}
|
|
|
|
void CCliSrvProtocol::login(char * name, char * passwd,BOOL newUser){
|
|
CMsgLogin * msg = new CMsgLogin(name,passwd,newUser);
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::bye(){
|
|
CMsgBye * msg = new CMsgBye();
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendOnline(){
|
|
CMsgCommand * msg = new CMsgCommand(MSGCOMMAND_ONLINE);
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendGetWorld(){
|
|
CMsgGetWorld * msg = new CMsgGetWorld();
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendCommand(int command){
|
|
CMsgCommand * msg = new CMsgCommand(command);
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendSelection(int objectId){
|
|
CMsgSelection * msg = new CMsgSelection(objectId);
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendAction(int objectId,int actionId){
|
|
CMsgAction * msg = new CMsgAction(objectId,actionId);
|
|
sendMessage(msg,TRUE);
|
|
}
|
|
|
|
void CCliSrvProtocol::sendMsg(const char *msg){
|
|
CMsgMsg * msgmsg = new CMsgMsg(msg);
|
|
sendMessage(msgmsg,TRUE);
|
|
}
|
|
|