/* * 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 "worldsrvmessage.H" #include "worldsrv.H" #include "worldsrvmanager.H" /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvHello CMsgWorldSrvHello::CMsgWorldSrvHello():CMsgHello(){ } CMsgWorldSrvHello * CMsgWorldSrvHello::createMsg(){ return new CMsgWorldSrvHello(); } int CMsgWorldSrvHello::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->hello(); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvGOSInfo CMsgWorldSrvGOSInfo::CMsgWorldSrvGOSInfo():CMsgGOSInfo(){ } CMsgWorldSrvGOSInfo * CMsgWorldSrvGOSInfo::createMsg(){ return new CMsgWorldSrvGOSInfo(); } int CMsgWorldSrvGOSInfo::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->GOSInfo(*getGOSAddress()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvCommand CMsgWorldSrvCommand::CMsgWorldSrvCommand():CMsgCommand(){ } CMsgWorldSrvCommand * CMsgWorldSrvCommand::createMsg(){ return new CMsgWorldSrvCommand(); } int CMsgWorldSrvCommand::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); switch (getCommand()){ case MSGCOMMAND_ADDWORLD: manager->getWorldSrv()->createWorld(); break; case MSGCOMMAND_REMOVEWORLD: cout << "CMsgWorldSrvCommand::executeMsg : Not implemented!!\n"; break; } return TRUE; } /* /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvCell CMsgWorldSrvCell::CMsgWorldSrvCell():CMsgCell(){ } CMsgWorldSrvCell * CMsgWorldSrvCell::createMsg(){ return new CMsgWorldSrvCell(); } int CMsgWorldSrvCell::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->addCell(getCellId(),getGeometryId()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvRemoveCell CMsgWorldSrvRemoveCell::CMsgWorldSrvRemoveCell():CMsgRemoveCell(){ } CMsgWorldSrvRemoveCell * CMsgWorldSrvRemoveCell::createMsg(){ return new CMsgWorldSrvRemoveCell(); } int CMsgWorldSrvRemoveCell::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->removeCell(getCellId()); return TRUE; } */ /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvObject CMsgWorldSrvObject::CMsgWorldSrvObject():CMsgObject(){ } CMsgWorldSrvObject * CMsgWorldSrvObject::createMsg(){ return new CMsgWorldSrvObject(); } int CMsgWorldSrvObject::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->addObject(getObjectId(),getGeometryId(),getParentId(), getPosition(),getDirection()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvRemoveObject CMsgWorldSrvRemoveObject::CMsgWorldSrvRemoveObject():CMsgRemoveObject(){ } CMsgWorldSrvRemoveObject * CMsgWorldSrvRemoveObject::createMsg(){ return new CMsgWorldSrvRemoveObject(); } int CMsgWorldSrvRemoveObject::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->removeObject(getObjectId(),getParentId()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvPVCell CMsgWorldSrvPVCell::CMsgWorldSrvPVCell():CMsgPVCell(){ } CMsgWorldSrvPVCell * CMsgWorldSrvPVCell::createMsg(){ return new CMsgWorldSrvPVCell(); } int CMsgWorldSrvPVCell::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->addPVCell(getCellId(),getPVCellId(),getPosition()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvUpdatePosition CMsgWorldSrvUpdatePosition::CMsgWorldSrvUpdatePosition():CMsgUpdatePosition(){ } CMsgWorldSrvUpdatePosition * CMsgWorldSrvUpdatePosition::createMsg(){ return new CMsgWorldSrvUpdatePosition(); } int CMsgWorldSrvUpdatePosition::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->updatePosition(getObjectId(),getPosition()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvUpdateDirection CMsgWorldSrvUpdateDirection::CMsgWorldSrvUpdateDirection():CMsgUpdateDirection(){ } CMsgWorldSrvUpdateDirection * CMsgWorldSrvUpdateDirection::createMsg(){ return new CMsgWorldSrvUpdateDirection(); } int CMsgWorldSrvUpdateDirection::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->updateDirection(getObjectId(),getDirection()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvUpdateHierarchy CMsgWorldSrvUpdateHierarchy::CMsgWorldSrvUpdateHierarchy():CMsgUpdateHierarchy(){ } CMsgWorldSrvUpdateHierarchy * CMsgWorldSrvUpdateHierarchy::createMsg(){ return new CMsgWorldSrvUpdateHierarchy(); } int CMsgWorldSrvUpdateHierarchy::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->updateHierarchy(getObjectId(),getParentId()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvPong CMsgWorldSrvPong::CMsgWorldSrvPong():CMsgPong(){ } CMsgWorldSrvPong * CMsgWorldSrvPong::createMsg(){ return new CMsgWorldSrvPong(); } int CMsgWorldSrvPong::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->pong(getSequenceNumber(),getServerTime()); return TRUE; } /////////////////////////////////////////////////////////////////////////////// // MsgWorldSrvRotate CMsgWorldSrvRotate::CMsgWorldSrvRotate():CMsgRotate(){ } CMsgWorldSrvRotate * CMsgWorldSrvRotate::createMsg(){ return new CMsgWorldSrvRotate(); } int CMsgWorldSrvRotate::executeMsg(){ CWorldSrvManager * manager = (CWorldSrvManager*)getManager(); manager->getWorldSrv()->rotate(getObjectId(),getAngleSpeed()); return TRUE; }