Fix #3463
This commit is contained in:
parent
896768ebbe
commit
56e9be326e
@ -41,6 +41,7 @@ static std::vector<UserConfigParam*> all_params;
|
|||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -53,9 +54,12 @@ const int UserConfig::m_current_config_version = 8;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
UserConfigParam::~UserConfigParam()
|
UserConfigParam::~UserConfigParam()
|
||||||
{
|
{
|
||||||
// Now we have server config param so we cannot do this anymore,
|
if (m_can_be_deleted)
|
||||||
// esp all params are kept until the closing of stk anyway
|
{
|
||||||
//all_params.remove(this);
|
auto it = std::find(all_params.begin(), all_params.end(), this);
|
||||||
|
if (it != all_params.end())
|
||||||
|
all_params.erase(it);
|
||||||
|
}
|
||||||
} // ~UserConfigParam
|
} // ~UserConfigParam
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -66,6 +66,7 @@ class UserConfigParam
|
|||||||
{
|
{
|
||||||
friend class GroupUserConfigParam;
|
friend class GroupUserConfigParam;
|
||||||
protected:
|
protected:
|
||||||
|
bool m_can_be_deleted = true;
|
||||||
std::string m_param_name;
|
std::string m_param_name;
|
||||||
std::string m_comment;
|
std::string m_comment;
|
||||||
public:
|
public:
|
||||||
|
@ -51,6 +51,7 @@ FloatServerConfigParam::FloatServerConfigParam(float default_value,
|
|||||||
const char* comment)
|
const char* comment)
|
||||||
: FloatUserConfigParam(param_name, comment)
|
: FloatUserConfigParam(param_name, comment)
|
||||||
{
|
{
|
||||||
|
m_can_be_deleted = false;
|
||||||
m_value = default_value;
|
m_value = default_value;
|
||||||
m_default_value = default_value;
|
m_default_value = default_value;
|
||||||
g_server_params.push_back(this);
|
g_server_params.push_back(this);
|
||||||
@ -62,6 +63,7 @@ IntServerConfigParam::IntServerConfigParam(int default_value,
|
|||||||
const char* comment)
|
const char* comment)
|
||||||
: IntUserConfigParam(param_name, comment)
|
: IntUserConfigParam(param_name, comment)
|
||||||
{
|
{
|
||||||
|
m_can_be_deleted = false;
|
||||||
m_value = default_value;
|
m_value = default_value;
|
||||||
m_default_value = default_value;
|
m_default_value = default_value;
|
||||||
g_server_params.push_back(this);
|
g_server_params.push_back(this);
|
||||||
@ -73,6 +75,7 @@ BoolServerConfigParam::BoolServerConfigParam(bool default_value,
|
|||||||
const char* comment)
|
const char* comment)
|
||||||
: BoolUserConfigParam(param_name, comment)
|
: BoolUserConfigParam(param_name, comment)
|
||||||
{
|
{
|
||||||
|
m_can_be_deleted = false;
|
||||||
m_value = default_value;
|
m_value = default_value;
|
||||||
m_default_value = default_value;
|
m_default_value = default_value;
|
||||||
g_server_params.push_back(this);
|
g_server_params.push_back(this);
|
||||||
@ -84,6 +87,7 @@ StringServerConfigParam::StringServerConfigParam(std::string default_value,
|
|||||||
const char* comment)
|
const char* comment)
|
||||||
: StringUserConfigParam(param_name, comment)
|
: StringUserConfigParam(param_name, comment)
|
||||||
{
|
{
|
||||||
|
m_can_be_deleted = false;
|
||||||
m_value = default_value;
|
m_value = default_value;
|
||||||
m_default_value = default_value;
|
m_default_value = default_value;
|
||||||
g_server_params.push_back(this);
|
g_server_params.push_back(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user