update protobuf + small changes
changes by @diamante0018 from https://github.com/XLabsProject/s1x-client/pull/369
This commit is contained in:
parent
15637abf91
commit
818c49cc02
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -40,7 +40,7 @@
|
||||
[submodule "deps/protobuf"]
|
||||
path = deps/protobuf
|
||||
url = https://github.com/protocolbuffers/protobuf.git
|
||||
branch = 3.17.x
|
||||
branch = 3.20.x
|
||||
[submodule "deps/zlib"]
|
||||
path = deps/zlib
|
||||
url = https://github.com/madler/zlib.git
|
||||
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit 5500c72c5b616da9f0125bcfab513987a1226e2b
|
||||
Subproject commit 6e9e60367d8744e86856590d8ea0e793c61deeec
|
@ -60,7 +60,7 @@ namespace bots
|
||||
|
||||
if (bot_ent)
|
||||
{
|
||||
spawn_bot(bot_ent->s.entityNum);
|
||||
spawn_bot(bot_ent->s.number);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
#include "game/scripting/execution.hpp"
|
||||
|
||||
#include "command.hpp"
|
||||
#include "console.hpp"
|
||||
#include "game_console.hpp"
|
||||
@ -8,11 +12,6 @@
|
||||
#include "scheduler.hpp"
|
||||
#include "logfile.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "game/scripting/execution.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/memory.hpp>
|
||||
@ -39,8 +38,14 @@ namespace command
|
||||
}
|
||||
}
|
||||
|
||||
void client_command(const int client_num)
|
||||
void client_command(const char client_num)
|
||||
{
|
||||
if (game::mp::g_entities[client_num].client == nullptr)
|
||||
{
|
||||
// Client is not fully connected
|
||||
return;
|
||||
}
|
||||
|
||||
if (!logfile::client_command_stub(client_num))
|
||||
{
|
||||
return;
|
||||
@ -539,9 +544,9 @@ namespace command
|
||||
static void add_commands_generic()
|
||||
{
|
||||
add("quit", game::Quit);
|
||||
add("crash", []()
|
||||
add("crash", []
|
||||
{
|
||||
*reinterpret_cast<int*>(1) = 0;
|
||||
*reinterpret_cast<int*>(1) = 0x12345678;
|
||||
});
|
||||
|
||||
add("commandDump", [](const params& argument)
|
||||
|
@ -32,7 +32,7 @@ namespace logfile
|
||||
return {};
|
||||
}
|
||||
|
||||
const scripting::entity player{game::Scr_GetEntityId(ent->s.entityNum, 0)};
|
||||
const scripting::entity player{game::Scr_GetEntityId(ent->s.number, 0)};
|
||||
return scripting::lua::convert(state, player);
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ namespace logfile
|
||||
scheduler::once([cmd, message, self, hidden]()
|
||||
{
|
||||
const scripting::entity level{*game::levelEntityId};
|
||||
const scripting::entity player{game::Scr_GetEntityId(self->s.entityNum, 0)};
|
||||
const scripting::entity player{game::Scr_GetEntityId(self->s.number, 0)};
|
||||
|
||||
scripting::notify(level, cmd, {player, message, hidden});
|
||||
scripting::notify(player, cmd, {message, hidden});
|
||||
|
@ -122,7 +122,7 @@ namespace patches
|
||||
|
||||
command::params_sv params{};
|
||||
const auto menu_id = atoi(params.get(1));
|
||||
const auto client = &svs_clients[ent->s.entityNum];
|
||||
const auto client = &svs_clients[ent->s.number];
|
||||
|
||||
// 13 => change class
|
||||
if (menu_id == 13 && ent->client->team == game::mp::TEAM_SPECTATOR)
|
||||
|
@ -1565,7 +1565,7 @@ namespace game
|
||||
|
||||
struct EntityState
|
||||
{
|
||||
uint16_t entityNum;
|
||||
uint16_t number;
|
||||
}; // size = ?
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
@ -21,7 +21,8 @@ namespace utils::flags
|
||||
if (wide_flag[0] == L'-')
|
||||
{
|
||||
wide_flag.erase(wide_flag.begin());
|
||||
flags.emplace_back(string::convert(wide_flag));
|
||||
const auto flag = string::convert(wide_flag);
|
||||
flags.emplace_back(string::to_lower(flag));
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,14 +41,7 @@ namespace utils::flags
|
||||
parsed = true;
|
||||
}
|
||||
|
||||
for (const auto& entry : enabled_flags)
|
||||
{
|
||||
if (string::to_lower(entry) == string::to_lower(flag))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return std::ranges::any_of(enabled_flags.cbegin(), enabled_flags.cend(),
|
||||
[flag](const auto& elem) { return elem == string::to_lower(flag); });
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace utils
|
||||
return value->second;
|
||||
}
|
||||
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void info_string::parse(std::string buffer)
|
||||
@ -49,15 +49,15 @@ namespace utils
|
||||
{
|
||||
//auto first = true;
|
||||
std::string info_string;
|
||||
for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i)
|
||||
for (const auto& [key, val] : this->key_value_pairs_)
|
||||
{
|
||||
//if (first) first = false;
|
||||
/*else*/
|
||||
info_string.append("\\");
|
||||
|
||||
info_string.append(i->first); // Key
|
||||
info_string.append(key);
|
||||
info_string.append("\\");
|
||||
info_string.append(i->second); // Value
|
||||
info_string.append(val);
|
||||
}
|
||||
|
||||
return info_string;
|
||||
|
@ -32,7 +32,7 @@ namespace utils::io
|
||||
|
||||
if (stream.is_open())
|
||||
{
|
||||
stream.write(data.data(), data.size());
|
||||
stream.write(data.data(), static_cast<std::streamsize>(data.size()));
|
||||
stream.close();
|
||||
return true;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace utils
|
||||
|
||||
void* memory::allocate(const size_t length)
|
||||
{
|
||||
return calloc(length, 1);
|
||||
return std::calloc(length, 1);
|
||||
}
|
||||
|
||||
char* memory::duplicate_string(const std::string& string)
|
||||
@ -86,7 +86,7 @@ namespace utils
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
::free(data);
|
||||
std::free(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
tools/protoc.exe
BIN
tools/protoc.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user