1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Removed isActive(int) method since its usages were redundant or wrong

This commit is contained in:
Ivan Savenko
2023-05-20 01:39:06 +03:00
parent c77f8482e3
commit a4000f2fc8
6 changed files with 4 additions and 59 deletions

View File

@@ -194,12 +194,6 @@ void ClientCommandManager::handleNotDialogCommand()
LOCPLINT->showingDialog->setn(false); LOCPLINT->showingDialog->setn(false);
} }
void ClientCommandManager::handleGuiCommand()
{
for(const auto & child : GH.windows().findWindows<CIntObject>())
printInfoAboutInterfaceObject(child.get(), 0);
}
void ClientCommandManager::handleConvertTextCommand() void ClientCommandManager::handleConvertTextCommand()
{ {
logGlobal->info("Searching for available maps"); logGlobal->info("Searching for available maps");
@@ -487,36 +481,6 @@ void ClientCommandManager::printCommandMessage(const std::string &commandMessage
} }
} }
void ClientCommandManager::printInfoAboutInterfaceObject(const CIntObject *obj, int level)
{
std::stringstream sbuffer;
sbuffer << std::string(level, '\t');
sbuffer << typeid(*obj).name() << " *** ";
if (obj->isActive())
{
#define PRINT(check, text) if (obj->isActive(CIntObject::check)) sbuffer << text
PRINT(LCLICK, 'L');
PRINT(RCLICK, 'R');
PRINT(HOVER, 'H');
PRINT(MOVE, 'M');
PRINT(KEYBOARD, 'K');
PRINT(TIME, 'T');
PRINT(GENERAL, 'A');
PRINT(WHEEL, 'W');
PRINT(DOUBLECLICK, 'D');
#undef PRINT
}
else
sbuffer << "inactive";
sbuffer << " at " << obj->pos.x <<"x"<< obj->pos.y;
sbuffer << " (" << obj->pos.w <<"x"<< obj->pos.h << ")";
printCommandMessage(sbuffer.str(), ELogLevel::INFO);
for(const CIntObject *child : obj->children)
printInfoAboutInterfaceObject(child, level+1);
}
void ClientCommandManager::giveTurn(const PlayerColor &colorIdentifier) void ClientCommandManager::giveTurn(const PlayerColor &colorIdentifier)
{ {
YourTurn yt; YourTurn yt;
@@ -569,9 +533,6 @@ void ClientCommandManager::processCommand(const std::string & message, bool call
else if(commandName == "not dialog") else if(commandName == "not dialog")
handleNotDialogCommand(); handleNotDialogCommand();
else if(commandName == "gui")
handleGuiCommand();
else if(message=="convert txt") else if(message=="convert txt")
handleConvertTextCommand(); handleConvertTextCommand();

View File

@@ -51,9 +51,6 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
// Set the state indicating if dialog box is active to "no" // Set the state indicating if dialog box is active to "no"
void handleNotDialogCommand(); void handleNotDialogCommand();
// Displays tree view of currently present VCMI common GUI elements
void handleGuiCommand();
// Dumps all game text, maps text and campaign maps text into Client log between BEGIN TEXT EXPORT and END TEXT EXPORT // Dumps all game text, maps text and campaign maps text into Client log between BEGIN TEXT EXPORT and END TEXT EXPORT
void handleConvertTextCommand(); void handleConvertTextCommand();
@@ -92,7 +89,6 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
// Prints in Chat the given message // Prints in Chat the given message
void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET); void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
void printInfoAboutInterfaceObject(const CIntObject *obj, int level);
void giveTurn(const PlayerColor &color); void giveTurn(const PlayerColor &color);
public: public:

View File

@@ -31,11 +31,6 @@ bool AEventsReceiver::isActive() const
return activeState; return activeState;
} }
bool AEventsReceiver::isActive(int flags) const
{
return activeState & flags;
}
bool AEventsReceiver::isMouseButtonPressed(MouseButton btn) const bool AEventsReceiver::isMouseButtonPressed(MouseButton btn) const
{ {
return currentMouseState.count(btn) ? currentMouseState.at(btn) : false; return currentMouseState.count(btn) ? currentMouseState.at(btn) : false;

View File

@@ -72,9 +72,6 @@ public:
/// Returns true if element is currently active and may receive events /// Returns true if element is currently active and may receive events
bool isActive() const; bool isActive() const;
/// Returns true if particular event(s) is active for this element
bool isActive(int flags) const;
/// Returns true if particular mouse button was pressed when inside this element /// Returns true if particular mouse button was pressed when inside this element
bool isMouseButtonPressed(MouseButton btn) const; bool isMouseButtonPressed(MouseButton btn) const;
}; };

View File

@@ -557,7 +557,6 @@ void CVolumeSlider::wheelScrolled(bool down, bool in)
void CSlider::sliderClicked() void CSlider::sliderClicked()
{ {
if(!isActive(MOVE))
addUsedEvents(MOVE); addUsedEvents(MOVE);
} }
@@ -699,7 +698,6 @@ void CSlider::clickLeft(tribool down, bool previousState)
moveTo((int)(rw * positions + 0.5)); moveTo((int)(rw * positions + 0.5));
return; return;
} }
if(isActive(MOVE))
removeUsedEvents(MOVE); removeUsedEvents(MOVE);
} }

View File

@@ -115,12 +115,10 @@ void CBuildingRect::hover(bool on)
{ {
if(on) if(on)
{ {
if(!isActive(MOVE))
addUsedEvents(MOVE); addUsedEvents(MOVE);
} }
else else
{ {
if(isActive(MOVE))
removeUsedEvents(MOVE); removeUsedEvents(MOVE);
if(parent->selectedBuilding == this) if(parent->selectedBuilding == this)