version 1.68 | | version 1.69 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.68 2002/11/13 04:57:32 garbled Exp $"; | | * "$Id: main.c,v 1.69 2002/11/26 08:48:20 garbled Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
static void enter_map(object *op, mapstruct *newmap, int x, int y) { | | static void enter_map(object *op, mapstruct *newmap, int x, int y) { |
mapstruct *oldmap = op->map; | | mapstruct *oldmap = op->map; |
#ifdef PLUGINS | | |
int evtid; | | int evtid; |
CFParm CFP; | | CFParm CFP; |
#endif | | |
| | |
if (out_of_map(newmap, x, y)) { | | if (out_of_map(newmap, x, y)) { |
LOG(llevError,"enter_map: supplied coordinates are not within the map! (%s: %d, %d)\n", | | LOG(llevError,"enter_map: supplied coordinates are not within the map! (%s: %d, %d)\n", |
| | |
*/ | | */ |
if(!QUERY_FLAG(op, FLAG_REMOVED)) | | if(!QUERY_FLAG(op, FLAG_REMOVED)) |
remove_ob(op); | | remove_ob(op); |
#ifdef PLUGINS | | |
if (op->map!=NULL) | | if (op->map!=NULL) |
{ | | { |
/* GROS : Here we handle the MAPLEAVE global event */ | | /* GROS : Here we handle the MAPLEAVE global event */ |
| | |
CFP.Value[1] = (void *)(op); | | CFP.Value[1] = (void *)(op); |
GlobalEvent(&CFP); | | GlobalEvent(&CFP); |
}; | | }; |
#endif | | |
/* remove_ob clears these so they must be reset after the remove_ob call */ | | /* remove_ob clears these so they must be reset after the remove_ob call */ |
op->x = x; | | op->x = x; |
op->y = y; | | op->y = y; |
op->map = newmap; | | op->map = newmap; |
insert_ob_in_map(op,op->map,NULL,INS_NO_WALK_ON); | | insert_ob_in_map(op,op->map,NULL,INS_NO_WALK_ON); |
| | |
#ifdef PLUGINS | | |
/* GROS : Here we handle the MAPENTER global event */ | | /* GROS : Here we handle the MAPENTER global event */ |
evtid = EVENT_MAPENTER; | | evtid = EVENT_MAPENTER; |
CFP.Value[0] = (void *)(&evtid); | | CFP.Value[0] = (void *)(&evtid); |
CFP.Value[1] = (void *)(op); | | CFP.Value[1] = (void *)(op); |
GlobalEvent(&CFP); | | GlobalEvent(&CFP); |
#endif | | |
| | |
if (!op->contr->hidden) | | if (!op->contr->hidden) |
newmap->players++; | | newmap->players++; |
| | |
| | |
void leave(player *pl, int draw_exit) { | | void leave(player *pl, int draw_exit) { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
#ifdef PLUGINS | | |
int evtid; | | int evtid; |
CFParm CFP; | | CFParm CFP; |
#endif | | |
if (pl!=NULL) { | | if (pl!=NULL) { |
/* We do this so that the socket handling routine can do the final | | /* We do this so that the socket handling routine can do the final |
* cleanup. We also leave that loop to actually handle the freeing | | * cleanup. We also leave that loop to actually handle the freeing |
* of the data. | | * of the data. |
*/ | | */ |
#ifdef PLUGINS | | |
if (draw_exit==0) | | if (draw_exit==0) |
{ | | { |
/* GROS : Here we handle the LOGOUT global event */ | | /* GROS : Here we handle the LOGOUT global event */ |
| | |
CFP.Value[2] = (void *)(pl->socket.host); | | CFP.Value[2] = (void *)(pl->socket.host); |
GlobalEvent(&CFP); | | GlobalEvent(&CFP); |
}; | | }; |
#endif | | |
pl->socket.status=Ns_Dead; | | pl->socket.status=Ns_Dead; |
LOG(llevInfo,"LOGOUT: Player named %s from ip %s\n", pl->ob->name, | | LOG(llevInfo,"LOGOUT: Player named %s from ip %s\n", pl->ob->name, |
pl->socket.host); | | pl->socket.host); |
| | |
| | |
int main(int argc, char **argv) | | int main(int argc, char **argv) |
{ | | { |
#ifdef PLUGINS | | |
int evtid; | | int evtid; |
CFParm CFP; | | CFParm CFP; |
#endif | | |
#ifdef WIN32 /* ---win32 this sets the win32 from 0d0a to 0a handling */ | | #ifdef WIN32 /* ---win32 this sets the win32 from 0d0a to 0a handling */ |
_fmode = _O_BINARY ; | | _fmode = _O_BINARY ; |
#endif | | #endif |
| | |
settings.argc=argc; | | settings.argc=argc; |
settings.argv=argv; | | settings.argv=argv; |
init(argc, argv); | | init(argc, argv); |
#ifdef PLUGINS | | |
initPlugins(); /* GROS - Init the Plugins */ | | initPlugins(); /* GROS - Init the Plugins */ |
#endif | | |
for(;;) { | | for(;;) { |
nroferrors = 0; | | nroferrors = 0; |
| | |
doeric_server(); | | doeric_server(); |
process_events(NULL); /* "do" something with objects with speed */ | | process_events(NULL); /* "do" something with objects with speed */ |
cftimer_process_timers();/* Process the crossfire Timers */ | | cftimer_process_timers();/* Process the crossfire Timers */ |
#ifdef PLUGINS | | |
/* GROS : Here we handle the CLOCK global event */ | | /* GROS : Here we handle the CLOCK global event */ |
evtid = EVENT_CLOCK; | | evtid = EVENT_CLOCK; |
CFP.Value[0] = (void *)(&evtid); | | CFP.Value[0] = (void *)(&evtid); |
GlobalEvent(&CFP); | | GlobalEvent(&CFP); |
#endif | | |
check_active_maps(); /* Removes unused maps after a certain timeout */ | | check_active_maps(); /* Removes unused maps after a certain timeout */ |
do_specials(); /* Routines called from time to time. */ | | do_specials(); /* Routines called from time to time. */ |
| | |