--- deliantra/server/random_maps/exit.C 2006/08/13 17:16:03 1.1 +++ deliantra/server/random_maps/exit.C 2006/09/03 00:18:41 1.3 @@ -1,6 +1,6 @@ /* * static char *rcsid_exit_c = - * "$Id: exit.C,v 1.1 2006/08/13 17:16:03 elmex Exp $"; + * "$Id: exit.C,v 1.3 2006/09/03 00:18:41 root Exp $"; */ /* @@ -119,7 +119,7 @@ int final_map_exit=1; if(RP->exit_on_final_map){ - if(strstr(RP->exit_on_final_map,"no")) final_map_exit=0; + if(strstr(RP->exit_on_final_map,"no")) final_map_exit=0; } if(orientation == 0) orientation = RANDOM() % 6 + 1; @@ -169,7 +169,7 @@ /* set up the up exit */ the_exit_up->stats.hp = RP->origin_x; the_exit_up->stats.sp = RP->origin_y; - the_exit_up->slaying = add_string(RP->origin_map); + the_exit_up->slaying = RP->origin_map; /* figure out where to put the entrance */ /* begin a logical block */ @@ -210,10 +210,10 @@ random_sign = get_archetype("sign"); random_sign->x = the_exit_up->x+freearr_x[j]; random_sign->y = the_exit_up->y+freearr_y[j]; - - sprintf(buf,"This is a random map.\nLevel: %d\n", (RP->dungeon_level)-1); + + sprintf(buf,"This is a random map.\nLevel: %d\n", (RP->dungeon_level)-1); - random_sign->msg = add_string(buf); + random_sign->msg = buf; insert_ob_in_map(random_sign,map,NULL,0); } } @@ -259,17 +259,17 @@ RP->origin_x = the_exit_down->x; RP->origin_y = the_exit_down->y; write_map_parameters_to_string(buf,RP); - the_exit_down->msg = add_string(buf); + the_exit_down->msg = buf; /* the identifier for making a random map. */ if(RP->dungeon_level >= RP->dungeon_depth && RP->final_map[0]!=0) { mapstruct *new_map; object *the_exit_back = arch_to_object(the_exit_up->arch), *tmp; #if 0 - /* I'm not sure if there was any reason to change the path to the - * map other than to maybe make it more descriptive in the 'maps' - * command. But changing the map name makes life more complicated, - * (has_been_loaded needs to use the new name) - */ + /* I'm not sure if there was any reason to change the path to the + * map other than to maybe make it more descriptive in the 'maps' + * command. But changing the map name makes life more complicated, + * (has_been_loaded needs to use the new name) + */ char new_map_name[MAX_BUF]; /* give the final map a name */ @@ -278,39 +278,40 @@ #endif /* load it */ if((new_map=ready_map_name(RP->final_map,0)) == NULL) - return; + return; - the_exit_down->slaying = add_string(RP->final_map); + the_exit_down->slaying = RP->final_map; strcpy(new_map->path,RP->final_map); - for (tmp=GET_MAP_OB(new_map, MAP_ENTER_X(new_map), MAP_ENTER_Y(new_map)); tmp; tmp=tmp->above) - /* Remove exit back to previous random map. There should only be one - * which is why we break out. To try to process more than one - * would require keeping a 'next' pointer, ad free_object kills tmp, which - * breaks the for loop. - */ - if (tmp->type == EXIT && EXIT_PATH(tmp) && !strncmp(EXIT_PATH(tmp),"/random/", 8)) { - remove_ob(tmp); - free_object(tmp); - break; - } + for (tmp=GET_MAP_OB(new_map, MAP_ENTER_X(new_map), MAP_ENTER_Y(new_map)); tmp; tmp=tmp->above) + /* Remove exit back to previous random map. There should only be one + * which is why we break out. To try to process more than one + * would require keeping a 'next' pointer, ad free_object kills tmp, which + * breaks the for loop. + */ + if (tmp->type == EXIT && EXIT_PATH(tmp) && !strncmp(EXIT_PATH(tmp),"/random/", 8)) { + remove_ob(tmp); + free_object(tmp); + break; + } - if (final_map_exit == 1) - { + if (final_map_exit == 1) + { /* setup the exit back */ - the_exit_back->slaying = add_string(map->path); + the_exit_back->slaying = map->path; the_exit_back->stats.hp = the_exit_down->x; the_exit_back->stats.sp = the_exit_down->y; the_exit_back->x = MAP_ENTER_X(new_map); the_exit_back->y = MAP_ENTER_Y(new_map); insert_ob_in_map(the_exit_back,new_map,NULL,0); - } - - set_map_timeout(new_map); /* So it gets swapped out */ + } + + set_map_timeout(new_map); /* So it gets swapped out */ } else - the_exit_down->slaying = add_string("/!"); + the_exit_down->slaying = "/!"; + /* Block the exit so things don't get dumped on top of it. */ the_exit_down->move_block = MOVE_ALL; insert_ob_in_map(the_exit_down,map,NULL,0); @@ -334,7 +335,7 @@ if(maze[i][j]=='>' || maze[i][j]=='<') { for(walk=get_map_ob(map,i,j);walk!=NULL;walk=walk->above) { if(walk->move_block == MOVE_ALL && walk->type != LOCKED_DOOR) { - walk->move_block = MOVE_BLOCK_DEFAULT; + walk->move_block = MOVE_BLOCK_DEFAULT; update_object(walk,UP_OBJ_CHANGE); } }