Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions modules/game_battle/battle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ function init()
connect(Creature, {
onSkullChange = updateCreatureSkull,
onEmblemChange = updateCreatureEmblem,
onOutfitChange = onCreatureOutfitChange,
onHealthPercentChange = onCreatureHealthPercentChange,
onPositionChange = onCreaturePositionChange,
onAppear = onCreatureAppear,
Expand Down Expand Up @@ -98,7 +97,6 @@ function terminate()
disconnect(Creature, {
onSkullChange = updateCreatureSkull,
onEmblemChange = updateCreatureEmblem,
onOutfitChange = onCreatureOutfitChange,
onHealthPercentChange = onCreatureHealthPercentChange,
onPositionChange = onCreaturePositionChange,
onAppear = onCreatureAppear,
Expand Down Expand Up @@ -228,9 +226,7 @@ function checkCreatures()
local player = g_game.getLocalPlayer()
local spectators = g_map.getSpectators(player:getPosition(), false)
for _, creature in ipairs(spectators) do
if doCreatureFitFilters(creature) then
addCreature(creature)
end
addCreature(creature)
end
end

Expand Down Expand Up @@ -323,24 +319,14 @@ function onCreaturePositionChange(creature, newPos, oldPos)
end
end

function onCreatureOutfitChange(creature, outfit, oldOutfit)
if doCreatureFitFilters(creature) then
addCreature(creature)
else
removeCreature(creature)
end
end

function onCreatureAppear(creature)
if creature:isLocalPlayer() then
addEvent(function()
updateStaticSquare()
end)
end

if doCreatureFitFilters(creature) then
addCreature(creature)
end
addCreature(creature)
end

function onCreatureDisappear(creature)
Expand Down Expand Up @@ -452,7 +438,7 @@ function addCreature(creature)
end

local localPlayer = g_game.getLocalPlayer()
battleButton:setVisible(localPlayer:hasSight(creature:getPosition()) and creature:canBeSeen())
battleButton:setVisible(localPlayer:hasSight(creature:getPosition()) and creature:canBeSeen() and doCreatureFitFilters(creature))
end

function removeAllCreatures()
Expand Down
2 changes: 2 additions & 0 deletions src/client/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ void Game::processAttackCancel(uint seq)
{
if(isAttacking() && (seq == 0 || m_seq == seq))
cancelAttack();
else if (isFollowing() && (seq == 0 || m_seq == seq))
cancelFollow();
}

void Game::processWalkCancel(Otc::Direction direction)
Expand Down
4 changes: 2 additions & 2 deletions src/client/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ class Game
bool isOnline() { return m_online; }
bool isLogging() { return !m_online && m_protocolGame; }
bool isDead() { return m_dead; }
bool isAttacking() { return !!m_attackingCreature && !m_attackingCreature->isRemoved(); }
bool isFollowing() { return !!m_followingCreature && !m_followingCreature->isRemoved(); }
bool isAttacking() { return !!m_attackingCreature; }
bool isFollowing() { return !!m_followingCreature; }
bool isConnectionOk() { return m_protocolGame && m_protocolGame->getElapsedTicksSinceLastRead() < 5000; }

int getPing() { return m_ping >= 0 ? std::max<int>(m_ping, m_pingTimer.elapsed_millis()) : -1; }
Expand Down
2 changes: 0 additions & 2 deletions src/client/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ uint8 Tile::getMinimapColorByte()
return m_minimapColor;

for(const ThingPtr& thing : m_things) {
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())
break;
uint8 c = thing->getMinimapColor();
if(c != 0)
color = c;
Expand Down