version 1.48 | | version 1.49 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.48 2001/10/07 06:45:40 mwedel Exp $"; | | * "$Id: main.c,v 1.49 2001/10/14 07:57:14 gros Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
new_draw_info(NDI_UNIQUE, 0,op,"Wacren@Gin.ObsPM.Fr (Laurent Wacrenier)"); | | new_draw_info(NDI_UNIQUE, 0,op,"Wacren@Gin.ObsPM.Fr (Laurent Wacrenier)"); |
new_draw_info(NDI_UNIQUE, 0,op,"thomas@astro.psu.edu (Brian Thomas)"); | | new_draw_info(NDI_UNIQUE, 0,op,"thomas@astro.psu.edu (Brian Thomas)"); |
new_draw_info(NDI_UNIQUE, 0,op,"jsm@axon.ksc.nasa.gov (John Steven Moerk)"); | | new_draw_info(NDI_UNIQUE, 0,op,"jsm@axon.ksc.nasa.gov (John Steven Moerk)"); |
| | new_draw_info(NDI_UNIQUE, 0,op,"Delbecq David [david.delbecq@mailandnews.com]"); |
| | new_draw_info(NDI_UNIQUE, 0,op,"Chachkoff Yann [yann.chachkoff@mailandnews.com]\n"); |
new_draw_info(NDI_UNIQUE, 0,op,"Images and art:"); | | new_draw_info(NDI_UNIQUE, 0,op,"Images and art:"); |
new_draw_info(NDI_UNIQUE, 0,op,"Peter Gardner"); | | new_draw_info(NDI_UNIQUE, 0,op,"Peter Gardner"); |
new_draw_info(NDI_UNIQUE, 0,op,"David Gervais [david_eg@mail.com]"); | | new_draw_info(NDI_UNIQUE, 0,op,"David Gervais [david_eg@mail.com]"); |
new_draw_info(NDI_UNIQUE, 0,op,"Mitsuhiro Itakura [ita@gold.koma.jaeri.go.jp]"); | | new_draw_info(NDI_UNIQUE, 0,op,"Mitsuhiro Itakura [ita@gold.koma.jaeri.go.jp]"); |
new_draw_info(NDI_UNIQUE, 0,op,"Hansjoerg Malthaner [hansjoerg.malthaner@danet.de]"); | | new_draw_info(NDI_UNIQUE, 0,op,"Hansjoerg Malthaner [hansjoerg.malthaner@danet.de]"); |
new_draw_info(NDI_UNIQUE, 0,op,"Mårten Woxberg [maxmc@telia.com]"); | | new_draw_info(NDI_UNIQUE, 0,op,"Mårten Woxberg [maxmc@telia.com]"); |
new_draw_info(NDI_UNIQUE, 0,op,"Delbecq David [david.delbecq@usa.net]"); | | |
new_draw_info(NDI_UNIQUE, 0,op,"Chachkoff Yann [yann.chachkoff@mailandnews.com]"); | | |
new_draw_info(NDI_UNIQUE, 0,op,"And many more!"); | | new_draw_info(NDI_UNIQUE, 0,op,"And many more!"); |
} | | } |
| | |
| | |
*/ | | */ |
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; |
| | 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) |
| | { |
| | /* GROS : Here we handle the MAPLEAVE global event */ |
| | evtid = EVENT_MAPLEAVE; |
| | CFP.Value[0] = (void *)(&evtid); |
| | CFP.Value[1] = (void *)(op); |
| | 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 */ |
| | evtid = EVENT_MAPENTER; |
| | CFP.Value[0] = (void *)(&evtid); |
| | CFP.Value[1] = (void *)(op); |
| | GlobalEvent(&CFP); |
| | #endif |
| | |
newmap->players++; | | newmap->players++; |
newmap->timeout=0; | | newmap->timeout=0; |
op->enemy = NULL; | | op->enemy = NULL; |
| | |
| | |
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; |
| | 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) |
| | { |
| | /* GROS : Here we handle the LOGOUT global event */ |
| | evtid = EVENT_LOGOUT; |
| | CFP.Value[0] = (void *)(&evtid); |
| | CFP.Value[1] = (void *)(pl); |
| | CFP.Value[2] = (void *)(pl->socket.host); |
| | 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); |
| | |
fix_luck(); | | fix_luck(); |
} | | } |
| | |
/* GROS: This is the new main function, used to start the Guile | | |
* subsystem. The "old" main has been renamed to main_crossfire | | |
*/ | | |
int main(int argc, char **argv) | | int main(int argc, char **argv) |
{ | | { |
gh_enter(argc, argv, main_crossfire); | | #ifdef PLUGINS |
return 0; | | int evtid; |
} | | CFParm CFP; |
| | #endif |
/* GROS: Note that the return type had to be changed from int | | |
* to void. | | |
*/ | | |
void main_crossfire(int argc,char **argv) | | |
{ | | |
#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); |
guile_init_functions(); /* GROS - Init the script interpreter */ | | #ifdef 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 */ |
| | #ifdef PLUGINS |
| | /* GROS : Here we handle the CLOCK global event */ |
| | evtid = EVENT_CLOCK; |
| | CFP.Value[0] = (void *)(&evtid); |
| | 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. */ |
| | |
sleep_delta(); /* Slepp proper amount of time before next tick */ | | sleep_delta(); /* Slepp proper amount of time before next tick */ |
} | | } |
| | return 0; |
} | | } |