Skip to content

Commit 7ac0da2

Browse files
committed
Fixed vector::erase misuse.
Fixed OSX not compiling.
1 parent 6101605 commit 7ac0da2

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

src/Basescape/CraftEquipmentState.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ void CraftEquipmentState::moveLeft(int change)
378378
{
379379
_base->getItems()->addItem(ammo->getType(), (*i)->getAmmo());
380380
delete (*i);
381-
c->getVehicles()->erase(i);
382-
i = c->getVehicles()->begin(); // Since we erased the current iterator, we have to start over (to avoid a crash)
381+
i = c->getVehicles()->erase(i);
383382
}
384383
else ++i;
385384
}
@@ -395,9 +394,8 @@ void CraftEquipmentState::moveLeft(int change)
395394
if ((*i)->getRules() == item)
396395
{
397396
delete (*i);
398-
c->getVehicles()->erase(i);
397+
i = c->getVehicles()->erase(i);
399398
if (0 >= --change) break;
400-
i = c->getVehicles()->begin(); // Since we erased the current iterator, we have to start over (to avoid a crash)
401399
}
402400
else ++i;
403401
}

src/Engine/Surface.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "Exception.h"
2626
#include "ShaderMove.h"
2727
#include <stdlib.h>
28-
#include <malloc.h>
2928

3029
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
3130
#define _aligned_malloc __mingw_aligned_malloc

0 commit comments

Comments
 (0)