J :
* Add a helper function.
This commit is contained in:
@@ -30,6 +30,8 @@ class ObjectSelector : public GuiLayer
|
||||
LimitorFunctor<T>* limitor;
|
||||
Pos bigpos;
|
||||
|
||||
T* handLast; T* playLast;
|
||||
|
||||
public:
|
||||
ObjectSelector(DuelLayers*);
|
||||
void Add(T*);
|
||||
|
||||
@@ -39,6 +39,7 @@ class GuiHand : public GuiLayer
|
||||
GuiHand(CardSelector* cs, MTGHand* hand);
|
||||
~GuiHand();
|
||||
void Update(float dt);
|
||||
bool isInHand(CardView*);
|
||||
|
||||
friend struct HandLimitor;
|
||||
};
|
||||
|
||||
@@ -13,9 +13,9 @@ const float GuiHand::ClosedX = 494;
|
||||
|
||||
bool HandLimitor::select(Target* t)
|
||||
{
|
||||
vector<CardView*>::iterator it;
|
||||
it = find(hand->cards.begin(), hand->cards.end(), t);
|
||||
return (it != hand->cards.end());
|
||||
if (CardView* c = dynamic_cast<CardView*>(t))
|
||||
return hand->isInHand(c);
|
||||
else return false;
|
||||
}
|
||||
bool HandLimitor::greyout(Target* t)
|
||||
{
|
||||
@@ -51,6 +51,13 @@ void GuiHand::Update(float dt)
|
||||
(*it)->Update(dt);
|
||||
}
|
||||
|
||||
bool GuiHand::isInHand(CardView* card)
|
||||
{
|
||||
vector<CardView*>::iterator it;
|
||||
it = find(cards.begin(), cards.end(), card);
|
||||
return (it != cards.end());
|
||||
}
|
||||
|
||||
GuiHandOpponent::GuiHandOpponent(CardSelector* cs, MTGHand* hand) : GuiHand(cs, hand) {}
|
||||
|
||||
void GuiHandOpponent::Render()
|
||||
|
||||
Reference in New Issue
Block a user