Skip to content

Commit c3b4954

Browse files
feat: send player coordinates to server
1 parent 43a54b3 commit c3b4954

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/core/game.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ void Game::Update() {
126126
NpcMovementHandler::UpdateNpcMovement(*npc_);
127127

128128
// TODO(ramirezfernando): Send local player state to server.
129-
const std::string msg = "Hello from client";
129+
const auto& [x, y] = player_->GetCoordinate();
130+
const std::string msg = std::to_string(x) + "_" + std::to_string(y);
130131
client_->Send(msg.c_str(), msg.size());
131132

132133
// TODO(ramirezfernando): Receive updated other player state from server.
133134
std::array<char, Constants::MAX_BUFFER_SIZE> buffer{};
134135
const ssize_t bytes_received = client_->Receive(buffer.data(), buffer.size());
135136
if (bytes_received > 0) {
136-
buffer.at(static_cast<size_t>(bytes_received)) = '\0';
137137
Logger::Debug("Game", "Received: " + std::string(buffer.data()));
138138
}
139139
}

0 commit comments

Comments
 (0)