Skip to content

Commit

Permalink
Merge remote-tracking branch 'queatz/furnace-is-not-blackhole'
Browse files Browse the repository at this point in the history
  • Loading branch information
celeron55 committed Aug 30, 2011
2 parents 87b9e54 + ef08163 commit 1a70552
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/content_nodemeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,24 @@ std::string FurnaceNodeMetadata::infoText()
return s;
}
}
bool FurnaceNodeMetadata::nodeRemovalDisabled()
{
/*
Disable removal if furnace is not empty
*/
InventoryList *list[3] = {m_inventory->getList("src"),
m_inventory->getList("dst"), m_inventory->getList("fuel")};

for(int i = 0; i < 3; i++) {
if(list[i] == NULL)
continue;
if(list[i]->getUsedSlots() == 0)
continue;
return true;
}
return false;

}
void FurnaceNodeMetadata::inventoryModified()
{
dstream<<"Furnace inventory modification callback"<<std::endl;
Expand Down
1 change: 1 addition & 0 deletions src/content_nodemeta.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class FurnaceNodeMetadata : public NodeMetadata
virtual Inventory* getInventory() {return m_inventory;}
virtual void inventoryModified();
virtual bool step(float dtime);
virtual bool nodeRemovalDisabled();
virtual std::string getInventoryDrawSpecString();

private:
Expand Down

0 comments on commit 1a70552

Please sign in to comment.