version 1.100 | | version 1.101 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.100 2005/10/18 07:19:40 qal21 Exp $"; | | * "$Id: main.c,v 1.101 2005/10/18 16:54:31 gros 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; |
int evtid; | | |
CFParm CFP; | | |
| | |
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", |
| | |
remove_ob(op); | | remove_ob(op); |
if (op->map!=NULL) | | if (op->map!=NULL) |
{ | | { |
/* GROS : Here we handle the MAPLEAVE global event */ | | /* Lauwenmark : Here we handle the MAPLEAVE global event */ |
evtid = EVENT_MAPLEAVE; | | execute_global_event(EVENT_MAPLEAVE, op); |
CFP.Value[0] = (void *)(&evtid); | | } |
CFP.Value[1] = (void *)(op); | | |
GlobalEvent(&CFP); | | |
}; | | |
/* 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); |
| | |
/* GROS : Here we handle the MAPENTER global event */ | | /* Lauwenmark : Here we handle the MAPENTER global event */ |
evtid = EVENT_MAPENTER; | | execute_global_event(EVENT_MAPENTER, op); |
CFP.Value[0] = (void *)(&evtid); | | |
CFP.Value[1] = (void *)(op); | | |
GlobalEvent(&CFP); | | |
| | |
if (!op->contr->hidden) | | if (!op->contr->hidden) |
newmap->players++; | | newmap->players++; |
| | |
void enter_exit(object *op, object *exit_ob) { | | void enter_exit(object *op, object *exit_ob) { |
#define PORTAL_DESTINATION_NAME "Town portal destination" /* this one should really be in a header file */ | | #define PORTAL_DESTINATION_NAME "Town portal destination" /* this one should really be in a header file */ |
object *tmp; | | object *tmp; |
| | |
/* It may be nice to support other creatures moving across | | /* It may be nice to support other creatures moving across |
* exits, but right now a lot of the code looks at op->contr, | | * exits, but right now a lot of the code looks at op->contr, |
* so thta is an RFE. | | * so thta is an RFE. |
| | |
else | | else |
newmap = ready_map_name(EXIT_PATH(exit_ob), 0); | | newmap = ready_map_name(EXIT_PATH(exit_ob), 0); |
} | | } |
if (!newmap) { | | if (!newmap) |
| | { |
new_draw_info_format(NDI_UNIQUE, 0, op, "The %s is closed.", exit_ob->name); | | new_draw_info_format(NDI_UNIQUE, 0, op, "The %s is closed.", exit_ob->name); |
return; | | return; |
} | | } |
| | |
* us. | | * us. |
*/ | | */ |
newmap = ready_map_name(op->contr->maplevel, flags); | | newmap = ready_map_name(op->contr->maplevel, flags); |
if (!newmap) { | | if (!newmap) |
LOG(llevError,"enter_exit: Pathname to map does not exist! (%s)\n", op->contr->maplevel); | | { |
| | LOG(llevError, |
| | "enter_exit: Pathname to map does not exist! (%s)\n", |
| | op->contr->maplevel); |
newmap = ready_map_name(settings.emergency_mapname, 0); | | newmap = ready_map_name(settings.emergency_mapname, 0); |
op->x = settings.emergency_x; | | op->x = settings.emergency_x; |
op->y = settings.emergency_y; | | op->y = settings.emergency_y; |
| | |
| | |
void leave(player *pl, int draw_exit) { | | void leave(player *pl, int draw_exit) { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
int evtid; | | |
CFParm CFP; | | |
| | |
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 |
| | |
*/ | | */ |
if (draw_exit==0) | | if (draw_exit==0) |
{ | | { |
/* GROS : Here we handle the LOGOUT global event */ | | /* Lauwenmark : Here we handle the LOGOUT global event */ |
evtid = EVENT_LOGOUT; | | execute_global_event(EVENT_LOGOUT, pl, pl->socket.host); |
CFP.Value[0] = (void *)(&evtid); | | } |
CFP.Value[1] = (void *)(pl); | | |
CFP.Value[2] = (void *)(pl->socket.host); | | |
GlobalEvent(&CFP); | | |
}; | | |
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) |
{ | | { |
int evtid; | | |
CFParm CFP; | | |
#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 ; |
bRunning = 1; | | bRunning = 1; |
| | |
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 */ |
/* GROS : Here we handle the CLOCK global event */ | | /* Lauwenmark : Here we handle the CLOCK global event */ |
evtid = EVENT_CLOCK; | | execute_global_event(EVENT_CLOCK); |
CFP.Value[0] = (void *)(&evtid); | | |
GlobalEvent(&CFP); | | |
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. */ |
| | |