1 | /* |
1 | /* |
2 | * static char *rcsid_main_c = |
2 | * static char *rcsid_main_c = |
3 | * "$Id: main.C,v 1.8 2006/08/27 16:15:13 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 | { |
|
|
294 | INVOKE_PLAYER (LEAVE, op->contr, ARG_MAP (op->map)); |
|
|
295 | INVOKE_MAP (LEAVE, op->map, ARG_PLAYER (op->contr)); |
|
|
296 | } |
|
|
297 | |
296 | |
298 | /* 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 */ |
299 | op->x = x; |
298 | op->x = x; |
300 | op->y = y; |
299 | op->y = y; |
301 | op->map = newmap; |
300 | op->map = newmap; |
302 | 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); |
303 | |
302 | |
304 | INVOKE_PLAYER (ENTER, op->contr, ARG_MAP (op->map)); |
|
|
305 | INVOKE_MAP (ENTER, op->map, ARG_PLAYER (op->contr)); |
303 | INVOKE_MAP (ENTER, op->map, ARG_PLAYER (op->contr)); |
306 | |
304 | |
307 | if (!op->contr->hidden) |
305 | if (!op->contr->hidden) |
308 | newmap->players++; |
306 | newmap->players++; |
309 | |
307 | |
310 | newmap->timeout=0; |
308 | newmap->timeout=0; |
… | |
… | |
718 | /* It may be nice to support other creatures moving across |
716 | /* It may be nice to support other creatures moving across |
719 | * 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, |
720 | * so thta is an RFE. |
718 | * so thta is an RFE. |
721 | */ |
719 | */ |
722 | if (op->type != PLAYER) return; |
720 | if (op->type != PLAYER) return; |
723 | |
|
|
724 | /* Need to remove player from transport */ |
|
|
725 | if (op->contr->transport) apply_transport(op, op->contr->transport, AP_UNAPPLY); |
|
|
726 | |
721 | |
727 | /* 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 */ |
728 | if (exit_ob){ |
723 | if (exit_ob){ |
729 | |
724 | |
730 | /* check to see if we make a template map */ |
725 | /* check to see if we make a template map */ |
… | |
… | |
1314 | void server_tick () |
1309 | void server_tick () |
1315 | { |
1310 | { |
1316 | nroferrors = 0; |
1311 | nroferrors = 0; |
1317 | |
1312 | |
1318 | doeric_server(); |
1313 | doeric_server(); |
|
|
1314 | INVOKE_GLOBAL (CLOCK); |
1319 | process_events(NULL); /* "do" something with objects with speed */ |
1315 | process_events(NULL); /* "do" something with objects with speed */ |
1320 | cftimer_process_timers();/* Process the crossfire Timers */ |
|
|
1321 | /* Lauwenmark : Here we handle the CLOCK global event */ |
|
|
1322 | execute_global_event(EVENT_CLOCK); |
|
|
1323 | flush_sockets(); |
1316 | flush_sockets(); |
1324 | check_active_maps(); /* Removes unused maps after a certain timeout */ |
1317 | check_active_maps(); /* Removes unused maps after a certain timeout */ |
1325 | do_specials(); /* Routines called from time to time. */ |
1318 | do_specials(); /* Routines called from time to time. */ |
1326 | |
1319 | |
1327 | ++pticks; |
1320 | ++pticks; |
… | |
… | |
1332 | settings.argc = argc; |
1325 | settings.argc = argc; |
1333 | settings.argv = argv; |
1326 | settings.argv = argv; |
1334 | |
1327 | |
1335 | init (argc, argv); |
1328 | init (argc, argv); |
1336 | |
1329 | |
1337 | initPlugins (); /* GROS - Init the Plugins */ |
|
|
1338 | cfperl_init (); |
1330 | cfperl_init (); |
|
|
1331 | initPlugins (); |
1339 | |
1332 | |
1340 | for (;;) |
1333 | for (;;) |
1341 | cfperl_main (); |
1334 | cfperl_main (); |
1342 | |
1335 | |
1343 | // unreached |
1336 | // unreached |