Fixed documentation and usage of ATTACHMENT_NOLOKS_SWATTER (which is

never an actual attachment value, even nolok has 'ATTACHMENT_SWATTER'
set).
This commit is contained in:
hiker 2016-08-08 17:57:15 +10:00
parent f341cd1440
commit 5da96cf9d0
5 changed files with 20 additions and 16 deletions

View File

@ -106,7 +106,7 @@ void Attachment::set(AttachmentType type, float time,
{
bool was_bomb = (m_type == ATTACH_BOMB);
scene::ISceneNode* bomb_scene_node = NULL;
if (was_bomb && type == ATTACH_SWATTER) //What about ATTACH_NOLOKS_SWATTER ??
if (was_bomb && type == ATTACH_SWATTER)
{
// let's keep the bomb node, and create a new one for
// the new attachment
@ -495,9 +495,13 @@ void Attachment::update(float dt)
case ATTACH_MAX:
break;
case ATTACH_SWATTER:
case ATTACH_NOLOKS_SWATTER:
// Everything is done in the plugin.
break;
case ATTACH_NOLOKS_SWATTER:
// Should never be called, this symbols is only used as an index for
// the model, Nolok's attachment type is ATTACH_SWATTER
assert(false);
break;
case ATTACH_BOMB:
if (m_bomb_sound) m_bomb_sound->setPosition(m_kart->getXYZ());

View File

@ -58,6 +58,8 @@ public:
ATTACH_BOMB,
ATTACH_ANVIL,
ATTACH_SWATTER,
// Note that the next symbol is only used as an index into the mesh
// array; it will NEVER be actually assigned as an attachment type
ATTACH_NOLOKS_SWATTER,
ATTACH_TINYTUX,
ATTACH_BUBBLEGUM_SHIELD,

View File

@ -528,21 +528,21 @@ void ArenaAI::handleArenaItems(const float dt)
{
Attachment::AttachmentType type = m_kart->getAttachment()->getType();
// Don't use shield when we have a swatter.
if (type == Attachment::ATTACH_SWATTER ||
type == Attachment::ATTACH_NOLOKS_SWATTER)
if (type == Attachment::ATTACH_SWATTER)
break;
// Check if a flyable (cake, ...) is close or a kart nearby
// has a swatter attachment. If so, use bubblegum
// as shield
if ((!m_kart->isShielded() &&
projectile_manager->projectileIsClose(m_kart,
m_ai_properties->m_shield_incoming_radius)) ||
(m_closest_kart_pos_data.distance < 15.0f &&
((m_closest_kart->getAttachment()->
getType() == Attachment::ATTACH_SWATTER) ||
(m_closest_kart->getAttachment()->
getType() == Attachment::ATTACH_NOLOKS_SWATTER))))
if ( (!m_kart->isShielded() &&
projectile_manager->projectileIsClose(m_kart,
m_ai_properties->m_shield_incoming_radius)
) ||
(m_closest_kart_pos_data.distance < 15.0f &&
m_closest_kart->getAttachment()->getType() ==
Attachment::ATTACH_SWATTER
)
)
{
m_controls->m_fire = true;
m_controls->m_look_back = false;

View File

@ -1193,8 +1193,7 @@ void SkiddingAI::handleItems(const float dt)
{
Attachment::AttachmentType type = m_kart->getAttachment()->getType();
// Don't use shield when we have a swatter.
if( type == Attachment::ATTACH_SWATTER ||
type == Attachment::ATTACH_NOLOKS_SWATTER )
if( type == Attachment::ATTACH_SWATTER)
break;
// Check if a flyable (cake, ...) is close. If so, use bubblegum

View File

@ -1199,8 +1199,7 @@ void SkiddingAI::handleItems(const float dt)
{
Attachment::AttachmentType type = m_kart->getAttachment()->getType();
// Don't use shield when we have a swatter.
if( type == Attachment::ATTACH_SWATTER ||
type == Attachment::ATTACH_NOLOKS_SWATTER )
if( type == Attachment::ATTACH_SWATTER)
break;
// Check if a flyable (cake, ...) is close. If so, use bubblegum