diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-01-10 14:55:13 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-01-10 14:55:13 -0600 |
commit | 4ccdb5ec4e12b427f1a2069174db8c38bf65fd40 (patch) | |
tree | 509a3a7cc157d10ee18f1db07abb92f8a5c85f21 /crawl-ref/source/dungeon.cc | |
parent | e46a80b5fd4e3f4276fc8f10b123763717dafd97 (diff) | |
download | crawl-ref-4ccdb5ec4e12b427f1a2069174db8c38bf65fd40.tar.gz crawl-ref-4ccdb5ec4e12b427f1a2069174db8c38bf65fd40.zip |
try to avoid crashes due to reallocation better
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 7baa51eb3f..bc66d16e9b 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -7841,7 +7841,7 @@ static void _add_plant_clumps() } /* make sure the iterator stays valid */ - to_place.reserve((2 * i + 1) * (2 * i + 1)); + std::vector<coord_def> more_to_place; for (std::vector<coord_def>::const_iterator it = to_place.begin(); it != to_place.end(); ++it) @@ -7854,10 +7854,11 @@ static void _add_plant_clumps() if (abs(rad->x - it->x) <= 1 && abs(rad->y - it->y) <= 1) { if (one_chance_in(12)) { - to_place.push_back(*rad); + more_to_place.push_back(*rad); } } } + to_place.insert(to_place.end(), more_to_place.begin(), more_to_place.end()); } } |