/* * 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 <stdlib.h> #include <iostream.h> #include "srvclimanager.H" #include "msgsrvcli.H" #include "msgmsg.H" #include "srvclimessage.H" #include "player.H" /****************************************************************************** * * CMsgLoginSrv * ******************************************************************************/ CMsgLoginSrv::CMsgLoginSrv():CMsgLogin(){ } CMsgLoginSrv * CMsgLoginSrv::createMsg(){ return new CMsgLoginSrv(); } int CMsgLoginSrv::executeMsg(){ cdebug << "Execute MsgLoginSrv: Name " << getUserName() << "\n"; CClientManager * manager = (CClientManager*)getManager(); manager->login(getUserName(),getPasswd(),getNewUser()); return TRUE; } /****************************************************************************** * * CMsgByeSrv * ******************************************************************************/ CMsgByeSrv::CMsgByeSrv():CMsgBye(){ } CMsgByeSrv * CMsgByeSrv::createMsg(){ return new CMsgByeSrv(); } int CMsgByeSrv::executeMsg(){ cdebug << "Execute MsgByeSrv\n"; CClientManager * manager = (CClientManager*)getManager(); manager->logout(); return TRUE; } /****************************************************************************** * * CMsgGetWorldSrv * ******************************************************************************/ CMsgGetWorldSrv::CMsgGetWorldSrv():CMsgGetWorld(){ } CMsgGetWorldSrv * CMsgGetWorldSrv::createMsg(){ return new CMsgGetWorldSrv(); } int CMsgGetWorldSrv::executeMsg(){ cdebug << "Execute MsgGetWorldSrv\n"; CClientManager * manager = (CClientManager*)getManager(); manager->sendWorld(); return TRUE; } /****************************************************************************** * * CMsgCommandSrv * ******************************************************************************/ CMsgCommandSrv::CMsgCommandSrv():CMsgCommand(){ } CMsgCommandSrv * CMsgCommandSrv::createMsg(){ return new CMsgCommandSrv(); } int CMsgCommandSrv::executeMsg(){ cdebug << "Execute MsgCommandSrv: " << getCommand() << "\n"; CClientManager * manager = (CClientManager*)getManager(); manager->userCommand(getCommand()); return TRUE; } /****************************************************************************** * * CMsgSelectionSrv * ******************************************************************************/ CMsgSelectionSrv::CMsgSelectionSrv():CMsgSelection(){ } CMsgSelectionSrv * CMsgSelectionSrv::createMsg(){ return new CMsgSelectionSrv(); } int CMsgSelectionSrv::executeMsg(){ cdebug << "Execute MsgSelectionSrv: " << getObjectId() << "\n"; CClientManager * manager = (CClientManager*)getManager(); manager->selection(getObjectId()); return TRUE; } /****************************************************************************** * * CMsgActionSrv * ******************************************************************************/ CMsgActionSrv::CMsgActionSrv():CMsgAction(){ } CMsgActionSrv * CMsgActionSrv::createMsg(){ return new CMsgActionSrv(); } int CMsgActionSrv::executeMsg(){ cdebug << "Execute MsgActionSrv: object " << getObjectId() << " action " << getActionId() << "\n"; CClientManager * manager = (CClientManager*)getManager(); manager->action(getObjectId(),getActionId()); return TRUE; } /****************************************************************************** * * CMsgMsgSrv * ******************************************************************************/ CMsgMsgSrv::CMsgMsgSrv():CMsgMsg(){ } CMsgMsgSrv * CMsgMsgSrv::createMsg(){ return new CMsgMsgSrv(); } int CMsgMsgSrv::executeMsg(){ char * msg = (char*)malloc(getMsgLength()); getMsg(msg); cout << "Execute MsgMsgSrv: " << msg << "\n"; CClientManager * manager = (CClientManager*)getManager(); manager->userCommand(msg); free(msg); return TRUE; }