1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +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);
}
void ClientCommandManager::handleGuiCommand()
{
for(const auto & child : GH.windows().findWindows<CIntObject>())
printInfoAboutInterfaceObject(child.get(), 0);
}
void ClientCommandManager::handleConvertTextCommand()
{
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)
{
YourTurn yt;
@ -569,9 +533,6 @@ void ClientCommandManager::processCommand(const std::string & message, bool call
else if(commandName == "not dialog")
handleNotDialogCommand();
else if(commandName == "gui")
handleGuiCommand();
else if(message=="convert txt")
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"
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
void handleConvertTextCommand();
@ -92,7 +89,6 @@ class ClientCommandManager //take mantis #2292 issue about account if thinking a
// Prints in Chat the given message
void printCommandMessage(const std::string &commandMessage, ELogLevel::ELogLevel messageType = ELogLevel::NOT_SET);
void printInfoAboutInterfaceObject(const CIntObject *obj, int level);
void giveTurn(const PlayerColor &color);
public:

View File

@ -31,11 +31,6 @@ bool AEventsReceiver::isActive() const
return activeState;
}
bool AEventsReceiver::isActive(int flags) const
{
return activeState & flags;
}
bool AEventsReceiver::isMouseButtonPressed(MouseButton btn) const
{
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
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
bool isMouseButtonPressed(MouseButton btn) const;
};

View File

@ -557,8 +557,7 @@ void CVolumeSlider::wheelScrolled(bool down, bool in)
void CSlider::sliderClicked()
{
if(!isActive(MOVE))
addUsedEvents(MOVE);
addUsedEvents(MOVE);
}
void CSlider::mouseMoved (const Point & cursorPosition)
@ -699,8 +698,7 @@ void CSlider::clickLeft(tribool down, bool previousState)
moveTo((int)(rw * positions + 0.5));
return;
}
if(isActive(MOVE))
removeUsedEvents(MOVE);
removeUsedEvents(MOVE);
}
CSlider::CSlider(Point position, int totalw, std::function<void(int)> Moved, int Capacity, int Amount, int Value, bool Horizontal, CSlider::EStyle style)

View File

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