Skip to content

Commit

Permalink
Fixed #125.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed Jun 23, 2020
1 parent dc41400 commit 7981c45
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/client/world/ClientWorld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ClientWorld : public World, public gk::Drawable {
ClientCommandHandler *m_client = nullptr;
gk::Camera *m_camera = nullptr;

mutable gk::Vector4f m_closestInitializedChunk{0, 0, 0, 1000000};
mutable gk::Vector4d m_closestInitializedChunk{0, 0, 0, 1000000};

const Sky *m_sky = nullptr;
};
Expand Down
6 changes: 3 additions & 3 deletions source/common/world/Player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class Player : public gk::ISerializable {

u16 m_dimension = 0;

float m_viewAngleH;
float m_viewAngleV;
float m_viewAngleRoll;
float m_viewAngleH = 0;
float m_viewAngleV = 0;
float m_viewAngleRoll = 0;

u16 m_clientID = 0;

Expand Down
17 changes: 11 additions & 6 deletions source/server/network/ChatCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,20 @@ void ChatCommandHandler::teleportationCommand(const std::vector<std::string> &co
m_server.sendChatMessage(0, "Usage: /tp x y z", &client);
}
else {
s32 x = std::stoi(command.at(1));
s32 y = std::stoi(command.at(2));
s32 z = std::stoi(command.at(3));
try {
s32 x = std::stoi(command.at(1));
s32 y = std::stoi(command.at(2));
s32 z = std::stoi(command.at(3));

m_server.setPlayerPosition(client.id, x, y, z);
m_server.setPlayerPosition(client.id, x, y, z);

m_server.sendPlayerPosUpdate(client.id, true);
m_server.sendPlayerPosUpdate(client.id, true);

m_server.sendChatMessage(0, "Teleported to " + std::to_string(x) + " " + std::to_string(y) + " " + std::to_string(z), &client);
m_server.sendChatMessage(0, "Teleported to " + std::to_string(x) + " " + std::to_string(y) + " " + std::to_string(z), &client);
}
catch (std::out_of_range &e) {
m_server.sendChatMessage(0, "Invalid coordinates", &client);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/server/world/ServerWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void ServerWorld::sendChunkData(const ClientInfo &client, ServerChunk &chunk) {
chunk.setSent(true);
chunk.setChanged(false);

// std::cout << "Chunk at (" << chunk->x() << ", " << chunk->y() << ", " << chunk->z() << ") sent to client" << std::endl;
// std::cout << "Chunk at (" << chunk.x() << ", " << chunk.y() << ", " << chunk.z() << ") sent to client" << std::endl;
}

void ServerWorld::sendRequestedData(ClientInfo &client, int cx, int cy, int cz) {
Expand Down

0 comments on commit 7981c45

Please sign in to comment.