Jump to content
  • Realm flag 40 for a classic realm throws a red warning


    madmax
    • Status: Completed
      Main Category: Core / Mangos Daemon
      Sub-Category: realmlisthandling
      Version: 0.21 Milestone: 20 Priority: unknown
      Implemented Version: 0.20

    Realm flag 40 for a classic realm throws a red warning

    Setting a classic realm flag to 40 throws a red warning message. It still does its intended function of setting the realmlist to show "Recommended" but generates lots of red warnings.

    See screenshot attached.


    User Feedback

    Recommended Comments

    [quote=H0zen]I hope you are talking about the flag 0x40, which is 64 in decimal :)[/quote]

    Oh really? We should really make these things give an error that tells you what to use instead of 0x40 which i have no idea lol.

    Link to comment
    Share on other sites

    I would suggest to implement JaNGOS Database structure for the realmlist table. In JaNGOS, you set 0 or 1 to flags instead of an integer which is then interpreted as an hexadecimal value for the game.

    Several other fields have exactly the same issue in the MaNGOS database: playerBytes, item_data, ...

    According to myself (and maybe others), it is actually a stupid idea to store an integer which has several flag meaning into the database (Especially whenever you can combine them).

    Database:

    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID of the realm.',
    `name` varchar(32) NOT NULL DEFAULT '' COMMENT 'Name of the realm.',
    `address` varchar(32) NOT NULL DEFAULT '127.0.0.1' COMMENT 'Address of the realm, may be a name of an ip.',
    `port` int(11) NOT NULL DEFAULT '8085' COMMENT 'Listen port of the realm.',
    `fk_realmtype` int(11) NOT NULL COMMENT 'Foreign key to the Realm Type.',
    `fk_timezone` int(11) NOT NULL COMMENT 'Foreign key to the timezone.',
    `population` float NOT NULL DEFAULT '0' COMMENT 'Population calculated from (playerCount / maxPlayerCount * 2)',
    `maxPlayers` int(11) NOT NULL DEFAULT '1000' COMMENT 'The maximum number of players allowed on this realm.',
    `countPlayers` int(11) NOT NULL DEFAULT '0' COMMENT 'The number of players actually created on this realm.',
    [COLOR="#FF0000"][B] `invalid` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Means that this realm is invalid and must not be shown to the client.',
    `offline` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Means that this realm is offline.',
    `showversion` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Means that the version of this realm must be shown to the client.',
    `newplayers` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Means that only the new players may join this realm.',
    `recommended` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Display the recommended option in the client.',[/B][/COLOR]
    PRIMARY KEY (`id`),
    KEY `fk_realm_type_idx` (`fk_realmtype`),
    KEY `fk_realm_timezone_idx` (`fk_timezone`),
    CONSTRAINT `fk_realm_timezone` FOREIGN KEY (`fk_timezone`) REFERENCES `realmtimezone` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    CONSTRAINT `fk_realm_type` FOREIGN KEY (`fk_realmtype`) REFERENCES `realmtype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION


    Software code:
    /**
    * This method is converting the realm flags into a single integer.
    * @param r The realm for which the flags needs to be converted.
    * @return The integer value corresponding to the flags.
    */
    private int convertFlagsToInt(Realm r) {
    int flags = 0;
    flags+=(r.isInvalid() ? 1 : 0);
    flags+=(r.isOffline() ? 2 : 0);
    flags+=(r.isShowversion() ? 4 : 0);
    // flags+=(0*8); // Unknown flag
    // flags+=(0*16); // Unknown flag
    flags+=(r.isNewplayers() ? 32 : 0);
    flags+=(r.isRecommended() ? 64 : 0);
    // flags+=(0*128); // unknown flag

    return flags;
    }

    Link to comment
    Share on other sites

    [quote=madmax]Oh really? We should really make these things give an error that tells you what to use instead of 0x40 which i have no idea lol.[/quote]

    By the way, 0x40 is 64 (recommended, green).

    While 40 is the combination of 32 + 8 (New players + Unknown flag) but I think that new players flag is a blue recommended.

    And I would not say that the core needs to tell you to put something it doesn't know... however, you could read the documentation : [url]https://getmangos.eu/wiki/Reference%20Information/DB/realm/realmlist.md#realmflags[/url]

    ;-)

    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use