mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-27 12:22:45 +02:00
Remove largely unused defActions member from CIntObject
This commit is contained in:
parent
3f9e57d3f3
commit
00605b5129
@ -137,7 +137,6 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player):
|
|||||||
|
|
||||||
{
|
{
|
||||||
logGlobal->trace("\tHuman player interface for player %s being constructed", Player.toString());
|
logGlobal->trace("\tHuman player interface for player %s being constructed", Player.toString());
|
||||||
GH.defActionsDef = 0;
|
|
||||||
LOCPLINT = this;
|
LOCPLINT = this;
|
||||||
playerID=Player;
|
playerID=Player;
|
||||||
human=true;
|
human=true;
|
||||||
@ -1776,7 +1775,6 @@ void CPlayerInterface::proposeLoadingGame()
|
|||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("load");
|
CMM->menu->switchToTab("load");
|
||||||
},
|
},
|
||||||
nullptr
|
nullptr
|
||||||
|
@ -717,7 +717,6 @@ void CServerHandler::showHighScoresAndEndGameplay(PlayerColor player, bool victo
|
|||||||
scenarioHighScores.isCampaign = false;
|
scenarioHighScores.isCampaign = false;
|
||||||
|
|
||||||
endGameplay();
|
endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
GH.windows().createAndPushWindow<CHighScoreInputScreen>(victory, scenarioHighScores);
|
GH.windows().createAndPushWindow<CHighScoreInputScreen>(victory, scenarioHighScores);
|
||||||
}
|
}
|
||||||
@ -948,7 +947,6 @@ void CServerHandler::onDisconnected(const std::shared_ptr<INetworkConnection> &
|
|||||||
if(client)
|
if(client)
|
||||||
{
|
{
|
||||||
endGameplay();
|
endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
showServerError(CGI->generaltexth->translate("vcmi.server.errors.disconnected"));
|
showServerError(CGI->generaltexth->translate("vcmi.server.errors.disconnected"));
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,6 @@ void AdventureMapShortcuts::toMainMenu()
|
|||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
},
|
},
|
||||||
0
|
0
|
||||||
@ -339,7 +338,6 @@ void AdventureMapShortcuts::newGame()
|
|||||||
[]()
|
[]()
|
||||||
{
|
{
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("new");
|
CMM->menu->switchToTab("new");
|
||||||
},
|
},
|
||||||
nullptr
|
nullptr
|
||||||
|
@ -37,7 +37,6 @@ CList::CListItem::CListItem(CList * Parent)
|
|||||||
parent(Parent),
|
parent(Parent),
|
||||||
selection()
|
selection()
|
||||||
{
|
{
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CList::CListItem::~CListItem() = default;
|
CList::CListItem::~CListItem() = default;
|
||||||
|
@ -58,14 +58,11 @@ SSetCaptureState::SSetCaptureState(bool allow, ui8 actions)
|
|||||||
{
|
{
|
||||||
previousCapture = GH.captureChildren;
|
previousCapture = GH.captureChildren;
|
||||||
GH.captureChildren = false;
|
GH.captureChildren = false;
|
||||||
prevActions = GH.defActionsDef;
|
|
||||||
GH.defActionsDef = actions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SSetCaptureState::~SSetCaptureState()
|
SSetCaptureState::~SSetCaptureState()
|
||||||
{
|
{
|
||||||
GH.captureChildren = previousCapture;
|
GH.captureChildren = previousCapture;
|
||||||
GH.defActionsDef = prevActions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiHandler::init()
|
void CGuiHandler::init()
|
||||||
@ -139,8 +136,7 @@ void CGuiHandler::renderFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGuiHandler::CGuiHandler()
|
CGuiHandler::CGuiHandler()
|
||||||
: defActionsDef(0)
|
: captureChildren(false)
|
||||||
, captureChildren(false)
|
|
||||||
, curInt(nullptr)
|
, curInt(nullptr)
|
||||||
, fakeStatusBar(std::make_shared<EmptyStatusBar>())
|
, fakeStatusBar(std::make_shared<EmptyStatusBar>())
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,6 @@ public:
|
|||||||
|
|
||||||
IUpdateable *curInt;
|
IUpdateable *curInt;
|
||||||
|
|
||||||
ui8 defActionsDef; //default auto actions
|
|
||||||
bool captureChildren; //all newly created objects will get their parents from stack and will be added to parents children list
|
bool captureChildren; //all newly created objects will get their parents from stack and will be added to parents children list
|
||||||
std::list<CIntObject *> createdObj; //stack of objs being created
|
std::list<CIntObject *> createdObj; //stack of objs being created
|
||||||
|
|
||||||
@ -124,14 +123,13 @@ struct SObjectConstruction
|
|||||||
struct SSetCaptureState
|
struct SSetCaptureState
|
||||||
{
|
{
|
||||||
bool previousCapture;
|
bool previousCapture;
|
||||||
ui8 prevActions;
|
|
||||||
SSetCaptureState(bool allow, ui8 actions);
|
SSetCaptureState(bool allow, ui8 actions);
|
||||||
~SSetCaptureState();
|
~SSetCaptureState();
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OBJ_CONSTRUCTION SObjectConstruction obj__i(this)
|
#define OBJ_CONSTRUCTION SObjectConstruction obj__i(this)
|
||||||
#define OBJ_CONSTRUCTION_TARGETED(obj) SObjectConstruction obj__i(obj)
|
#define OBJ_CONSTRUCTION_TARGETED(obj) SObjectConstruction obj__i(obj)
|
||||||
#define OBJECT_CONSTRUCTION_CAPTURING(actions) defActions = actions; SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
|
#define OBJECT_CONSTRUCTION_CAPTURING(actions) SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
|
||||||
#define OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(actions) SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
|
#define OBJECT_CONSTRUCTION_CUSTOM_CAPTURING(actions) SSetCaptureState obj__i1(true, actions); SObjectConstruction obj__i(this)
|
||||||
|
|
||||||
#define OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE defActions = 255 - DISPOSE; SSetCaptureState obj__i1(true, 255 - DISPOSE); SObjectConstruction obj__i(this)
|
#define OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE SSetCaptureState obj__i1(true, 255 - DISPOSE); SObjectConstruction obj__i(this)
|
||||||
|
@ -24,8 +24,7 @@ CIntObject::CIntObject(int used_, Point pos_):
|
|||||||
redrawParent(false),
|
redrawParent(false),
|
||||||
inputEnabled(true),
|
inputEnabled(true),
|
||||||
used(used_),
|
used(used_),
|
||||||
recActions(GH.defActionsDef),
|
recActions(ALL_ACTIONS),
|
||||||
defActions(GH.defActionsDef),
|
|
||||||
pos(pos_, Point())
|
pos(pos_, Point())
|
||||||
{
|
{
|
||||||
if(GH.captureChildren)
|
if(GH.captureChildren)
|
||||||
@ -39,7 +38,7 @@ CIntObject::~CIntObject()
|
|||||||
|
|
||||||
while(!children.empty())
|
while(!children.empty())
|
||||||
{
|
{
|
||||||
if((defActions & DISPOSE) && (children.front()->recActions & DISPOSE))
|
if(children.front()->recActions & DISPOSE)
|
||||||
delete children.front();
|
delete children.front();
|
||||||
else
|
else
|
||||||
removeChild(children.front());
|
removeChild(children.front());
|
||||||
@ -51,20 +50,16 @@ CIntObject::~CIntObject()
|
|||||||
|
|
||||||
void CIntObject::show(Canvas & to)
|
void CIntObject::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if(defActions & UPDATE)
|
for(auto & elem : children)
|
||||||
for(auto & elem : children)
|
if(elem->recActions & UPDATE)
|
||||||
if(elem->recActions & UPDATE)
|
elem->show(to);
|
||||||
elem->show(to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::showAll(Canvas & to)
|
void CIntObject::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(defActions & SHOWALL)
|
for(auto & elem : children)
|
||||||
{
|
if(elem->recActions & SHOWALL)
|
||||||
for(auto & elem : children)
|
elem->showAll(to);
|
||||||
if(elem->recActions & SHOWALL)
|
|
||||||
elem->showAll(to);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::activate()
|
void CIntObject::activate()
|
||||||
@ -79,10 +74,9 @@ void CIntObject::activate()
|
|||||||
|
|
||||||
assert(isActive());
|
assert(isActive());
|
||||||
|
|
||||||
if(defActions & ACTIVATE)
|
for(auto & elem : children)
|
||||||
for(auto & elem : children)
|
if(elem->recActions & ACTIVATE)
|
||||||
if(elem->recActions & ACTIVATE)
|
elem->activate();
|
||||||
elem->activate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::deactivate()
|
void CIntObject::deactivate()
|
||||||
@ -94,10 +88,9 @@ void CIntObject::deactivate()
|
|||||||
|
|
||||||
assert(!isActive());
|
assert(!isActive());
|
||||||
|
|
||||||
if(defActions & DEACTIVATE)
|
for(auto & elem : children)
|
||||||
for(auto & elem : children)
|
if(elem->recActions & DEACTIVATE)
|
||||||
if(elem->recActions & DEACTIVATE)
|
elem->deactivate();
|
||||||
elem->deactivate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIntObject::addUsedEvents(ui16 newActions)
|
void CIntObject::addUsedEvents(ui16 newActions)
|
||||||
|
@ -73,8 +73,7 @@ public:
|
|||||||
void addUsedEvents(ui16 newActions);
|
void addUsedEvents(ui16 newActions);
|
||||||
void removeUsedEvents(ui16 newActions);
|
void removeUsedEvents(ui16 newActions);
|
||||||
|
|
||||||
enum {ACTIVATE=1, DEACTIVATE=2, UPDATE=4, SHOWALL=8, DISPOSE=16, SHARE_POS=32};
|
enum {ACTIVATE=1, DEACTIVATE=2, UPDATE=4, SHOWALL=8, DISPOSE=16, SHARE_POS=32, ALL_ACTIONS=255-DISPOSE};
|
||||||
ui8 defActions; //which calls will be tried to be redirected to children
|
|
||||||
ui8 recActions; //which calls we allow to receive from parent
|
ui8 recActions; //which calls we allow to receive from parent
|
||||||
|
|
||||||
/// deactivates if needed, blocks all automatic activity, allows only disposal
|
/// deactivates if needed, blocks all automatic activity, allows only disposal
|
||||||
|
@ -993,7 +993,6 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, con
|
|||||||
, name(S.name)
|
, name(S.name)
|
||||||
{
|
{
|
||||||
OBJ_CONSTRUCTION;
|
OBJ_CONSTRUCTION;
|
||||||
defActions |= SHARE_POS;
|
|
||||||
|
|
||||||
int serial = 0;
|
int serial = 0;
|
||||||
for(PlayerColor g = PlayerColor(0); g < s->color; ++g)
|
for(PlayerColor g = PlayerColor(0); g < s->color; ++g)
|
||||||
|
@ -289,7 +289,6 @@ CMainMenu::CMainMenu()
|
|||||||
pos.w = GH.screenDimensions().x;
|
pos.w = GH.screenDimensions().x;
|
||||||
pos.h = GH.screenDimensions().y;
|
pos.h = GH.screenDimensions().y;
|
||||||
|
|
||||||
GH.defActionsDef = 63;
|
|
||||||
menu = std::make_shared<CMenuScreen>(CMainMenuConfig::get().getConfig()["window"]);
|
menu = std::make_shared<CMenuScreen>(CMainMenuConfig::get().getConfig()["window"]);
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||||
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
backgroundAroundMenu = std::make_shared<CFilledTexture>(ImagePath::builtin("DIBOXBCK"), pos);
|
||||||
|
@ -356,7 +356,6 @@ CButton::CButton(Point position, const AnimationPath &defName, const std::pair<s
|
|||||||
hoverable(false),
|
hoverable(false),
|
||||||
soundDisabled(false)
|
soundDisabled(false)
|
||||||
{
|
{
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD);
|
addUsedEvents(LCLICK | SHOW_POPUP | HOVER | KEYBOARD);
|
||||||
hoverTexts[0] = help.first;
|
hoverTexts[0] = help.first;
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,6 @@ void CComponentBox::placeComponents(bool selectable)
|
|||||||
for(auto & comp : components)
|
for(auto & comp : components)
|
||||||
{
|
{
|
||||||
addChild(comp.get());
|
addChild(comp.get());
|
||||||
comp->recActions = defActions; //FIXME: for some reason, received component might have recActions set to 0
|
|
||||||
comp->moveTo(Point(pos.x, pos.y));
|
comp->moveTo(Point(pos.x, pos.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +625,6 @@ MoraleLuckBox::MoraleLuckBox(bool Morale, const Rect &r, bool Small)
|
|||||||
small(Small)
|
small(Small)
|
||||||
{
|
{
|
||||||
pos = r + pos.topLeft();
|
pos = r + pos.topLeft();
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCreaturePic::CCreaturePic(int x, int y, const CCreature * cre, bool Big, bool Animated)
|
CCreaturePic::CCreaturePic(int x, int y, const CCreature * cre, bool Big, bool Animated)
|
||||||
|
@ -33,7 +33,6 @@ std::shared_ptr<CIntObject> CObjectList::createItem(size_t index)
|
|||||||
if(!item)
|
if(!item)
|
||||||
item = std::make_shared<CIntObject>();
|
item = std::make_shared<CIntObject>();
|
||||||
|
|
||||||
item->recActions = defActions;
|
|
||||||
addChild(item.get());
|
addChild(item.get());
|
||||||
if (isActive())
|
if (isActive())
|
||||||
item->activate();
|
item->activate();
|
||||||
@ -45,7 +44,6 @@ CTabbedInt::CTabbedInt(CreateFunc create, Point position, size_t ActiveID)
|
|||||||
activeTab(nullptr),
|
activeTab(nullptr),
|
||||||
activeID(ActiveID)
|
activeID(ActiveID)
|
||||||
{
|
{
|
||||||
defActions &= ~DISPOSE;
|
|
||||||
pos += position;
|
pos += position;
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
@ -339,7 +339,6 @@ Rect CMultiLineLabel::getTextLocation()
|
|||||||
CLabelGroup::CLabelGroup(EFonts Font, ETextAlignment Align, const ColorRGBA & Color)
|
CLabelGroup::CLabelGroup(EFonts Font, ETextAlignment Align, const ColorRGBA & Color)
|
||||||
: font(Font), align(Align), color(Color)
|
: font(Font), align(Align), color(Color)
|
||||||
{
|
{
|
||||||
defActions = 255 - DISPOSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLabelGroup::add(int x, int y, const std::string & text)
|
void CLabelGroup::add(int x, int y, const std::string & text)
|
||||||
|
@ -41,8 +41,6 @@ CWindowObject::CWindowObject(int options_, const ImagePath & imageName, Point ce
|
|||||||
if(!(options & NEEDS_ANIMATED_BACKGROUND)) //currently workaround for highscores (currently uses window as normal control, because otherwise videos are not played in background yet)
|
if(!(options & NEEDS_ANIMATED_BACKGROUND)) //currently workaround for highscores (currently uses window as normal control, because otherwise videos are not played in background yet)
|
||||||
assert(parent == nullptr); //Safe to remove, but windows should not have parent
|
assert(parent == nullptr); //Safe to remove, but windows should not have parent
|
||||||
|
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
|
|
||||||
if (options & RCLICK_POPUP)
|
if (options & RCLICK_POPUP)
|
||||||
CCS->curh->hide();
|
CCS->curh->hide();
|
||||||
|
|
||||||
@ -63,8 +61,6 @@ CWindowObject::CWindowObject(int options_, const ImagePath & imageName):
|
|||||||
if(!(options & NEEDS_ANIMATED_BACKGROUND)) //currently workaround for highscores (currently uses window as normal control, because otherwise videos are not played in background yet)
|
if(!(options & NEEDS_ANIMATED_BACKGROUND)) //currently workaround for highscores (currently uses window as normal control, because otherwise videos are not played in background yet)
|
||||||
assert(parent == nullptr); //Safe to remove, but windows should not have parent
|
assert(parent == nullptr); //Safe to remove, but windows should not have parent
|
||||||
|
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
|
|
||||||
if(options & RCLICK_POPUP)
|
if(options & RCLICK_POPUP)
|
||||||
CCS->curh->hide();
|
CCS->curh->hide();
|
||||||
|
|
||||||
|
@ -248,8 +248,6 @@ void CRClickPopup::createAndPush(const CGObjectInstance * obj, const Point & p,
|
|||||||
CRClickPopupInt::CRClickPopupInt(const std::shared_ptr<CIntObject> & our)
|
CRClickPopupInt::CRClickPopupInt(const std::shared_ptr<CIntObject> & our)
|
||||||
{
|
{
|
||||||
CCS->curh->hide();
|
CCS->curh->hide();
|
||||||
defActions = 255-DISPOSE;
|
|
||||||
our->recActions = defActions;
|
|
||||||
inner = our;
|
inner = our;
|
||||||
addChild(our.get(), false);
|
addChild(our.get(), false);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,6 @@ void SettingsMainWindow::mainMenuButtonCallback()
|
|||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
CSH->endGameplay();
|
CSH->endGameplay();
|
||||||
GH.defActionsDef = 63;
|
|
||||||
CMM->menu->switchToTab("main");
|
CMM->menu->switchToTab("main");
|
||||||
},
|
},
|
||||||
0
|
0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user