From e0672a710e9035c1577c2cd9a1d1ce4d2204eb2e Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Wed, 28 Apr 2004 20:07:20 +0000 Subject: [PATCH] MatzeBs patch for evil cast SVN-Revision: 816 --- src/leveleditor.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 05b6f3438..a9907f745 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -1193,10 +1193,16 @@ void le_change(float x, float y, int tm, unsigned int c) y2 /= 32; /* if there is a bad guy over there, remove it */ - for(i = 0; i < le_world.bad_guys.size(); ++i) - if(le_world.bad_guys[i].base.x/32 >= x1 && le_world.bad_guys[i].base.x/32 <= x2 - && le_world.bad_guys[i].base.y/32 >= y1 && le_world.bad_guys[i].base.y/32 <= y2) - le_world.bad_guys.erase(static_cast::iterator>(&le_world.bad_guys[i])); + for(std::vector::iterator i = le_world.bad_guys.begin(); + i != le_world.bad_guys.end(); /* will be at end of loop */) { + if(i->base.x/32 >= x1 && i->base.x/32 <= x2 + && i->base.y/32 >= y1 && i->base.y/32 <= y2) { + i = le_world.bad_guys.erase(i); + continue; + } else { + ++i; + } + } for(xx = x1; xx <= x2; xx++) for(yy = y1; yy <= y2; yy++) -- 2.11.0