--- deliantra/server/random_maps/treasure.C 2006/12/31 19:02:24 1.12 +++ deliantra/server/random_maps/treasure.C 2006/12/31 20:46:17 1.13 @@ -72,8 +72,8 @@ void place_treasure (maptile *map, char **layout, char *treasure_style, int treasureoptions, random_map_params *RP) { - char styledirname[256]; - char stylefilepath[256]; + char styledirname[1024]; + char stylefilepath[1024]; maptile *style_map = 0; int num_treasures; @@ -278,7 +278,7 @@ if ((treasureoptions & KEYREQUIRED) && n_treasures > 1) { - char keybuf[256]; + char keybuf[1024]; sprintf (keybuf, "%d", (int) RANDOM ()); the_chest->slaying = keybuf; @@ -765,14 +765,15 @@ { /* there could be a door here */ layout[x][y] = 1; door = door_in_square (map, x, y); - if (door != NULL) + if (door) { doorlist[*ndoors] = door; - if (*ndoors > 254) /* eek! out of memory */ + if (*ndoors > 1022) /* eek! out of memory */ { LOG (llevError, "find_doors_in_room_recursive:Too many doors for memory allocated!\n"); return; } + *ndoors = *ndoors + 1; } } @@ -781,9 +782,7 @@ layout[x][y] = 1; /* now search all the 8 squares around recursively for free spots,in random order */ for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) - { - find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP); - } + find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP); } } @@ -796,8 +795,7 @@ int i, j; int ndoors = 0; - doorlist = (object **) calloc (sizeof (int), 256); - + doorlist = (object **) calloc (sizeof (int), 1024); layout2 = (char **) calloc (sizeof (char *), RP->Xsize); /* allocate and copy the layout, converting C to 0. */ @@ -816,9 +814,8 @@ /* deallocate the temp. layout */ for (i = 0; i < RP->Xsize; i++) - { - free (layout2[i]); - } + free (layout2[i]); + free (layout2); return doorlist; } @@ -841,7 +838,7 @@ for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) { object *new_door = get_archetype ("locked_door1"); - char keybuf[256]; + char keybuf[1024]; door = doorlist[i]; new_door->face = door->face;