Files
pvvmud/gos/gosmessage.C
2025-03-05 08:37:43 +01:00

66 lines
1.9 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 <stdio.h>
#include "gosmessage.H"
#include "gos.H"
#include "gosmanager.H"
///////////////////////////////////////////////////////////////////////////////
// MsgGOSRequestGOS
CMsgGOSRequestGOS::CMsgGOSRequestGOS():CMsgGOSRequest(){
}
CMsgGOSRequestGOS * CMsgGOSRequestGOS::createMsg(){
return new CMsgGOSRequestGOS();
}
int CMsgGOSRequestGOS::executeMsg(){
static char * GOSRequestName[] = {"geometry","material","texture"};
CGOSCliManager * manager = (CGOSCliManager*)getManager();
printf("Client %i request for %s %i\n",manager->getId(),GOSRequestName[getRequestType()],getObjectId());
CGOS * gos = manager->getGOS();
CMessage * msg = NULL;
switch(getRequestType()){
case GOSREQUEST_GEOMETRY:
msg = gos->getGeometry(getObjectId());
break;
case GOSREQUEST_MATERIAL:
msg = gos->getMaterial(getObjectId());
break;
case GOSREQUEST_TEXTURE:
msg = gos->getTexture(getObjectId());
break;
}
if (msg != NULL) manager->sendMsg(msg);
else {
printf("Request FAILED!!!!!!!\n");
manager->sendMsg(new CMsgGOSError('A'));
}
return TRUE;
}