Compare commits

..

No commits in common. "c3a7148686d87a3cb68704304888c4743fb505b0" and "4d60403adf9b43d5efa1bc4f4d0f21615560dbda" have entirely different histories.

2 changed files with 9 additions and 7 deletions

View file

@ -52,9 +52,9 @@ PacketHandler::HandlePacket(std::shared_ptr<Session> session,
} break;
case PacketID::CS_UpgradeSword: {
auto currentLevel = session->GetSwordLevel();
auto cost = SwordLogic::GetUpgradeCost(currentLevel);
auto currentGold = session->GetGold();
uint32_t currentLevel = session->GetSwordLevel();
uint64_t cost = SwordLogic::GetUpgradeCost(currentLevel);
uint64_t currentGold = session->GetGold();
Protocol::SC_UpgradeResult res;
if (currentGold < cost) {
@ -62,7 +62,7 @@ PacketHandler::HandlePacket(std::shared_ptr<Session> session,
res.set_result(2);
} else {
session->SetGold(currentGold - cost);
auto result = SwordLogic::TryUpgrade(currentLevel);
uint8_t result = SwordLogic::TryUpgrade(currentLevel);
res.set_result(result);
// 성공
@ -113,9 +113,9 @@ PacketHandler::HandlePacket(std::shared_ptr<Session> session,
} break;
case PacketID::CS_SellSword: {
auto currentLevel = session->GetSwordLevel();
auto price = SwordLogic::GetSellPrice(currentLevel);
auto newGold = session->GetGold() + price;
uint32_t currentLevel = session->GetSwordLevel();
uint64_t price = SwordLogic::GetSellPrice(currentLevel);
uint64_t newGold = session->GetGold() + price;
session->SetGold(newGold);
session->SetSwordLevel(0);

View file

@ -43,6 +43,8 @@ void SessionManager::Broadcast(PacketHeader header,
std::memcpy(buffer.data() + sizeof(PacketHeader), body.data(), body.size());
for (auto &session : sessions_) {
// session::send에 span을 전달해야 함. 벡터 자체를 전달할 수도 있지만 우리
// Send는 span을 인자로 받음. Session::Send는 span을 받아 복사본을 생성함.
session->Send(buffer);
}
}