… | |
… | |
1215 | /* Find all the appropriate items */ |
1215 | /* Find all the appropriate items */ |
1216 | for (i = 0; i < op->map->width; i++) |
1216 | for (i = 0; i < op->map->width; i++) |
1217 | { |
1217 | { |
1218 | for (j = 0; j < op->map->height; j++) |
1218 | for (j = 0; j < op->map->height; j++) |
1219 | { |
1219 | { |
1220 | /* magic map code now centers the map on the object at MAGIC_MAP_HALF. |
1220 | // magic map code now centers the map on the object at MAGIC_MAP_HALF. |
1221 | * |
|
|
1222 | */ |
|
|
1223 | nx = i - op->x + MAGIC_MAP_HALF; |
1221 | nx = i - op->x + MAGIC_MAP_HALF; |
1224 | ny = j - op->y + MAGIC_MAP_HALF; |
1222 | ny = j - op->y + MAGIC_MAP_HALF; |
1225 | /* unlikely, but really big shops could run into this issue */ |
1223 | /* unlikely, but really big shops could run into this issue */ |
1226 | if (nx < 0 || ny < 0 || nx > MAGIC_MAP_SIZE || ny > MAGIC_MAP_SIZE) |
1224 | if (nx < 0 || ny < 0 || nx > MAGIC_MAP_SIZE || ny > MAGIC_MAP_SIZE) |
1227 | continue; |
1225 | continue; |
… | |
… | |
1237 | if (numitems == numallocated) |
1235 | if (numitems == numallocated) |
1238 | { |
1236 | { |
1239 | items = (shopinv *) realloc (items, sizeof (shopinv) * (numallocated + 10)); |
1237 | items = (shopinv *) realloc (items, sizeof (shopinv) * (numallocated + 10)); |
1240 | numallocated += 10; |
1238 | numallocated += 10; |
1241 | } |
1239 | } |
|
|
1240 | |
1242 | add_shop_item (stack, items, &numitems, &numallocated); |
1241 | add_shop_item (stack, items, &numitems, &numallocated); |
1243 | } |
1242 | } |
|
|
1243 | |
1244 | stack = stack->above; |
1244 | stack = stack->above; |
1245 | } |
1245 | } |
1246 | } |
1246 | } |
1247 | } |
1247 | } |
1248 | } |
1248 | } |
… | |
… | |
1273 | items[i].nrof ? items[i].nrof : 1, items[i].nrof == 1 ? items[i].item_sort : items[i].item_real); |
1273 | items[i].nrof ? items[i].nrof : 1, items[i].nrof == 1 ? items[i].item_sort : items[i].item_real); |
1274 | free (items[i].item_sort); |
1274 | free (items[i].item_sort); |
1275 | free (items[i].item_real); |
1275 | free (items[i].item_real); |
1276 | } |
1276 | } |
1277 | } |
1277 | } |
|
|
1278 | |
1278 | free (items); |
1279 | free (items); |
1279 | } |
1280 | } |
1280 | |
1281 | |
1281 | /* elmex: this function checks whether the object is in a shop */ |
1282 | /* elmex: this function checks whether the object is in a shop */ |
1282 | bool |
1283 | bool |