Add adjustable AI handicap in stk_config.xml
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10066 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
574fdac270
commit
5af9ce44b1
@ -25,6 +25,9 @@
|
||||
<points from="5" points="1"/>
|
||||
</grand-prix>
|
||||
|
||||
<!-- A value between 0 and 1, change this to handicap AIs -->
|
||||
<ai acceleration="1.0" />
|
||||
|
||||
<!-- Time in follow-the-leader after which karts are removed.
|
||||
The last values applies for all remaining karts.
|
||||
time-per-kart Additional time added to the interval
|
||||
|
@ -160,6 +160,8 @@ void STKConfig::init_defaults()
|
||||
m_enable_networking = true;
|
||||
m_smooth_normals = false;
|
||||
m_same_powerup_mode = POWERUP_MODE_ONLY_IF_SAME;
|
||||
m_ai_acceleration = 1.0f;
|
||||
|
||||
m_score_increase.clear();
|
||||
m_leader_intervals.clear();
|
||||
m_switch_items.clear();
|
||||
@ -227,7 +229,7 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
{
|
||||
physics_node->get("smooth-normals", &m_smooth_normals );
|
||||
}
|
||||
|
||||
|
||||
if (const XMLNode *startup_node= root->getNode("startup"))
|
||||
{
|
||||
startup_node->get("penalty", &m_penalty_time );
|
||||
@ -324,6 +326,11 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
explosion_node->get("impulse-objects", &m_explosion_impulse_objects);
|
||||
}
|
||||
|
||||
if(const XMLNode *ai_node = root->getNode("ai"))
|
||||
{
|
||||
ai_node->get("acceleration", &m_ai_acceleration);
|
||||
}
|
||||
|
||||
if(const XMLNode *networking_node= root->getNode("networking"))
|
||||
networking_node->get("enable", &m_enable_networking);
|
||||
|
||||
|
@ -101,6 +101,9 @@ public:
|
||||
before it is ignored. */
|
||||
bool m_enable_networking;
|
||||
|
||||
float m_ai_acceleration; /**<Between 0 and 1, default being 1, can be
|
||||
used to give a handicap to AIs */
|
||||
|
||||
std::vector<float>
|
||||
m_leader_intervals; /**<Interval in follow the leader till
|
||||
last kart is reomved. */
|
||||
|
@ -689,7 +689,7 @@ void DefaultAIController::handleAcceleration( const float dt)
|
||||
}
|
||||
}
|
||||
|
||||
m_controls->m_accel = 1.0f;
|
||||
m_controls->m_accel = stk_config->m_ai_acceleration;
|
||||
} // handleAcceleration
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -546,7 +546,7 @@ void NewAIController::handleAcceleration( const float DELTA )
|
||||
}
|
||||
}
|
||||
|
||||
m_controls->m_accel = 1.0f;
|
||||
m_controls->m_accel = stk_config->m_ai_acceleration;
|
||||
} // handleAcceleration
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user