• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ uint8_t {aka unsigned char}’ [-fpermissive]

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
I am trying to create a code in which when the player has logged in mounted, its login with mount.

C++:
uint8_t currentMountId2 = player->getCurrentMount();
    if (currentMountId2 > 0) {
        Mount* currentMount2 = g_game.mounts.getMountByID(currentMountId2);
        if (currentMount2) {
            if (!player->hasMount(currentMount2)) {
                player->setCurrentMount(currentMount2);
            }
        }
    }

but there's an error:
Code:
/home/Otserver/src/iologindata.cpp: In static member function ‘static bool IOLoginData::loadPlayer(Player*, DBResult_ptr)’:
/home/Otserver/src/iologindata.cpp:720:42: error: invalid conversion from ‘Mount*’ to ‘uint8_t {aka unsigned char}’ [-fpermissive]
     player->setCurrentMount(currentMount2);
                                          ^
In file included from /home/Otserver/src/iologindata.h:24:0,
                 from /home/Otserver/src/iologindata.cpp:24:
/home/Otserver/src/player.h:172:8: error:   initializing argument 1 of ‘void Player::setCurrentMount(uint8_t)’ [-fpermissive]
   void setCurrentMount(uint8_t mountId);
 
Last edited by a moderator:
Solution
it tells you what's wrong
setCurrentMount expects a uint8_t
you have a Mount pointer
aka that's incompatible with the function
use player->setCurrentMount(currentMountId2)
it tells you what's wrong
setCurrentMount expects a uint8_t
you have a Mount pointer
aka that's incompatible with the function
use player->setCurrentMount(currentMountId2)
 
Solution
Back
Top