chore: update
This commit is contained in:
2
deps/GSL
vendored
2
deps/GSL
vendored
Submodule deps/GSL updated: 7e0943d20d...543d0dd3fe
2
deps/gsc-tool
vendored
2
deps/gsc-tool
vendored
Submodule deps/gsc-tool updated: c508e5b10f...c9bd8e5c6a
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
Submodule deps/libtomcrypt updated: d448df1938...c421e570c6
2
deps/minhook
vendored
2
deps/minhook
vendored
Submodule deps/minhook updated: 565968b285...1e9ad1eb42
@@ -15,7 +15,7 @@ namespace demonware
|
||||
{
|
||||
std::string get_motd_text()
|
||||
{
|
||||
return "This is not a copy & pasted client";
|
||||
return "Did you know aiming down sights increases accuracy? Online Interactions Not Rated by the ESRB.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
Welcome to s1-mod. This is not a copy & pasted project.
|
||||
Welcome to s1-mod. Did you know aiming down sights increases accuracy? Online Interactions Not Rated by the ESRB.
|
||||
@@ -22,54 +22,54 @@ namespace utils::string
|
||||
++this->current_buffer_ %= ARRAY_COUNT(this->string_pool_);
|
||||
auto entry = &this->string_pool_[this->current_buffer_];
|
||||
|
||||
if (!entry->size || !entry->buffer)
|
||||
if (!entry->size_ || !entry->buffer_)
|
||||
{
|
||||
throw std::runtime_error("String pool not initialized");
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
const int res = vsnprintf_s(entry->buffer, entry->size, _TRUNCATE, format, ap);
|
||||
const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap);
|
||||
if (res > 0) break; // Success
|
||||
if (res == 0) return nullptr; // Error
|
||||
|
||||
entry->double_size();
|
||||
}
|
||||
|
||||
return entry->buffer;
|
||||
return entry->buffer_;
|
||||
}
|
||||
|
||||
private:
|
||||
class entry final
|
||||
{
|
||||
public:
|
||||
explicit entry(const size_t _size = MinBufferSize) : size(_size), buffer(nullptr)
|
||||
explicit entry(const size_t size = MinBufferSize) : size_(size), buffer_(nullptr)
|
||||
{
|
||||
if (this->size < MinBufferSize) this->size = MinBufferSize;
|
||||
if (this->size_ < MinBufferSize) this->size_ = MinBufferSize;
|
||||
this->allocate();
|
||||
}
|
||||
|
||||
~entry()
|
||||
{
|
||||
if (this->buffer) memory::get_allocator()->free(this->buffer);
|
||||
this->size = 0;
|
||||
this->buffer = nullptr;
|
||||
if (this->buffer_) memory::get_allocator()->free(this->buffer_);
|
||||
this->size_ = 0;
|
||||
this->buffer_ = nullptr;
|
||||
}
|
||||
|
||||
void allocate()
|
||||
{
|
||||
if (this->buffer) memory::get_allocator()->free(this->buffer);
|
||||
this->buffer = memory::get_allocator()->allocate_array<char>(this->size + 1);
|
||||
if (this->buffer_) memory::get_allocator()->free(this->buffer_);
|
||||
this->buffer_ = memory::get_allocator()->allocate_array<char>(this->size_ + 1);
|
||||
}
|
||||
|
||||
void double_size()
|
||||
{
|
||||
this->size *= 2;
|
||||
this->size_ *= 2;
|
||||
this->allocate();
|
||||
}
|
||||
|
||||
size_t size;
|
||||
char* buffer;
|
||||
size_t size_;
|
||||
char* buffer_;
|
||||
};
|
||||
|
||||
size_t current_buffer_;
|
||||
|
||||
Reference in New Issue
Block a user