version 1.7 | | version 1.8 |
---|
| | |
/* | | /* |
* static char *rcsid_c_wiz_c = | | * static char *rcsid_c_wiz_c = |
* "$Id: c_wiz.c,v 1.7 2000/12/27 07:53:35 cvs Exp $"; | | * "$Id: c_wiz.c,v 1.8 2001/02/23 06:06:35 mwedel Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
} | | } |
| | |
if (m->in_memory != MAP_SWAPPED) { | | if (m->in_memory != MAP_SWAPPED) { |
player *pl; | | |
| | |
if(m->in_memory != MAP_IN_MEMORY) { | | if(m->in_memory != MAP_IN_MEMORY) { |
LOG(llevError,"Tried to swap out map which was not in memory.\n"); | | LOG(llevError,"Tried to swap out map which was not in memory.\n"); |
return 0; | | return 0; |
} | | } |
for(pl=first_player;pl!=NULL;pl=pl->next) | | /* Only attempt to remove the player that is doing the reset, and not other |
if(pl->ob == NULL || (!(QUERY_FLAG(pl->ob,FLAG_REMOVED)) && pl->ob->map == m)) { | | * players or wiz's. |
if (QUERY_FLAG(pl->ob,FLAG_WIZ)) { | | */ |
/* does not work if there are several dms in same map */ | | if (op->map == m ) { |
tmp = pl->ob; | | |
dummy=get_object(); | | dummy=get_object(); |
dummy->map = m; | | dummy->map = m; |
EXIT_X(dummy) = tmp->x; | | EXIT_X(dummy) = tmp->x; |
EXIT_Y(dummy) = tmp->y; | | EXIT_Y(dummy) = tmp->y; |
EXIT_PATH(dummy) = add_string (params); | | EXIT_PATH(dummy) = add_string(op->map->path); |
remove_ob (tmp); | | remove_ob(op); |
} else | | tmp=op; |
break; | | |
} | | } |
swap_map(m); | | swap_map(m); |
} | | } |
| | |
| | |
if (m->in_memory == MAP_SWAPPED) { | | if (m->in_memory == MAP_SWAPPED) { |
LOG(llevDebug,"Resetting map %s.\n",m->path); | | LOG(llevDebug,"Resetting map %s.\n",m->path); |
clean_tmp_map(m); | | clean_tmp_map(m); |
if (m->tmpname) free(m->tmpname); | | if (m->tmpname) free(m->tmpname); |
m->tmpname = NULL; | | m->tmpname = NULL; |
m->reset_time = 0; | | m->reset_time = 0; |
| | new_draw_info(NDI_UNIQUE, 0,op,"OK."); |
if (tmp) { | | if (tmp) { |
enter_exit(tmp, dummy); | | enter_exit(tmp, dummy); |
/* sigh - enter exit does not insert object | | |
if it is removed */ | | |
SET_FLAG(tmp, FLAG_NO_APPLY); | | |
insert_ob_in_map(tmp,tmp->map,NULL); | | |
CLEAR_FLAG(tmp, FLAG_NO_APPLY); | | |
free_object(dummy); | | free_object(dummy); |
} | | } |
| | |
new_draw_info(NDI_UNIQUE, 0,op,"OK."); | | |
return 1; | | return 1; |
| | } else { |
| | /* Need to re-insert player if swap failed for some reason */ |
| | if (tmp) { |
| | insert_ob_in_map(op, m, NULL); |
| | free_object(dummy); |
} | | } |
new_draw_info(NDI_UNIQUE, 0,op,"Reset failed, couldn't swap map.\n"); | | new_draw_info(NDI_UNIQUE, 0,op,"Reset failed, couldn't swap map.\n"); |
| | new_draw_info(NDI_UNIQUE, 0,op,"Probably another player is on the map\n"); |
return 1; | | return 1; |
} | | } |
| | } |
| | |
int command_nowiz (object *op, char *params) /* 'noadm' is alias */ | | int command_nowiz (object *op, char *params) /* 'noadm' is alias */ |
{ | | { |