- Modified DuelLayers to not use a global MTGPhaseGame instance anymore - Moved the reset of currentActionCard out of the ActionLayer render function : that fixes the remaing problematic tests in the multithreaded testsuite - Added a method in ActionLayer converting a card ability into a menu index - Used this new method in the game observer to log correctly AI ability actions - Added a DumpAssert method in the game observer, it can be used to dump the game and assert in order to easy crash reproduction - Cleaned up TargetList properties access - Added an optimisation in GuiMana to not compute update code if the rendering is not used (multi-threaded mode) - Added a deadlock detection in the test AI vs AI multithreaded mode - Fixed minor bugs in test AI vs AI multithreaded mode - Added a games/second counter in the test AI vs AI rendering
69 lines
2.2 KiB
C++
69 lines
2.2 KiB
C++
/*
|
|
* Wagic, The Homebrew ?! is licensed under the BSD license
|
|
* See LICENSE in the Folder's root
|
|
* http://wololo.net/wagic/
|
|
*/
|
|
|
|
#ifndef _ACTIONLAYER_H_
|
|
#define _ACTIONLAYER_H_
|
|
|
|
#include "GuiLayers.h"
|
|
#include "ActionElement.h"
|
|
#include "SimpleMenu.h"
|
|
#include "MTGAbility.h"
|
|
|
|
#include <set>
|
|
|
|
class GuiLayer;
|
|
class Targetable;
|
|
class WEvent;
|
|
|
|
class ActionLayer: public GuiLayer, public JGuiListener
|
|
{
|
|
public:
|
|
vector<ActionElement *> garbage;
|
|
Targetable * menuObject;
|
|
SimpleMenu * abilitiesMenu;
|
|
MTGCardInstance * currentActionCard;
|
|
int stuffHappened;
|
|
virtual void Render();
|
|
virtual void Update(float dt);
|
|
bool CheckUserInput(JButton key);
|
|
ActionLayer(GameObserver *observer);
|
|
~ActionLayer();
|
|
int cancelCurrentAction();
|
|
ActionElement * isWaitingForAnswer();
|
|
int isReactingToTargetClick(Targetable * card);
|
|
int receiveEventPlus(WEvent * event);
|
|
int reactToTargetClick(Targetable * card);
|
|
int isReactingToClick(MTGCardInstance * card);
|
|
bool getMenuIdFromCardAbility(MTGCardInstance *card, MTGAbility *ability, int& menuId);
|
|
int reactToClick(MTGCardInstance * card);
|
|
int reactToClick(ActionElement * ability, MTGCardInstance * card);
|
|
int reactToTargetClick(ActionElement * ability, Targetable * card);
|
|
int stillInUse(MTGCardInstance * card);
|
|
void setMenuObject(Targetable * object, bool must = false);
|
|
void setCustomMenuObject(Targetable * object, bool must = false,vector<MTGAbility*>abilities = vector<MTGAbility*>());
|
|
void ButtonPressed(int controllerid, int controlid);
|
|
void ButtonPressedOnMultipleChoice(int choice = -1);
|
|
void doReactTo(int menuIndex);
|
|
TargetChooser * getCurrentTargetChooser();
|
|
void setCurrentWaitingAction(ActionElement * ae);
|
|
MTGAbility * getAbility(int type);
|
|
int checkCantCancel(){return cantCancel;};
|
|
|
|
//Removes from game but does not move the element to garbage. The caller must take care of deleting the element.
|
|
int removeFromGame(ActionElement * e);
|
|
|
|
bool moveToGarbage(ActionElement * e);
|
|
|
|
void cleanGarbage();
|
|
|
|
protected:
|
|
ActionElement * currentWaitingAction;
|
|
int cantCancel;
|
|
std::set<ActionElement*> mReactions;
|
|
};
|
|
|
|
#endif
|