diff --git a/src/lua/functions/creatures/creature_functions.cpp b/src/lua/functions/creatures/creature_functions.cpp index 6b09945971a..81a4a0b5304 100644 --- a/src/lua/functions/creatures/creature_functions.cpp +++ b/src/lua/functions/creatures/creature_functions.cpp @@ -1020,11 +1020,11 @@ int CreatureFunctions::luaCreatureSetIcon(lua_State* L) { return 1; } const auto key = getString(L, 2); - auto category = getNumber(L, 3); - auto count = getNumber(L, 5, 0); + const auto category = getNumber(L, 3); + const auto count = getNumber(L, 5, 0); CreatureIcon creatureIcon; if (category == CreatureIconCategory_t::Modifications) { - auto icon = getNumber(L, 5); + auto icon = getNumber(L, 4); creatureIcon = CreatureIcon(icon, count); } else { auto icon = getNumber(L, 4); diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index ca6f1f77961..032b9b512d0 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -4931,8 +4931,9 @@ void ProtocolGame::sendSaleItemList(const std::vector &shopVector, co } uint16_t itemsToSend = 0; + const uint16_t ItemsToSendLimit = oldProtocol ? 0xFF : 0xFFFF; auto msgPosition = msg.getBufferPosition(); - msg.skipBytes(2); + msg.skipBytes(oldProtocol ? 1 : 2); for (const ShopBlock &shopBlock : shopVector) { if (shopBlock.itemSellPrice == 0) { @@ -4947,14 +4948,18 @@ void ProtocolGame::sendSaleItemList(const std::vector &shopVector, co } else { msg.add(std::min(it->second, std::numeric_limits::max())); } - if (++itemsToSend >= 0xFFFF) { + if (++itemsToSend >= ItemsToSendLimit) { break; } } } msg.setBufferPosition(msgPosition); - msg.add(itemsToSend); + if (oldProtocol) { + msg.addByte(static_cast(itemsToSend)); + } else { + msg.add(itemsToSend); + } writeToOutputBuffer(msg); }