parent
df1afddf88
commit
d8e862819b
@ -7,6 +7,7 @@
|
||||
#include "scheduler.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
#include <utils/info_string.hpp>
|
||||
#include <utils/cryptography.hpp>
|
||||
#include <utils/concurrency.hpp>
|
||||
@ -127,7 +128,7 @@ namespace party
|
||||
|
||||
host.info.netAdr = addr;
|
||||
host.info.xuid = xuid;
|
||||
strcpy_s(host.info.name, hostname.data());
|
||||
utils::string::copy(host.info.name, hostname.data());
|
||||
|
||||
host.lobbyType = game::LOBBY_TYPE_PRIVATE;
|
||||
host.lobbyParams.networkMode = game::LOBBY_NETWORKMODE_LIVE;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <std_include.hpp>
|
||||
#include "byte_buffer.hpp"
|
||||
#include <utils/string.hpp>
|
||||
|
||||
namespace demonware
|
||||
{
|
||||
@ -90,7 +91,7 @@ namespace demonware
|
||||
{
|
||||
if (!this->read_data_type(16)) return false;
|
||||
|
||||
strcpy_s(output, length, const_cast<char*>(this->buffer_.data()) + this->current_byte_);
|
||||
utils::string::copy(output, static_cast<size_t>(length), const_cast<char*>(this->buffer_.data()) + this->current_byte_);
|
||||
this->current_byte_ += strlen(output) + 1;
|
||||
|
||||
return true;
|
||||
|
@ -38,9 +38,9 @@ namespace steam
|
||||
server.m_nPing = static_cast<int>(ping);
|
||||
server.m_bHadSuccessfulResponse = success;
|
||||
server.m_bDoNotRefresh = false;
|
||||
strcpy_s(server.m_szGameDir, "");
|
||||
strcpy_s(server.m_szMap, info.get("mapname").data());
|
||||
strcpy_s(server.m_szGameDescription, info.get("description").data());
|
||||
::utils::string::copy(server.m_szGameDir, "");
|
||||
::utils::string::copy(server.m_szMap, info.get("mapname").data());
|
||||
::utils::string::copy(server.m_szGameDescription, info.get("description").data());
|
||||
server.m_nAppID = 311210;
|
||||
server.m_nPlayers = atoi(info.get("clients").data());
|
||||
server.m_nMaxPlayers = atoi(info.get("sv_maxclients").data());
|
||||
@ -49,7 +49,7 @@ namespace steam
|
||||
server.m_bSecure = true;
|
||||
server.m_ulTimeLastPlayed = 0;
|
||||
server.m_nServerVersion = 1000;
|
||||
strcpy_s(server.m_szServerName, info.get("hostname").data());
|
||||
::utils::string::copy(server.m_szServerName, info.get("hostname").data());
|
||||
|
||||
const auto playmode = info.get("playmode");
|
||||
const auto mode = game::eModes(std::atoi(playmode.data()));
|
||||
@ -60,7 +60,7 @@ namespace steam
|
||||
info.get("dedicated") == "1" ? "true" : "false",
|
||||
mode == game::MODE_ZOMBIES ? "true" : "false", server.m_nPlayers);
|
||||
|
||||
strcpy_s(server.m_szGameTags, tags);
|
||||
::utils::string::copy(server.m_szGameTags, tags);
|
||||
server.m_steamID.bits = strtoull(info.get("xuid").data(), nullptr, 16);
|
||||
|
||||
return server;
|
||||
|
@ -174,4 +174,23 @@ namespace utils::string
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void copy(char* dest, const size_t max_size, const char* src)
|
||||
{
|
||||
for (size_t i = 0;; ++i)
|
||||
{
|
||||
if (i + 1 == max_size)
|
||||
{
|
||||
dest[i] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
dest[i] = src[i];
|
||||
|
||||
if (!src[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,4 +94,12 @@ namespace utils::string
|
||||
std::wstring convert(const std::string& str);
|
||||
|
||||
std::string replace(std::string str, const std::string& from, const std::string& to);
|
||||
|
||||
void copy(char* dest, size_t max_size, const char* src);
|
||||
|
||||
template <size_t Size>
|
||||
void copy(char (&dest)[Size], const char* src)
|
||||
{
|
||||
copy(dest, Size, src);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user