Skip to content

Commit

Permalink
Merge branch 'main' into Review-Quests-V9
Browse files Browse the repository at this point in the history
  • Loading branch information
majestyotbr authored Aug 26, 2024
2 parents 2258d82 + 89ce6c4 commit ec1d4a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/lua/functions/creatures/creature_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,11 @@ int CreatureFunctions::luaCreatureSetIcon(lua_State* L) {
return 1;
}
const auto key = getString(L, 2);
auto category = getNumber<CreatureIconCategory_t>(L, 3);
auto count = getNumber<uint16_t>(L, 5, 0);
const auto category = getNumber<CreatureIconCategory_t>(L, 3);
const auto count = getNumber<uint16_t>(L, 5, 0);
CreatureIcon creatureIcon;
if (category == CreatureIconCategory_t::Modifications) {
auto icon = getNumber<CreatureIconModifications_t>(L, 5);
auto icon = getNumber<CreatureIconModifications_t>(L, 4);
creatureIcon = CreatureIcon(icon, count);
} else {
auto icon = getNumber<CreatureIconQuests_t>(L, 4);
Expand Down
11 changes: 8 additions & 3 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4931,8 +4931,9 @@ void ProtocolGame::sendSaleItemList(const std::vector<ShopBlock> &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) {
Expand All @@ -4947,14 +4948,18 @@ void ProtocolGame::sendSaleItemList(const std::vector<ShopBlock> &shopVector, co
} else {
msg.add<uint16_t>(std::min<uint16_t>(it->second, std::numeric_limits<uint16_t>::max()));
}
if (++itemsToSend >= 0xFFFF) {
if (++itemsToSend >= ItemsToSendLimit) {
break;
}
}
}

msg.setBufferPosition(msgPosition);
msg.add<uint16_t>(itemsToSend);
if (oldProtocol) {
msg.addByte(static_cast<uint8_t>(itemsToSend));
} else {
msg.add<uint16_t>(itemsToSend);
}
writeToOutputBuffer(msg);
}

Expand Down

0 comments on commit ec1d4a0

Please sign in to comment.