* Add a helper function.
This commit is contained in:
jean.chalard
2009-09-08 14:53:23 +00:00
parent 471da5d9d9
commit 457266184d
3 changed files with 13 additions and 3 deletions

View File

@@ -30,6 +30,8 @@ class ObjectSelector : public GuiLayer
LimitorFunctor<T>* limitor;
Pos bigpos;
T* handLast; T* playLast;
public:
ObjectSelector(DuelLayers*);
void Add(T*);

View File

@@ -39,6 +39,7 @@ class GuiHand : public GuiLayer
GuiHand(CardSelector* cs, MTGHand* hand);
~GuiHand();
void Update(float dt);
bool isInHand(CardView*);
friend struct HandLimitor;
};

View File

@@ -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()