Change characteristics to characteristic and add player characteristics
This commit is contained in:
parent
cb797c3145
commit
a305b357a3
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<kart-properties>
|
<characteristics>
|
||||||
|
<characteristic name="base">
|
||||||
<!-- ********** Physics ********** -->
|
<!-- ********** Physics ********** -->
|
||||||
|
|
||||||
<!-- Suspension
|
<!-- Suspension
|
||||||
@ -289,4 +290,23 @@
|
|||||||
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
||||||
add-power="3" min-speed="10" max-speed-increase="5"
|
add-power="3" min-speed="10" max-speed-increase="5"
|
||||||
duration="1" fade-out-time="2" />
|
duration="1" fade-out-time="2" />
|
||||||
</kart-properties>
|
</characteristic>
|
||||||
|
|
||||||
|
<!-- Per-player settings/handicaps (or boosts) -->
|
||||||
|
<player-characteristics>
|
||||||
|
<characteristic name="normal" />
|
||||||
|
<characteristic name="handicap">
|
||||||
|
<engine brake-factor="*0.8" brake-time-increase="*0.85" max-speed-reverse-ratio="*0.8" />
|
||||||
|
<bubblegum duration="*1.5" speed-fraction="*1.5" torque="*1.5" />
|
||||||
|
<zipper duration="*0.8" force="*0.8" speed-gain="*0.8" max-speed-increase="*0.8" />
|
||||||
|
<swatter duration="*0.8" squash-duration="*1.5" squash-slowdown="*1.8" />
|
||||||
|
<plunger band-max-length="*0.8" band-speed-increase="*0.8" in-face-time="*1.3" />
|
||||||
|
<startup time="*0.8 0.8" boost="*0.8 0.8" />
|
||||||
|
<rescue duration="*1.5" />
|
||||||
|
<explosion duration="*1.3" invulnerability-time="*0.7" />
|
||||||
|
<nitro engine-force="*0.8" consumption="*1.1" max-speed-increase="*0.9" max="*0.8" />
|
||||||
|
<slipstream length="*0.8" width="*0.8" collect-time="*1.5" use-time="*0.8"
|
||||||
|
add-power="*0.8" min-speed="*0.8" max-speed-increase="*0.9" duration="*0.8" />
|
||||||
|
</characteristic>
|
||||||
|
</player-characteristics>
|
||||||
|
</characteristics>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -36,8 +36,11 @@ class InterpolationArray;
|
|||||||
*
|
*
|
||||||
* The documentation of these properties can be found in
|
* The documentation of these properties can be found in
|
||||||
* the kart_characteristics.xml file.
|
* the kart_characteristics.xml file.
|
||||||
|
* Large parts of this file are generated by tools/create_kart_properties.py.
|
||||||
|
* Please don't change the generated code here, instead change the script,
|
||||||
|
* regenerate the code and overwrite the whole generated part with the result.
|
||||||
*/
|
*/
|
||||||
class AbstractCharacteristics
|
class AbstractCharacteristic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
union Value
|
union Value
|
||||||
@ -200,7 +203,7 @@ private:
|
|||||||
//SkiddingProperties *m_skidding;
|
//SkiddingProperties *m_skidding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AbstractCharacteristics();
|
AbstractCharacteristic();
|
||||||
|
|
||||||
virtual const SkiddingProperties* getSkiddingProperties() const;
|
virtual const SkiddingProperties* getSkiddingProperties() const;
|
||||||
|
|
@ -33,6 +33,7 @@ namespace irr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AbstractCharacteristics;
|
||||||
class AbstractKartAnimation;
|
class AbstractKartAnimation;
|
||||||
class Attachment;
|
class Attachment;
|
||||||
class btKart;
|
class btKart;
|
||||||
@ -74,6 +75,8 @@ protected:
|
|||||||
|
|
||||||
/** The per-player difficulty. */
|
/** The per-player difficulty. */
|
||||||
const PlayerDifficulty *m_difficulty;
|
const PlayerDifficulty *m_difficulty;
|
||||||
|
/** The combined properties of the kart and the player. */
|
||||||
|
const AbstractCharacteristics *m_characteristics;
|
||||||
|
|
||||||
/** This stores a copy of the kart model. It has to be a copy
|
/** This stores a copy of the kart model. It has to be a copy
|
||||||
* since otherwise incosistencies can happen if the same kart
|
* since otherwise incosistencies can happen if the same kart
|
||||||
|
@ -16,18 +16,18 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "karts/cached_characteristics.hpp"
|
#include "karts/cached_characteristic.hpp"
|
||||||
|
|
||||||
#include "utils/interpolation_array.hpp"
|
#include "utils/interpolation_array.hpp"
|
||||||
|
|
||||||
CachedCharacteristics::CachedCharacteristics(const AbstractCharacteristics *origin) :
|
CachedCharacteristic::CachedCharacteristic(const AbstractCharacteristic *origin) :
|
||||||
m_values(CHARACTERISTIC_COUNT),
|
m_values(CHARACTERISTIC_COUNT),
|
||||||
m_origin(origin)
|
m_origin(origin)
|
||||||
{
|
{
|
||||||
updateSource();
|
updateSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedCharacteristics::~CachedCharacteristics()
|
CachedCharacteristic::~CachedCharacteristic()
|
||||||
{
|
{
|
||||||
// Delete all not-null values
|
// Delete all not-null values
|
||||||
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
|
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
|
||||||
@ -52,7 +52,7 @@ CachedCharacteristics::~CachedCharacteristics()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CachedCharacteristics::updateSource()
|
void CachedCharacteristic::updateSource()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
|
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
|
||||||
{
|
{
|
||||||
@ -142,12 +142,12 @@ void CachedCharacteristics::updateSource()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkiddingProperties* CachedCharacteristics::getSkiddingProperties() const
|
const SkiddingProperties* CachedCharacteristic::getSkiddingProperties() const
|
||||||
{
|
{
|
||||||
return m_origin->getSkiddingProperties();
|
return m_origin->getSkiddingProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CachedCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
|
void CachedCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
|
||||||
{
|
{
|
||||||
void *v = m_values[type].content;
|
void *v = m_values[type].content;
|
||||||
if (v)
|
if (v)
|
@ -19,9 +19,9 @@
|
|||||||
#ifndef HEADER_CACHED_CHARACTERISTICS_HPP
|
#ifndef HEADER_CACHED_CHARACTERISTICS_HPP
|
||||||
#define HEADER_CACHED_CHARACTERISTICS_HPP
|
#define HEADER_CACHED_CHARACTERISTICS_HPP
|
||||||
|
|
||||||
#include "karts/abstract_characteristics.hpp"
|
#include "karts/abstract_characteristic.hpp"
|
||||||
|
|
||||||
class CachedCharacteristics : public AbstractCharacteristics
|
class CachedCharacteristic : public AbstractCharacteristic
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** Used to store a value. */
|
/** Used to store a value. */
|
||||||
@ -37,12 +37,12 @@ private:
|
|||||||
std::vector<SaveValue> m_values;
|
std::vector<SaveValue> m_values;
|
||||||
|
|
||||||
/** The characteristics that hold the original values. */
|
/** The characteristics that hold the original values. */
|
||||||
const AbstractCharacteristics *m_origin;
|
const AbstractCharacteristic *m_origin;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CachedCharacteristics(const AbstractCharacteristics *origin);
|
CachedCharacteristic(const AbstractCharacteristic *origin);
|
||||||
CachedCharacteristics(const CachedCharacteristics &characteristics) = delete;
|
CachedCharacteristic(const CachedCharacteristic &characteristics) = delete;
|
||||||
virtual ~CachedCharacteristics();
|
virtual ~CachedCharacteristic();
|
||||||
|
|
||||||
/** Fetches all cached values from the original source. */
|
/** Fetches all cached values from the original source. */
|
||||||
void updateSource();
|
void updateSource();
|
@ -16,16 +16,16 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "karts/combined_characteristics.hpp"
|
#include "karts/combined_characteristic.hpp"
|
||||||
|
|
||||||
void CombinedCharacteristics::addCharacteristic(const AbstractCharacteristics *characteristic)
|
void CombinedCharacteristic::addCharacteristic(const AbstractCharacteristic *characteristic)
|
||||||
{
|
{
|
||||||
m_childs.push_back(characteristic);
|
m_childs.push_back(characteristic);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkiddingProperties* CombinedCharacteristics::getSkiddingProperties() const
|
const SkiddingProperties* CombinedCharacteristic::getSkiddingProperties() const
|
||||||
{
|
{
|
||||||
for (const AbstractCharacteristics *characteristic : m_childs)
|
for (const AbstractCharacteristic *characteristic : m_childs)
|
||||||
{
|
{
|
||||||
const SkiddingProperties *skid = characteristic->getSkiddingProperties();
|
const SkiddingProperties *skid = characteristic->getSkiddingProperties();
|
||||||
if (skid)
|
if (skid)
|
||||||
@ -34,9 +34,9 @@ const SkiddingProperties* CombinedCharacteristics::getSkiddingProperties() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CombinedCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
|
void CombinedCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
|
||||||
{
|
{
|
||||||
for (const AbstractCharacteristics *characteristic : m_childs)
|
for (const AbstractCharacteristic *characteristic : m_childs)
|
||||||
characteristic->process(type, value, is_set);
|
characteristic->process(type, value, is_set);
|
||||||
}
|
}
|
||||||
|
|
@ -19,15 +19,15 @@
|
|||||||
#ifndef HEADER_COMBINDED_CHARACTERISTICS_HPP
|
#ifndef HEADER_COMBINDED_CHARACTERISTICS_HPP
|
||||||
#define HEADER_COMBINDED_CHARACTERISTICS_HPP
|
#define HEADER_COMBINDED_CHARACTERISTICS_HPP
|
||||||
|
|
||||||
#include "karts/abstract_characteristics.hpp"
|
#include "karts/abstract_characteristic.hpp"
|
||||||
|
|
||||||
class CombinedCharacteristics : public AbstractCharacteristics
|
class CombinedCharacteristic : public AbstractCharacteristic
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
std::vector<const AbstractCharacteristics*> m_childs;
|
std::vector<const AbstractCharacteristic*> m_childs;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void addCharacteristic(const AbstractCharacteristics *characteristic);
|
void addCharacteristic(const AbstractCharacteristic *characteristic);
|
||||||
|
|
||||||
virtual const SkiddingProperties* getSkiddingProperties() const;
|
virtual const SkiddingProperties* getSkiddingProperties() const;
|
||||||
virtual void process(CharacteristicType type, Value value, bool *is_set) const;
|
virtual void process(CharacteristicType type, Value value, bool *is_set) const;
|
@ -27,6 +27,7 @@
|
|||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "guiengine/engine.hpp"
|
#include "guiengine/engine.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
|
#include "karts/abstract_characteristic.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
|
@ -22,12 +22,14 @@
|
|||||||
|
|
||||||
#include "utils/ptr_vector.hpp"
|
#include "utils/ptr_vector.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "network/remote_kart_info.hpp"
|
#include "network/remote_kart_info.hpp"
|
||||||
#include "utils/no_copy.hpp"
|
#include "utils/no_copy.hpp"
|
||||||
|
|
||||||
#define ALL_KART_GROUPS_ID "all"
|
#define ALL_KART_GROUPS_ID "all"
|
||||||
|
|
||||||
|
class AbstractCharacteristic;
|
||||||
class KartProperties;
|
class KartProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,6 +60,11 @@ private:
|
|||||||
* all clients or not. */
|
* all clients or not. */
|
||||||
std::vector<bool> m_kart_available;
|
std::vector<bool> m_kart_available;
|
||||||
|
|
||||||
|
std::unique_ptr<AbstractCharacteristic> m_base_characteristic;
|
||||||
|
std::vector<std::unique_ptr<AbstractCharacteristic> > m_kart_type_characteristics;
|
||||||
|
std::vector<std::unique_ptr<AbstractCharacteristic> > m_kart_characteristics;
|
||||||
|
std::vector<std::unique_ptr<AbstractCharacteristic> > m_player_characteristics;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
typedef PtrVector<KartProperties> KartPropertiesVector;
|
typedef PtrVector<KartProperties> KartPropertiesVector;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "io/xml_node.hpp"
|
#include "io/xml_node.hpp"
|
||||||
|
|
||||||
XmlCharacteristics::XmlCharacteristics(const XMLNode *node) :
|
XmlCharacteristic::XmlCharacteristic(const XMLNode *node) :
|
||||||
m_values(CHARACTERISTIC_COUNT),
|
m_values(CHARACTERISTIC_COUNT),
|
||||||
m_skidding(nullptr)
|
m_skidding(nullptr)
|
||||||
{
|
{
|
||||||
@ -32,12 +32,12 @@ XmlCharacteristics::XmlCharacteristics(const XMLNode *node) :
|
|||||||
load(node);
|
load(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkiddingProperties* XmlCharacteristics::getSkiddingProperties() const
|
const SkiddingProperties* XmlCharacteristic::getSkiddingProperties() const
|
||||||
{
|
{
|
||||||
return m_skidding;
|
return m_skidding;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
|
void XmlCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
|
||||||
{
|
{
|
||||||
switch (getType(type))
|
switch (getType(type))
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
{
|
{
|
||||||
if (processors.size() != value.fv->size())
|
if (processors.size() != value.fv->size())
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"FloatVectors have different sizes for %s",
|
"FloatVectors have different sizes for %s",
|
||||||
getName(type).c_str());
|
getName(type).c_str());
|
||||||
break;
|
break;
|
||||||
@ -74,7 +74,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
|
|
||||||
if (!*is_set)
|
if (!*is_set)
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::process", "Can't process %s",
|
Log::error("XmlCharacteristic::process", "Can't process %s",
|
||||||
getName(type).c_str());
|
getName(type).c_str());
|
||||||
value.fv->clear();
|
value.fv->clear();
|
||||||
break;
|
break;
|
||||||
@ -91,7 +91,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
{
|
{
|
||||||
if (processors.size() != value.fv->size())
|
if (processors.size() != value.fv->size())
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"InterpolationArrays have different sizes for %s",
|
"InterpolationArrays have different sizes for %s",
|
||||||
getName(type).c_str());
|
getName(type).c_str());
|
||||||
break;
|
break;
|
||||||
@ -103,13 +103,13 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
{
|
{
|
||||||
std::vector<std::string> pair = StringUtils::split(*it, ':');
|
std::vector<std::string> pair = StringUtils::split(*it, ':');
|
||||||
if (pair.size() != 2)
|
if (pair.size() != 2)
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"Can't process %s: Wrong format", getName(type).c_str());
|
"Can't process %s: Wrong format", getName(type).c_str());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
if (!StringUtils::fromString(pair[0], x))
|
if (!StringUtils::fromString(pair[0], x))
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"Can't process %s: Not a float", getName(type).c_str());
|
"Can't process %s: Not a float", getName(type).c_str());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"Can't find the %f in %s", x,
|
"Can't find the %f in %s", x,
|
||||||
getName(type).c_str());
|
getName(type).c_str());
|
||||||
}
|
}
|
||||||
@ -141,13 +141,13 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
{
|
{
|
||||||
std::vector<std::string> pair = StringUtils::split(*it,':');
|
std::vector<std::string> pair = StringUtils::split(*it,':');
|
||||||
if (pair.size() != 2)
|
if (pair.size() != 2)
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"Can't process %s: Wrong format", getName(type).c_str());
|
"Can't process %s: Wrong format", getName(type).c_str());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
if (!StringUtils::fromString(pair[0], x))
|
if (!StringUtils::fromString(pair[0], x))
|
||||||
Log::error("XmlCharacteristics::process",
|
Log::error("XmlCharacteristic::process",
|
||||||
"Can't process %s: Not a float", getName(type).c_str());
|
"Can't process %s: Not a float", getName(type).c_str());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
processFloat(pair[1], &val, is_set);
|
processFloat(pair[1], &val, is_set);
|
||||||
if (!*is_set)
|
if (!*is_set)
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::process", "Can't process %s",
|
Log::error("XmlCharacteristic::process", "Can't process %s",
|
||||||
getName(type).c_str());
|
getName(type).c_str());
|
||||||
value.ia->clear();
|
value.ia->clear();
|
||||||
break;
|
break;
|
||||||
@ -171,7 +171,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlCharacteristics::processFloat(const std::string &processor, float *value, bool *is_set)
|
void XmlCharacteristic::processFloat(const std::string &processor, float *value, bool *is_set)
|
||||||
{
|
{
|
||||||
// Split the string by operators
|
// Split the string by operators
|
||||||
static const std::string operators = "*/+-";
|
static const std::string operators = "*/+-";
|
||||||
@ -189,7 +189,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
|
|||||||
|
|
||||||
if (parts.empty())
|
if (parts.empty())
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::processFloat", "no content to process");
|
Log::error("XmlCharacteristic::processFloat", "no content to process");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
|
|||||||
{
|
{
|
||||||
if (!*is_set)
|
if (!*is_set)
|
||||||
{
|
{
|
||||||
Log::error("XmlCharacteristics::processFloat", "x is unknown");
|
Log::error("XmlCharacteristic::processFloat", "x is unknown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -217,7 +217,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
|
|||||||
val = x;
|
val = x;
|
||||||
else if (!StringUtils::fromString(parts[index], val))
|
else if (!StringUtils::fromString(parts[index], val))
|
||||||
{
|
{
|
||||||
Log::fatal("XmlCharacteristics::processFloat",
|
Log::fatal("XmlCharacteristic::processFloat",
|
||||||
"Can't process %s: Not a float", parts[index].c_str());
|
"Can't process %s: Not a float", parts[index].c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -230,13 +230,13 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
|
|||||||
else if (operations[index - 1] == "-")
|
else if (operations[index - 1] == "-")
|
||||||
*value -= val;
|
*value -= val;
|
||||||
else
|
else
|
||||||
Log::fatal("XmlCharacteristics::processFloat",
|
Log::fatal("XmlCharacteristic::processFloat",
|
||||||
"Unknown operator (%s)", operations[index - 1].c_str());
|
"Unknown operator (%s)", operations[index - 1].c_str());
|
||||||
}
|
}
|
||||||
*is_set = true;
|
*is_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmlCharacteristics::load(const XMLNode *node)
|
void XmlCharacteristic::load(const XMLNode *node)
|
||||||
{
|
{
|
||||||
// Script-generated content
|
// Script-generated content
|
||||||
if (const XMLNode *sub_node = node->getNode("Suspension"))
|
if (const XMLNode *sub_node = node->getNode("Suspension"))
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
#ifndef HEADER_XML_CHARACTERISTICS_HPP
|
#ifndef HEADER_XML_CHARACTERISTICS_HPP
|
||||||
#define HEADER_XML_CHARACTERISTICS_HPP
|
#define HEADER_XML_CHARACTERISTICS_HPP
|
||||||
|
|
||||||
#include "karts/abstract_characteristics.hpp"
|
#include "karts/abstract_characteristic.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
|
||||||
class XmlCharacteristics : public AbstractCharacteristics
|
class XmlCharacteristic : public AbstractCharacteristic
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** The computation that was read from an xml file */
|
/** The computation that was read from an xml file */
|
||||||
@ -33,7 +33,7 @@ private:
|
|||||||
SkiddingProperties *m_skidding;
|
SkiddingProperties *m_skidding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
XmlCharacteristics(const XMLNode *node = nullptr);
|
XmlCharacteristic(const XMLNode *node = nullptr);
|
||||||
|
|
||||||
virtual const SkiddingProperties* getSkiddingProperties() const;
|
virtual const SkiddingProperties* getSkiddingProperties() const;
|
||||||
virtual void process(CharacteristicType type, Value value, bool *is_set) const;
|
virtual void process(CharacteristicType type, Value value, bool *is_set) const;
|
||||||
|
@ -172,13 +172,13 @@ def main():
|
|||||||
typeC = m.typeC
|
typeC = m.typeC
|
||||||
result = "result"
|
result = "result"
|
||||||
|
|
||||||
print("""{3} AbstractCharacteristics::get{1}() const
|
print("""{3} AbstractCharacteristic::get{1}() const
|
||||||
{{
|
{{
|
||||||
{0} result;
|
{0} result;
|
||||||
bool is_set = false;
|
bool is_set = false;
|
||||||
process({2}, &result, &is_set);
|
process({2}, &result, &is_set);
|
||||||
if (!is_set)
|
if (!is_set)
|
||||||
Log::fatal("AbstractCharacteristics", "Can't get characteristic %s", getName({2}).c_str());
|
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName({2}).c_str());
|
||||||
return {4};
|
return {4};
|
||||||
}}
|
}}
|
||||||
""".format(m.typeC, nameTitle, nameUnderscore.upper(), typeC, result))
|
""".format(m.typeC, nameTitle, nameUnderscore.upper(), typeC, result))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user