• 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!

TFS 1.X+ fix + 9 stack pos error in compilation

ForgottenNot

Member
Joined
Feb 10, 2023
Messages
192
Reaction score
19
[
Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
Error (activo) E0167 un argumento de tipo "bool" no es compatible con un parámetro de tipo "MagicEffectClasses" theforgottenserver C:\Users\pasturryx\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp 2747

Gravedad Código Descripción Proyecto Archivo Línea Estado suprimido
Error C2664 'void ProtocolGame::sendAddCreature(const Creature *,const Position &,int32_t,MagicEffectClasses)': el argumento 4 no puede convertirse de 'bool' a 'MagicEffectClasses' theforgottenserver C:\Users\pasturryx\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp 2747

Lua:
1>------ Operación Compilar iniciada: Proyecto: theforgottenserver, configuración: Release x64 ------
1>protocolgame.cpp
1>C:\Users\felip\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp(2747,4): error C2664: 'void ProtocolGame::sendAddCreature(const Creature *,const Position &,int32_t,MagicEffectClasses)': el argumento 4 no puede convertirse de 'bool' a 'MagicEffectClasses'
1>C:\Users\felip\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp(2747,51): message : La conversión a tipo de enumeración requiere una conversión explícita (static_cast, conversión de estilo de C o conversión de estilo de función entre paréntesis)
1>C:\Users\felip\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp(2585,20): message : vea la declaración de 'ProtocolGame::sendAddCreature'
1>C:\Users\felip\OneDrive\Documentos\GitHub\pro-ot\src\protocolgame.cpp(2747,4): message : al hacer coincidir la lista de argumentos '(const Creature *, const Position, int32_t, bool)'
1>Compilación del proyecto "theforgottenserver.vcxproj" terminada -- ERROR.
i changed magiceffect clases for teleport but im still gettin errors while compiling, please help
Code:
void ProtocolGame::sendMoveCreature(const Creature* creature, const Position& newPos, int32_t newStackPos, const Position& oldPos, int32_t oldStackPos, bool teleport)
{
    if (creature == player) {

        if (teleport || oldStackPos >= MAX_STACKPOS_THINGS) {

            sendRemoveTileThing(oldPos, oldStackPos);
            sendMapDescription(newPos);
        } else {
            NetworkMessage msg;
            if (oldPos.z == 7 && newPos.z >= 8) {
                RemoveTileThing(msg, oldPos, oldStackPos);
            } else {
                msg.addByte(0x6D);
                msg.addPosition(oldPos);
                msg.addByte(static_cast<uint8_t>(oldStackPos));
                msg.addPosition(newPos);
            }

            if (newPos.z > oldPos.z) {
                MoveDownCreature(msg, creature, newPos, oldPos);
            } else if (newPos.z < oldPos.z) {
                MoveUpCreature(msg, creature, newPos, oldPos);
            }

            if (newStackPos >= MAX_STACKPOS_THINGS) {
                msg.addByte(0x64);
                msg.addPosition(player->getPosition());
                GetMapDescription(newPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z,
                    (Map::maxClientViewportX * 2) + 2, (Map::maxClientViewportY * 2) + 2, msg);


            }
            else {
                if (oldPos.y > newPos.y) { // north, for old x
                    msg.addByte(0x65);
                    GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z,
                        (Map::maxClientViewportX * 2) + 2, 1, msg);
                }
                else if (oldPos.y < newPos.y) { // south, for old x
                    msg.addByte(0x67);
                    GetMapDescription(oldPos.x - Map::maxClientViewportX, newPos.y + (Map::maxClientViewportY + 1),
                        newPos.z, (Map::maxClientViewportX * 2) + 2, 1, msg);
                }


                if (oldPos.x < newPos.x) { // east, [with new y]
                    msg.addByte(0x66);
                    GetMapDescription(newPos.x + (Map::maxClientViewportX + 1), newPos.y - Map::maxClientViewportY,
                        newPos.z, 1, (Map::maxClientViewportY * 2) + 2, msg);
                }
                else if (oldPos.x > newPos.x) { // west, [with new y]
                    msg.addByte(0x68);
                    GetMapDescription(newPos.x - Map::maxClientViewportX, newPos.y - Map::maxClientViewportY, newPos.z,
                        1, (Map::maxClientViewportY * 2) + 2, msg);
                }
            }
        } if (canSee(oldPos) && canSee(creature->getPosition())) {
        if (teleport || (oldPos.z == 7 && newPos.z >= 8) || oldStackPos >= MAX_STACKPOS_THINGS) {
            sendRemoveTileThing(oldPos, oldStackPos);
            sendAddCreature(creature, newPos, newStackPos);
        }
    }
    else if (canSee(oldPos) && canSee(creature->getPosition())) {
        if (!player->canSeeCreature(creature))
            return;
        if (teleport || (oldPos.z == 7 && newPos.z >= 8) || oldStackPos >= MAX_STACKPOS_THINGS) {
            sendRemoveTileThing(oldPos, oldStackPos);

            sendAddCreature(creature, newPos, newStackPos, false);
        }
        else {
            NetworkMessage msg;
            msg.addByte(0x6D);
            msg.addPosition(oldPos);
            msg.addByte(static_cast<uint8_t>(oldStackPos));
            msg.addPosition(creature->getPosition());
            writeToOutputBuffer(msg);
        }
    } else if (canSee(oldPos)) {
        sendRemoveTileThing(oldPos, oldStackPos);
    } else if (canSee(creature->getPosition())) {
        sendAddCreature(creature, newPos, newStackPos);
    }
}
 
Back
Top