Recovered from microbel
This commit is contained in:
234
client/coreclient/cliworldmessage.C
Normal file
234
client/coreclient/cliworldmessage.C
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* 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 <iostream.h>
|
||||
#include "cliworldmessage.H"
|
||||
#include "cliworldmanager.H"
|
||||
|
||||
CMsgCliWorldHello::CMsgCliWorldHello():CMsgHello(){
|
||||
}
|
||||
|
||||
CMsgCliWorldHello * CMsgCliWorldHello::createMsg(){
|
||||
return new CMsgCliWorldHello();
|
||||
}
|
||||
|
||||
|
||||
int CMsgCliWorldHello::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
if (getVersion() != PROTOCOL_VERSION){
|
||||
cdebug << "ERROR: Wrong protocol version!\n";
|
||||
exit(2);
|
||||
}
|
||||
manager->hello();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldCell
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldCell::CMsgCliWorldCell():CMsgCell(){
|
||||
}
|
||||
|
||||
CMsgCliWorldCell * CMsgCliWorldCell::createMsg(){
|
||||
return new CMsgCliWorldCell();
|
||||
}
|
||||
|
||||
int CMsgCliWorldCell::executeMsg(){
|
||||
cdebug << "Cell " << getCellId() << " with geometry " << getGeometryId()
|
||||
<< " with position " << getPosition() <<"\n";
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
CWorldObject * cell = manager->getWorld()->addCell(getCellId(),getGeometryId());
|
||||
cell->setPosition(getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRemoveCell
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRemoveCell::CMsgCliWorldRemoveCell():CMsgRemoveCell(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRemoveCell * CMsgCliWorldRemoveCell::createMsg(){
|
||||
return new CMsgCliWorldRemoveCell();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRemoveCell::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->removeCell(getCellId());
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldObject
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldObject::CMsgCliWorldObject():CMsgObject(){
|
||||
}
|
||||
|
||||
CMsgCliWorldObject * CMsgCliWorldObject::createMsg(){
|
||||
return new CMsgCliWorldObject();
|
||||
}
|
||||
|
||||
int CMsgCliWorldObject::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
cdebug << "Object " << getObjectId() << " with parent " << getParentId() << " with geometry " << getGeometryId()
|
||||
<< " with position " << getPosition() <<" with direction " << getDirection() << "\n";
|
||||
if (manager->getWorld()->createObject(getParentId(),"object",getObjectId(),
|
||||
getGeometryId(),getPosition(),
|
||||
getDirection())==NULL){
|
||||
cdebug << "Failed to create object " << getObjectId() << "\n";
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRemoveObject
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRemoveObject::CMsgCliWorldRemoveObject():CMsgRemoveObject(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRemoveObject * CMsgCliWorldRemoveObject::createMsg(){
|
||||
return new CMsgCliWorldRemoveObject();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRemoveObject::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
cdebug << "REMOVE : Object: " << getObjectId() << " Parent: " << getParentId() << "\n";
|
||||
manager->getWorld()->removeObject(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdatePosition
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdatePosition::CMsgCliWorldUpdatePosition():CMsgUpdatePosition(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdatePosition * CMsgCliWorldUpdatePosition::createMsg(){
|
||||
return new CMsgCliWorldUpdatePosition();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdatePosition::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updatePosition(getObjectId(),getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdateDirection
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdateDirection::CMsgCliWorldUpdateDirection():CMsgUpdateDirection(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdateDirection * CMsgCliWorldUpdateDirection::createMsg(){
|
||||
return new CMsgCliWorldUpdateDirection();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdateDirection::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updateDirection(getObjectId(),getDirection());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdateHierarchy
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdateHierarchy::CMsgCliWorldUpdateHierarchy():CMsgUpdateHierarchy(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdateHierarchy * CMsgCliWorldUpdateHierarchy::createMsg(){
|
||||
return new CMsgCliWorldUpdateHierarchy();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdateHierarchy::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updateHierarchy(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldPong
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldPong::CMsgCliWorldPong():CMsgPong(){
|
||||
}
|
||||
|
||||
CMsgCliWorldPong * CMsgCliWorldPong::createMsg(){
|
||||
return new CMsgCliWorldPong();
|
||||
}
|
||||
|
||||
int CMsgCliWorldPong::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->pong(getSequenceNumber(),getServerTime());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRotate
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRotate::CMsgCliWorldRotate():CMsgRotate(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRotate * CMsgCliWorldRotate::createMsg(){
|
||||
return new CMsgCliWorldRotate();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRotate::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->rotate(getObjectId(),getAngleSpeed());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user