Properly unset the civilisation when unchecked in Atlas.
Previously, atlas would save the default value when the 'civilisation' checkbox was unset. Patch by: nwtour Differential Revision: https://code.wildfiregames.com/D3725 This was SVN commit r25108.
This commit is contained in:
parent
87a2c3347f
commit
1867b70d3a
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -166,6 +166,7 @@ public:
|
||||
void add(const char* key, AtObj& data);
|
||||
void set(const char* key, const char* value);
|
||||
void set(const char* key, AtObj& data);
|
||||
void unset(const char* key);
|
||||
void setBool(const char* key, bool value);
|
||||
void setDouble(const char* key, double value);
|
||||
void setInt(const char* key, int value);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -182,6 +182,14 @@ void AtObj::set(const char* key, const char* value)
|
||||
m_Node = m_Node->setChild(key, AtNode::Ptr(o));
|
||||
}
|
||||
|
||||
void AtObj::unset(const char* key)
|
||||
{
|
||||
if (!m_Node)
|
||||
m_Node = new AtNode();
|
||||
|
||||
m_Node = m_Node->unsetChild(key);
|
||||
}
|
||||
|
||||
void AtObj::setBool(const char* key, bool value)
|
||||
{
|
||||
AtNode* o = new AtNode(value ? "true" : "false");
|
||||
@ -287,6 +295,13 @@ const AtNode::Ptr AtNode::setChild(const char* key, const AtNode::Ptr &data) con
|
||||
return AtNode::Ptr(newNode);
|
||||
}
|
||||
|
||||
const AtNode::Ptr AtNode::unsetChild(const char* key) const
|
||||
{
|
||||
AtNode* newNode = new AtNode(this);
|
||||
newNode->m_Children.erase(key);
|
||||
return AtNode::Ptr(newNode);
|
||||
}
|
||||
|
||||
const AtNode::Ptr AtNode::addChild(const char* key, const AtNode::Ptr &data) const
|
||||
{
|
||||
AtNode* newNode = new AtNode(this);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -48,6 +48,7 @@ public:
|
||||
const AtNode::Ptr setValue(const char* value) const;
|
||||
const AtNode::Ptr addChild(const char* key, const AtNode::Ptr &data) const;
|
||||
const AtNode::Ptr setChild(const char* key, const AtNode::Ptr &data) const;
|
||||
const AtNode::Ptr unsetChild(const char* key) const;
|
||||
const AtNode::Ptr addOverlay(const AtNode::Ptr &data) const;
|
||||
const AtIter getChild(const char* key) const;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -861,7 +861,7 @@ AtObj PlayerSettingsControl::UpdateSettingsObject()
|
||||
player.set("Civ", str->GetData());
|
||||
}
|
||||
else
|
||||
player.set("Civ", playerDefs["Civ"]);
|
||||
player.unset("Civ");
|
||||
|
||||
// color
|
||||
if (controls.color->IsEnabled())
|
||||
|
Loading…
Reference in New Issue
Block a user