Fix Name Signature
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <Core/Loggers.hpp>
|
||||
#include <Core/Player.hpp>
|
||||
#include <rewindow/inputservice.hpp>
|
||||
#include <Core/Macros.hpp>
|
||||
|
||||
namespace CaveGame::ClientApp
|
||||
{
|
||||
@@ -443,25 +444,13 @@ namespace CaveGame::ClientApp
|
||||
wanna_die = true;
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string& s, char delim)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::stringstream ss (s);
|
||||
std::string item;
|
||||
|
||||
while(getline(ss, item, delim)) {
|
||||
result.push_back(item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void CaveGameWindow::create_console_window() {
|
||||
console_window = new Client::Console(this->wm);
|
||||
console_window->Visible(false);
|
||||
|
||||
console_window->OnInput += [this] (const std::string& msg)
|
||||
{
|
||||
auto tokens = split(msg, ' ');
|
||||
auto tokens = string_split(msg, ' ');
|
||||
if (tokens[0] == "tp")
|
||||
{
|
||||
std::cout << "Teleport Command" << std::endl;
|
||||
|
@@ -9,12 +9,15 @@ namespace CaveGame::Core
|
||||
/// Primitive Serialization Functions.
|
||||
|
||||
/// A data container structure which keeps track of the current position.
|
||||
|
||||
struct Buffer {
|
||||
size_t size;
|
||||
size_t index;
|
||||
uint8_t* data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/// Converts a 16-bit unsigned integer into a floating point number. @see float_to_u16.
|
||||
float u16_to_float(uint16_t value);
|
||||
/// Converts a floating point number to a 16-bit unsigned integer. This in effect, drops the accuracy of the float in exchange for compression.
|
||||
@@ -56,12 +59,14 @@ namespace CaveGame::Core
|
||||
/// Reads a 8-byte signed int from the buffer, from network-byte-order, and advances the index by 8.
|
||||
int64_t read_s64(Buffer& buffer);
|
||||
|
||||
/// Writes a half-precision float to the buffer, via reinterpreting as uint16_t, and advances the index by 2.
|
||||
void write_f16(Buffer& buffer, float value);
|
||||
/// Writes a 4-byte float to the buffer, via reinterpreting as uint32_t, and advances the index by 4.
|
||||
void write_f32(Buffer& buffer, float value);
|
||||
/// Writes a 8-byte float to the buffer, via reinterpreting as uint64_t, and advances the index by 8.
|
||||
void write_f64(Buffer& buffer, double value);
|
||||
|
||||
/// Reads a half-precision float from the buffer, via reinterpreting from uint16_t, and advances the index by 2.
|
||||
float read_f16(Buffer& buffer);
|
||||
/// Reads a 4-byte float from the buffer, via reinterpreting from uint32_t, and advances the index by 4.
|
||||
float read_f32(Buffer& buffer);
|
||||
@@ -74,4 +79,16 @@ namespace CaveGame::Core
|
||||
|
||||
std::string read_string(Buffer& buffer);
|
||||
|
||||
|
||||
class ByteBuffer
|
||||
{
|
||||
Buffer buff;
|
||||
/// Write a uint8_t.
|
||||
ByteBuffer& operator<<(uint8_t& val);
|
||||
/// Write a uint16_t.
|
||||
ByteBuffer& operator<<(uint16_t& val);
|
||||
/// Write a uint32_t.
|
||||
ByteBuffer& operator<<(uint32_t& val);
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user