trigroom.cpp
mud++0.33/src/trigroom.cpp · 4.2 KB
From the archive mud++0.33.tar.gz
Download the archive « Back to the archive contents
/*
....[@@@..[@@@..............[@.................. MUD++ is a written from
....[@..[@..[@..[@..[@..[@@@@@....[@......[@.... scratch multi-user swords and
....[@..[@..[@..[@..[@..[@..[@..[@@@@@..[@@@@@.. sorcery game written in C++.
....[@......[@..[@..[@..[@..[@....[@......[@.... This server is an ongoing
....[@......[@..[@@@@@..[@@@@@.................. development project. All
................................................ contributions are welcome.
....Copyright(C).1995.Melvin.Smith.............. Enjoy.
------------------------------------------------------------------------------
Melvin Smith (aka Fusion) msmith@hom.net
MUD++ development mailing list mudpp-list@mailhost.net
------------------------------------------------------------------------------
trigroom.cc
*/
#include "trigs.h"
#include "char.h"
#include "object.h"
#include "room.h"
#include "global.h"
bool rtrig_drop_recycle( Room * room, Char * who, Object * what )
{
who->out("You see as ");
who->out(what->getName() );
who->out(" bursts in flames and vanishes.\n\r");
room->outAllCharExcept("There was a sudden burst of flame from the corner.\n\r",
who, NULL);
what->extract();
what->fordelete();
// it is important to return true here, as we have taken
// care of all needed calls
return true;
}
/*
* Registration part
*/
trigfun_entry( rtrigT_update ) room_trigger_update[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_dropped_item ) room_trigger_dropped_item[] =
{
{"rtrig_drop_recycle", rtrig_drop_recycle},
{0, NULL}
};
trigfun_entry( rtrigT_picked_item ) room_trigger_picked_item[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_strange_cmd ) room_trigger_strange_cmd[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_said_in ) room_trigger_said_in[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_entered ) room_trigger_entered[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_left ) room_trigger_left[] =
{
{0, NULL }
};
trigfun_entry( rtrigT_socialed_in ) room_trigger_socialed_in[] =
{
{0, NULL }
};
void * lookupRtrig( int type, const char * name )
{
switch ( type )
{
default:
Cout << "Tried to lookup unknown room trigger table." << endl;
return NULL;
case RTRIG_UPDATE: returnLookupTrig( room_trigger_update, name);
case RTRIG_DROPPED_ITEM: returnLookupTrig( room_trigger_dropped_item, name);
case RTRIG_PICKED_ITEM: returnLookupTrig( room_trigger_picked_item, name);
case RTRIG_STRANGE_CMD: returnLookupTrig( room_trigger_strange_cmd, name);
case RTRIG_SAID_IN: returnLookupTrig( room_trigger_said_in, name);
case RTRIG_ENTERED: returnLookupTrig( room_trigger_entered, name);
case RTRIG_LEFT: returnLookupTrig( room_trigger_left, name);
case RTRIG_SOCIALED_IN: returnLookupTrig( room_trigger_socialed_in, name);
}
}
const char * lookupRtrigName( int type, void * fun)
{
switch ( type )
{
default:
Cout << "Tried to lookup unknown room trigger table." << endl;
return NULL;
case RTRIG_UPDATE: returnLookupTrigName( room_trigger_update, fun);
case RTRIG_DROPPED_ITEM: returnLookupTrigName( room_trigger_dropped_item, fun);
case RTRIG_PICKED_ITEM: returnLookupTrigName( room_trigger_picked_item, fun);
case RTRIG_STRANGE_CMD: returnLookupTrigName( room_trigger_strange_cmd, fun);
case RTRIG_SAID_IN: returnLookupTrigName( room_trigger_said_in, fun);
case RTRIG_ENTERED: returnLookupTrigName( room_trigger_entered, fun);
case RTRIG_LEFT: returnLookupTrigName( room_trigger_left, fun);
case RTRIG_SOCIALED_IN: returnLookupTrigName( room_trigger_socialed_in, fun);
}
}
const char * getRtrigName( int type, int index )
{
switch ( type )
{
default:
Cout << "Tried to lookup unknown room trigger table." << endl;
return NULL;
case RTRIG_UPDATE: return room_trigger_update[index].name;
case RTRIG_DROPPED_ITEM: return room_trigger_dropped_item[index].name;
case RTRIG_PICKED_ITEM: return room_trigger_picked_item[index].name;
case RTRIG_STRANGE_CMD: return room_trigger_strange_cmd[index].name;
case RTRIG_SAID_IN: return room_trigger_said_in[index].name;
case RTRIG_ENTERED: return room_trigger_entered[index].name;
case RTRIG_LEFT: return room_trigger_left[index].name;
case RTRIG_SOCIALED_IN: return room_trigger_socialed_in[index].name;
}
}