Compare commits

..

2 commits

Author SHA1 Message Date
c3a7148686 refactor: 반환값 auto로 변경 2026-02-09 15:13:19 +00:00
a2b92134ce doc: 잘못된 주석 수정 2026-02-09 14:14:23 +00:00
2 changed files with 7 additions and 9 deletions

View file

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

View file

@ -43,8 +43,6 @@ 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);
}
}