• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling Error with getPosition() in C++

whiteblXK

Active Member
Joined
Apr 20, 2011
Messages
315
Solutions
9
Reaction score
32
Location
Poland
Hi, In void Player::sendCritical() const I add one line:
Code:
g_game.addMagicEffect(getPosition(), MAGIC_EFFECT_CRITICAL);
Which have to show magic effect 64x64, when I change
Code:
getPosition()
to
Code:
getPosition().x+1
I have this errors:
Code:
player.cpp:5182: error: no matching function for call to 'Game::addMagicEffect(int, MagicEffect_t)'
game.h:607: note: candidates are: void Game::addMagicEffect(const Position&, uint8_t, bool)
game.h:608: note:  void Game::addMagicEffect(const SpectatorVec&, const Position&, uint8_t, bool)

How to change magic effect position in g_game.addMagicEffect?
 
This statement:
Code:
getPosition().x+1
Returns an integer type rvalue. You need to create a local variable to store the Position object, then modify its properties and then call the addMagicEffect(...) function.
 
Back
Top