Skip to content
Permalink
Browse files

added item::is_watertight_container(). Shift part of funky funnel con…

…tainer detector into is_funnel_collector()
  • Loading branch information...
atomicdryad committed Oct 25, 2013
1 parent a74dd67 commit cc025699a8035cbed2cb9a4a9765dba061f52674
Showing with 27 additions and 0 deletions.
  1. +25 −0 item.cpp
  2. +2 −0 item.h
@@ -1563,6 +1563,31 @@ bool item::is_container() const
return type->is_container();
}

bool item::is_watertight_container() const
{
return ( is_container() != false && has_flag("WATERTIGHT") && has_flag("SEALS") );
}

int item::is_funnel_container(int bigger_than) const
{
if ( ! is_container() ) {
return 0;
}
it_container *ct = static_cast<it_container *>(type);
// todo; consider linking funnel to item or -making- it an active item
if ( (int)ct->contains <= bigger_than ) {
return 0; // skip contents check, performance
}
if (
contents.empty() ||
contents[0].typeId() == "water" ||
contents[0].typeId() == "water_acid" ||
contents[0].typeId() == "water_acid_weak") {
return (int)ct->contains;
}
return 0;
}

bool item::is_tool() const
{
if( is_null() )
2 item.h
@@ -173,6 +173,8 @@ class item
bool is_armor() const;
bool is_book() const;
bool is_container() const;
bool is_watertight_container() const;
int is_funnel_container(int bigger_than) const;
bool is_tool() const;
bool is_software() const;
bool is_macguffin() const;

0 comments on commit cc02569

Please sign in to comment.
You can’t perform that action at this time.