Add initial way to make some bubbles traversable and others solid. More tweaking will be necessary
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10630 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f30bab0dea
commit
2c9db720c0
@ -179,6 +179,21 @@ int XMLNode::get(const std::string &attribute, std::string *value) const
|
|||||||
if(o==m_attributes.end()) return 0;
|
if(o==m_attributes.end()) return 0;
|
||||||
*value=core::stringc(o->second).c_str();
|
*value=core::stringc(o->second).c_str();
|
||||||
return 1;
|
return 1;
|
||||||
|
} // get
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
/** If 'attribute' was defined, set 'value' to the value of the
|
||||||
|
* attribute and return 1, otherwise return 0 and do not change value.
|
||||||
|
* \param attribute Name of the attribute.
|
||||||
|
* \param value Value of the attribute.
|
||||||
|
*/
|
||||||
|
int XMLNode::get(const std::string &attribute, core::stringc *value) const
|
||||||
|
{
|
||||||
|
if(m_attributes.size()==0) return 0;
|
||||||
|
std::map<std::string, core::stringw>::const_iterator o;
|
||||||
|
o = m_attributes.find(attribute);
|
||||||
|
if(o==m_attributes.end()) return 0;
|
||||||
|
*value = core::stringc(o->second).c_str();
|
||||||
|
return 1;
|
||||||
} // get
|
} // get
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int XMLNode::get(const std::string &attribute, core::stringw *value) const
|
int XMLNode::get(const std::string &attribute, core::stringw *value) const
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
const XMLNode *getNode(unsigned int i) const;
|
const XMLNode *getNode(unsigned int i) const;
|
||||||
unsigned int getNumNodes() const {return m_nodes.size(); }
|
unsigned int getNumNodes() const {return m_nodes.size(); }
|
||||||
int get(const std::string &attribute, std::string *value) const;
|
int get(const std::string &attribute, std::string *value) const;
|
||||||
|
int get(const std::string &attribute, core::stringc *value) const;
|
||||||
int get(const std::string &attribute, core::stringw *value) const;
|
int get(const std::string &attribute, core::stringw *value) const;
|
||||||
int get(const std::string &attribute, int32_t *value) const;
|
int get(const std::string &attribute, int32_t *value) const;
|
||||||
int get(const std::string &attribute, uint32_t *value) const;
|
int get(const std::string &attribute, uint32_t *value) const;
|
||||||
|
@ -693,18 +693,53 @@ bool Track::loadMainTrack(const XMLNode &root)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// some static meshes are conditional
|
// some static meshes are conditional
|
||||||
std::string condition;
|
core::stringc condition;
|
||||||
n->get("if", &condition);
|
n->get("if", &condition);
|
||||||
if (condition == "splatting")
|
if (condition == "splatting")
|
||||||
{
|
{
|
||||||
if (!irr_driver->supportsSplatting()) continue;
|
if (!irr_driver->supportsSplatting()) continue;
|
||||||
}
|
}
|
||||||
|
else if (condition.find("trophies") == 0)
|
||||||
|
{
|
||||||
|
std::vector<std::string> split = StringUtils::split(std::string(condition.c_str()), ' ');
|
||||||
|
if (split.size() != 3)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[Track] WARNING: unexpected number of tokens in '%s'\n", condition.c_str());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const std::string& op = split[1];
|
||||||
|
int val = -1;
|
||||||
|
if (StringUtils::fromString(split[2], val))
|
||||||
|
{
|
||||||
|
// only 'lt' is supported atm
|
||||||
|
if (op != "lt")
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[Track] WARNING: operator '%s' not supported in '%s'\n", op.c_str(),
|
||||||
|
condition.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unlock_manager->getCurrentSlot()->getPoints() < val)
|
||||||
|
{
|
||||||
|
// show object
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// don't show object
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "[Track] WARNING: token '%s' in '%s' should have been a number\n",
|
||||||
|
split[2].c_str(), condition.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (condition.size() > 0)
|
else if (condition.size() > 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[Track] WARNING: unknown condition <%s>\n", condition.c_str());
|
fprintf(stderr, "[Track] WARNING: unknown condition <%s>\n", condition.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string neg_condition;
|
core::stringc neg_condition;
|
||||||
n->get("ifnot", &neg_condition);
|
n->get("ifnot", &neg_condition);
|
||||||
if (neg_condition == "splatting")
|
if (neg_condition == "splatting")
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user