diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-15 03:42:10 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-11-15 03:42:10 +0000 |
commit | 6f22f0352964d6d00deafbb8ccaf7145d6321865 (patch) | |
tree | 2ef2f494485526bba4692959c95dfe2aa59839c1 | |
parent | 73a788059d8943247b0741b8867ccb32099efb8b (diff) | |
download | hercules-6f22f0352964d6d00deafbb8ccaf7145d6321865.tar.gz hercules-6f22f0352964d6d00deafbb8ccaf7145d6321865.tar.bz2 hercules-6f22f0352964d6d00deafbb8ccaf7145d6321865.tar.xz hercules-6f22f0352964d6d00deafbb8ccaf7145d6321865.zip |
Added error messages when trying to place objects on invalid map coordinates (quick patch for bugreport:419)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11737 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/map/map.c | 14 |
2 files changed, 11 insertions, 4 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c13abe288..e9eb58dd9 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/11/16 + * Added error messages when trying to place objects on invalid map coords * Fixed Divine Protection working against players (bugreport:410) 2007/11/15 * Fixed some homunculus skill offset calculation mistakes (bugreport:363) diff --git a/src/map/map.c b/src/map/map.c index 526c24394..2bf5b5551 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -333,17 +333,23 @@ int map_addblock_sub (struct block_list *bl, int flag) if (bl->prev != NULL) { if(battle_config.error_log) - ShowError("map_addblock error : bl->prev != NULL\n"); + ShowError("map_addblock: bl->prev != NULL\n"); return 0; } m = bl->m; x = bl->x; y = bl->y; - if (m < 0 || m >= map_num || - x < 0 || x >= map[m].xs || - y < 0 || y >= map[m].ys) + if( m < 0 || m >= map_num ) + { + ShowError("map_addblock: invalid map id (%d), only %d are loaded.\n", m, map_num); return 1; + } + if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) + { + ShowError("map_addblock: out-of-bounds coordinates (\"%s\",%d,%d), map is %dx%d\n", map[m].name, x, y, map[m].xs, map[m].ys); + return 1; + } #ifdef CELL_NOSTACK map_addblcell(bl); |