• 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 Luavarient errors after adding .clang-format

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,394
Solutions
68
Reaction score
1,065
Kind of shot myself in the foot. I have upgraded tfs 1.4/1098 to current tfs sources as much as possible. I just added the "new" .clang-format file and it broke my luavariant.h file somehow or at least thats what it seems to be. Does anyone have an idea what it could be?

C++:
#ifndef FS_LUAVARIANT_H
#define FS_LUAVARIANT_H

enum LuaVariantType_t
{
    VARIANT_NUMBER = 0,
    VARIANT_POSITION = 1,
    VARIANT_TARGETPOSITION = 2,
    VARIANT_STRING = 3,

    VARIANT_NONE = std::variant_npos,
};

class LuaVariant
{
public:
    uint32_t getNumber() const { return std::get<VARIANT_NUMBER>(variant); }
    const Position& getPosition() const { return std::get<VARIANT_POSITION>(variant); }
    const Position& getTargetPosition() const { return std::get<VARIANT_TARGETPOSITION>(variant); }
    const std::string& getString() const { return std::get<VARIANT_STRING>(variant); }

    bool isNumber() const { return variant.index() == VARIANT_NUMBER; }
    bool isPosition() const { return variant.index() == VARIANT_POSITION; }
    bool isTargetPosition() const { return variant.index() == VARIANT_TARGETPOSITION; }
    bool isString() const { return variant.index() == VARIANT_STRING; }

    void setNumber(uint32_t value) { variant.emplace<VARIANT_NUMBER>(value); }
    void setPosition(const Position& value) { variant.emplace<VARIANT_POSITION>(value); }
    void setTargetPosition(const Position& value) { variant.emplace<VARIANT_TARGETPOSITION>(value); }
    void setString(const std::string& value) { variant.emplace<VARIANT_STRING>(value); }

    auto type() const { return static_cast<LuaVariantType_t>(variant.index()); }

private:
    std::variant<uint32_t, Position, Position, std::string> variant;
};

#endif // FS_LUAVARIANT_H

Just countless errors all like this:
1726585261314.webp
Post automatically merged:

Nvm I was missing #include position.h
I have no idea why that happened...
 
Back
Top