Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Interactive: Add a return value to ARX_INTERACTIVE_DestroyIOdelayed()
  • Loading branch information
dscharrer committed Jan 12, 2017
1 parent f2453db commit 0ff9901
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/scene/Interactive.cpp
Expand Up @@ -2521,18 +2521,19 @@ void RenderInter() {

static std::vector<Entity *> toDestroy;

void ARX_INTERACTIVE_DestroyIOdelayed(Entity * entity) {
bool ARX_INTERACTIVE_DestroyIOdelayed(Entity * entity) {

if((entity->ioflags & IO_ITEM) && entity->_itemdata->count > 1) {
entity->_itemdata->count--;
return;
return false;
}

LogDebug("will destroy entity " << entity->idString());
if(std::find(toDestroy.begin(), toDestroy.end(), entity) == toDestroy.end()) {
toDestroy.push_back(entity);
}

return true;
}

void ARX_INTERACTIVE_DestroyIOdelayedRemove(Entity * entity) {
Expand Down
10 changes: 9 additions & 1 deletion src/scene/Interactive.h
Expand Up @@ -102,7 +102,15 @@ void PrepareIOTreatZone(long flag = 0);

void LinkObjToMe(Entity * io, Entity * io2, const std::string & attach);

void ARX_INTERACTIVE_DestroyIOdelayed(Entity * entity);
/*!
* Destroy an entity at the end of the current frame
*
* For items with a count over 1 the count is (immediately) descreased
* and the entity is not destroyed.
*
* \return true if the entity will be destroyed.
*/
bool ARX_INTERACTIVE_DestroyIOdelayed(Entity * entity);
void ARX_INTERACTIVE_DestroyIOdelayedRemove(Entity * entity);
void ARX_INTERACTIVE_DestroyIOdelayedExecute();

Expand Down

0 comments on commit 0ff9901

Please sign in to comment.