Some organisational prep work before I start working on a new navigation method (ie replacement for CardSelector). The current design was to allocate a CardSelector and pass in its pointer to a variety of classes via their constructors. To simplify things, now we use a singleton style pattern with an Instance() function - this means that when I implement a new class to replace CardSelector, I only need to modify what's returned by the singleton callback - as long as the new pointer class supports the same function calls, it'll be a straight drop-in.
This commit is contained in:
@@ -725,12 +725,11 @@ int MTGAttackRule::reactToClick(MTGCardInstance * card){
|
||||
|
||||
//Graphically select the next card that can attack
|
||||
if(!card->isAttacker()){
|
||||
CardSelector * cs = game->mLayers->cs;
|
||||
cs->PushLimitor();
|
||||
cs->Limit(this,CardSelector::playZone);
|
||||
cs->CheckUserInput(JGE_BTN_RIGHT);
|
||||
cs->Limit(NULL,CardSelector::playZone);
|
||||
cs->PopLimitor();
|
||||
CardSelectorSingleton::Instance()->PushLimitor();
|
||||
CardSelectorSingleton::Instance()->Limit(this,CardSelector::playZone);
|
||||
CardSelectorSingleton::Instance()->CheckUserInput(JGE_BTN_RIGHT);
|
||||
CardSelectorSingleton::Instance()->Limit(NULL,CardSelector::playZone);
|
||||
CardSelectorSingleton::Instance()->PopLimitor();
|
||||
}
|
||||
card->toggleAttacker();
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user