mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-09 23:59:51 +00:00
Shot Lua API update + related internal changes.
With this change, shots are no longer stored in a std::list. In the current code, the global shot store may be modified while iterating, this did not cause problems with the list implementation, but would easily crash if a shot is removed while iterating. To fix this, a 2nd vector stores shots to be deleted from the global store and does so when no iteration is in progress and modifying the vector is safe. Added functions: getFirstShot -- for iterating over all shots on the map getNextShot shot_setFirer shot_setExtraDamage shot_getExtraDamage shot_getDamage shot_getDamageType shot_getName
This commit is contained in:
parent
eef2289fb2
commit
0784d1b9df
7 changed files with 134 additions and 38 deletions
|
@ -2912,7 +2912,7 @@ void Entity::doSpellAvoidance(float dt, int range, float mod)
|
|||
{
|
||||
Shot *s = (Shot*)(*i);
|
||||
|
||||
if ((s->position - this->position).getSquaredLength2D() < sqr(range))
|
||||
if (s->isActive() && (s->position - this->position).getSquaredLength2D() < sqr(range))
|
||||
{
|
||||
for (int j = 0; j < ignoreShotDamageTypes.size(); j++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue