Skip to content

Commit

Permalink
Unit/AI: Making Nayd happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Treeston committed Feb 28, 2016
1 parent bfac62c commit 59d0232
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.cpp
Expand Up @@ -1243,7 +1243,7 @@ void Player::Update(uint32 p_time)
{
UpdateCharmAI();
NeedChangeAI = false;
IsAIEnabled = !!GetAI();

This comment has been minimized.

Copy link
@P-Kito

P-Kito Feb 29, 2016

Contributor

Lol, didnt know that would work

This comment has been minimized.

Copy link
@Treeston

Treeston Feb 29, 2016

Author Member

!!GetAI() is equivalent to !(!GetAI())

This comment has been minimized.

Copy link
@Keader

Keader Feb 29, 2016

Member

i cant see how this works
because " ! " is negation right?
Negate something 2 times does not return to original state/value?
(I'm not saying it's right or wrong, just want to understand the concept of it xD)

This comment has been minimized.

Copy link
@Treeston

Treeston Mar 1, 2016

Author Member

Not if the original value isn't a boolean. For pointer types, it's a fancy way of saying (bool)ptr, e.g. ptr != nullptr.

For arbitrary classes, all bets are off, of course - you can override the ! operator, and there's no requirement for it to align with the way the class casts to bool.

IsAIEnabled = (GetAI() != nullptr);
}

// Update items that have just a limited lifetime
Expand Down

0 comments on commit 59d0232

Please sign in to comment.