Remove outdated FIXMES + fix possible crash if section is missing in XML file

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7316 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-01-06 21:11:32 +00:00
parent 37b057a60e
commit 279e551371
2 changed files with 32 additions and 18 deletions

View File

@ -66,8 +66,6 @@ ParticleEmitter::ParticleEmitter(ParticleKind* type, core::vector3df position,
{
case EMITTER_POINT:
{
// FIXME: does the maxAngle param work at all??
// FIXME: the min and max color params don't appear to work
m_emitter = m_node->createPointEmitter(core::vector3df(m_particle_type->getVelocityX(),
m_particle_type->getVelocityY(),
m_particle_type->getVelocityZ()), // velocity in m/ms
@ -81,8 +79,6 @@ ParticleEmitter::ParticleEmitter(ParticleKind* type, core::vector3df position,
case EMITTER_BOX:
{
// FIXME: does the maxAngle param work at all??
// FIXME: the min and max color params don't appear to work
const float box_size_x = type->getBoxSizeX()/2.0f;
const float box_size_y = type->getBoxSizeY()/2.0f;
const float box_size_z = type->getBoxSizeZ()/2.0f;

View File

@ -62,7 +62,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
if (xml->getName() != "particles")
{
delete xml;
throw std::runtime_error("[ParticleKind] No <particles> main node in smoke.xml");
throw std::runtime_error("[ParticleKind] No <particles> main node in " + file);
}
// ------------------------------------------------------------------------
@ -105,6 +105,12 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
// ------------------------------------------------------------------------
const XMLNode* material = xml->getNode("material");
if (material == NULL)
{
delete xml;
throw std::runtime_error("[ParticleKind] No <material> node in " + file);
}
std::string materialFile;
material->get("file", &materialFile);
@ -123,8 +129,11 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
// ------------------------------------------------------------------------
const XMLNode* rate = xml->getNode("rate");
if (rate != NULL)
{
rate->get("min", &m_min_rate);
rate->get("max", &m_max_rate);
}
//std::cout << "m_min_rate = " << m_min_rate << "\n";
//std::cout << "m_max_rate = " << m_max_rate << "\n";
@ -132,8 +141,11 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
// ------------------------------------------------------------------------
const XMLNode* lifetime = xml->getNode("lifetime");
if (lifetime != NULL)
{
lifetime->get("min", &m_lifetime_min);
lifetime->get("max", &m_lifetime_max);
}
//std::cout << "m_lifetime_min = " << m_lifetime_min << "\n";
//std::cout << "m_lifetime_max = " << m_lifetime_max << "\n";
@ -141,9 +153,11 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
// ------------------------------------------------------------------------
const XMLNode* size = xml->getNode("size");
//size->get("default", &m_particle_size);
if (size != NULL)
{
size->get("min", &m_min_size);
size->get("max", &m_max_size);
}
//std::cout << "m_particle_size = " << m_particle_size << "\n";
//std::cout << "m_min_size = " << m_min_size << "\n";
@ -152,15 +166,19 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
// ------------------------------------------------------------------------
const XMLNode* color = xml->getNode("color");
video::SColor minColor;
video::SColor maxColor;
if (color != NULL)
{
color->get("min", &m_min_start_color);
color->get("max", &m_max_start_color);
}
// ------------------------------------------------------------------------
const XMLNode* fadeout = xml->getNode("fadeout");
if (fadeout != NULL)
{
fadeout->get("time", &m_fadeout_time);
}
//std::cout << "m_fadeout_time = " << m_fadeout_time << "\n";