Files
wagic/projects/mtg/include/ActionLayer.h
Xawotihs c3dc51aed1 I just played 3 long games and I was able to undo two fully and got an assert on the third one after more than 1000 actions... so I commit what I have:
- Modified undo to stop at "next phase" action
- Added "muligan" and "force library shuffling" to the list of logged action
- Fixed random logging
- Fixed double logging of actions
- Merged all the "next game" functions into a single one
- Created a PlayerType type instead of using int
- Moved the player loading code into the GameObserver and out of GameStateDuel to avoid having player references in both and simplify the initialization and termination. Tweeked a bit the humanplayer class to be able to do that.
- Added a "load" menu available in testsuite mode, I use that to load problematique game. To use it, just copy-paste a game from the traces into Res/test/game/timetwister.txt. Game in traces starts by "rvalues:..." and ends by "[end]"
- Added some untested and commented out code in GuiCombat to use the mouse/touch to setup the damage on the blockers
- Broke the network game ... hoh well, I'll repair it when everything else works !!
- various code cleanup and compilation fixes on Linux
2011-10-26 22:14:12 +00:00

68 lines
2.1 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);
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