diff options
author | shennetsind <ind@henn.et> | 2015-01-18 15:30:25 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2015-01-18 15:30:25 -0200 |
commit | 83077740c7c996d198617d45a1916cd31ff38e9a (patch) | |
tree | 009875bbad6493aca18307330eae00fd0aa1bded /src | |
parent | 8a4d2c5f0b1257e32ba7768161a5a790d5f6a570 (diff) | |
download | hercules-83077740c7c996d198617d45a1916cd31ff38e9a.tar.gz hercules-83077740c7c996d198617d45a1916cd31ff38e9a.tar.bz2 hercules-83077740c7c996d198617d45a1916cd31ff38e9a.tar.xz hercules-83077740c7c996d198617d45a1916cd31ff38e9a.zip |
Fixed Bug Report 8438
Addresses instances crashing when running with the CELL_NOSTACK define enabled.
Caused by the define not being readily available to all areas that played with mapcell (now with it being included from map.h this no longer is the case)
http://hercules.ws/board/tracker/issue-8438-cell-nostack-and-instances-crash/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/instance.c | 11 | ||||
-rw-r--r-- | src/map/map.h | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/map/instance.c b/src/map/instance.c index 96bdcc053..168a03da6 100644 --- a/src/map/instance.c +++ b/src/map/instance.c @@ -151,7 +151,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) { int16 m = map->mapname2mapid(name); int i, im = -1; - size_t num_cell, size; + size_t num_cell, size, j; if( m < 0 ) return -1; // source map not found @@ -205,6 +205,15 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const CREATE( map->list[im].cell, struct mapcell, num_cell ); memcpy( map->list[im].cell, map->list[m].cell, num_cell * sizeof(struct mapcell) ); + // Appropriately clear cell data + for(j = 0; j < num_cell; j++) { + map->list[im].cell[j].cell_bl = 0; + map->list[im].cell[j].basilica = 0; + map->list[im].cell[j].icewall = 0; + map->list[im].cell[j].npc = 0; + map->list[im].cell[j].landprotector = 0; + } + size = map->list[im].bxs * map->list[im].bys * sizeof(struct block_list*); map->list[im].block = (struct block_list**)aCalloc(size, 1); map->list[im].block_mob = (struct block_list**)aCalloc(size, 1); diff --git a/src/map/map.h b/src/map/map.h index f5f85f334..9721b19f3 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -5,6 +5,8 @@ #ifndef MAP_MAP_H #define MAP_MAP_H +#include "../config/core.h" + #include <stdarg.h> #include "atcommand.h" |