1 | /* |
1 | /* |
2 | * static char *rcsid_main_c = |
2 | * static char *rcsid_main_c = |
3 | * "$Id: main.C,v 1.7 2006/08/26 08:44:06 root Exp $"; |
3 | * "$Id: main.C,v 1.13 2006/08/29 07:34:00 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
280 | LOG(llevInfo,"enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", |
280 | LOG(llevInfo,"enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", |
281 | newmap->path, x , y); |
281 | newmap->path, x , y); |
282 | } |
282 | } |
283 | } /* end if looking for free spot */ |
283 | } /* end if looking for free spot */ |
284 | |
284 | |
|
|
285 | if (op->map!=NULL) |
|
|
286 | { |
|
|
287 | INVOKE_PLAYER (MAP_CHANGE, op->contr, ARG_MAP (op->map), ARG_MAP (newmap)); |
|
|
288 | INVOKE_MAP (LEAVE, op->map, ARG_PLAYER (op->contr)); |
|
|
289 | } |
285 | |
290 | |
286 | /* If it is a player login, he has yet to be inserted anyplace. |
291 | /* If it is a player login, he has yet to be inserted anyplace. |
287 | * otherwise, we need to deal with removing the playe here. |
292 | * otherwise, we need to deal with removing the player here. |
288 | */ |
293 | */ |
289 | if(!QUERY_FLAG(op, FLAG_REMOVED)) |
294 | if(!QUERY_FLAG(op, FLAG_REMOVED)) |
290 | remove_ob(op); |
295 | remove_ob(op); |
291 | |
|
|
292 | if (op->map!=NULL) |
|
|
293 | INVOKE_PLAYER (LEAVE, op->contr); |
|
|
294 | |
296 | |
295 | /* remove_ob clears these so they must be reset after the remove_ob call */ |
297 | /* remove_ob clears these so they must be reset after the remove_ob call */ |
296 | op->x = x; |
298 | op->x = x; |
297 | op->y = y; |
299 | op->y = y; |
298 | op->map = newmap; |
300 | op->map = newmap; |
299 | insert_ob_in_map(op,op->map,NULL,INS_NO_WALK_ON); |
301 | insert_ob_in_map(op,op->map,NULL,INS_NO_WALK_ON); |
300 | |
302 | |
301 | INVOKE_PLAYER (ENTER, op->contr); |
303 | INVOKE_MAP (ENTER, op->map, ARG_PLAYER (op->contr)); |
302 | |
304 | |
303 | if (!op->contr->hidden) |
305 | if (!op->contr->hidden) |
304 | newmap->players++; |
306 | newmap->players++; |
305 | |
307 | |
306 | newmap->timeout=0; |
308 | newmap->timeout=0; |
… | |
… | |
714 | /* It may be nice to support other creatures moving across |
716 | /* It may be nice to support other creatures moving across |
715 | * exits, but right now a lot of the code looks at op->contr, |
717 | * exits, but right now a lot of the code looks at op->contr, |
716 | * so thta is an RFE. |
718 | * so thta is an RFE. |
717 | */ |
719 | */ |
718 | if (op->type != PLAYER) return; |
720 | if (op->type != PLAYER) return; |
719 | |
|
|
720 | /* Need to remove player from transport */ |
|
|
721 | if (op->contr->transport) apply_transport(op, op->contr->transport, AP_UNAPPLY); |
|
|
722 | |
721 | |
723 | /* First, lets figure out what map the player is going to go to */ |
722 | /* First, lets figure out what map the player is going to go to */ |
724 | if (exit_ob){ |
723 | if (exit_ob){ |
725 | |
724 | |
726 | /* check to see if we make a template map */ |
725 | /* check to see if we make a template map */ |
… | |
… | |
1310 | void server_tick () |
1309 | void server_tick () |
1311 | { |
1310 | { |
1312 | nroferrors = 0; |
1311 | nroferrors = 0; |
1313 | |
1312 | |
1314 | doeric_server(); |
1313 | doeric_server(); |
|
|
1314 | INVOKE_GLOBAL (CLOCK); |
1315 | process_events(NULL); /* "do" something with objects with speed */ |
1315 | process_events(NULL); /* "do" something with objects with speed */ |
1316 | cftimer_process_timers();/* Process the crossfire Timers */ |
|
|
1317 | /* Lauwenmark : Here we handle the CLOCK global event */ |
|
|
1318 | execute_global_event(EVENT_CLOCK); |
|
|
1319 | flush_sockets(); |
1316 | flush_sockets(); |
1320 | check_active_maps(); /* Removes unused maps after a certain timeout */ |
1317 | check_active_maps(); /* Removes unused maps after a certain timeout */ |
1321 | do_specials(); /* Routines called from time to time. */ |
1318 | do_specials(); /* Routines called from time to time. */ |
1322 | |
1319 | |
1323 | ++pticks; |
1320 | ++pticks; |
… | |
… | |
1328 | settings.argc = argc; |
1325 | settings.argc = argc; |
1329 | settings.argv = argv; |
1326 | settings.argv = argv; |
1330 | |
1327 | |
1331 | init (argc, argv); |
1328 | init (argc, argv); |
1332 | |
1329 | |
1333 | initPlugins (); /* GROS - Init the Plugins */ |
|
|
1334 | cfperl_init (); |
1330 | cfperl_init (); |
|
|
1331 | initPlugins (); |
1335 | |
1332 | |
1336 | for (;;) |
1333 | for (;;) |
1337 | cfperl_main (); |
1334 | cfperl_main (); |
1338 | |
1335 | |
1339 | // unreached |
1336 | // unreached |