diff options
| author | Quietust | 2012-06-27 16:38:39 -0500 |
|---|---|---|
| committer | Quietust | 2012-06-27 16:38:39 -0500 |
| commit | f0d4d799d838eacc1cc5d4a6eb267fcd9d62e748 (patch) | |
| tree | 0892622d7616afc01e98d8f84beb4fa239784093 /plugins/probe.cpp | |
| parent | 9046fed648376d53071773fb3b7fbcf569a3ae59 (diff) | |
| download | dfhack-f0d4d799d838eacc1cc5d4a6eb267fcd9d62e748.tar.gz dfhack-f0d4d799d838eacc1cc5d4a6eb267fcd9d62e748.tar.bz2 dfhack-f0d4d799d838eacc1cc5d4a6eb267fcd9d62e748.tar.xz | |
Don't index world_data->region_map beyond its bounds
Diffstat (limited to 'plugins/probe.cpp')
| -rw-r--r-- | plugins/probe.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/probe.cpp b/plugins/probe.cpp index b7b7d298..2ae6846d 100644 --- a/plugins/probe.cpp +++ b/plugins/probe.cpp @@ -221,10 +221,11 @@ command_result df_probe (color_ostream &out, vector <string> & parameters) out.print("temperature2: %d U\n",mc.temperature2At(cursor)); int offset = block.region_offset[des.bits.biome]; - df::coord2d region_pos = block.region_pos + df::coord2d ((offset % 3) - 1, (offset / 3) -1); + int bx = clip_range(block.region_pos.x + (offset % 3) - 1, 0, world->world_data->world_width-1); + int by = clip_range(block.region_pos.y + (offset / 3) - 1, 0, world->world_data->world_height-1); df::world_data::T_region_map* biome = - &world->world_data->region_map[region_pos.x][region_pos.y]; + &world->world_data->region_map[bx][by]; int sav = biome->savagery; int evi = biome->evilness; |
