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

warning C4018: '<=': signed/unsigned mismatch

chucky91

Veteran OT User
Joined
Apr 8, 2010
Messages
433
Solutions
14
Reaction score
251
Location
MS - Brazil
GitHub
RCP91
I have this problem when compiling, despite compiling but the character does not save in the database when relogin.
I had a problem with player.cpp but i solved it now, i just need this one and i haven't found a solution.
Does anyone have any idea what it is? or is a library missing?

1644529138154.png

src\combat.cpp(1036,25): warning C4018: '<=': signed/unsigned mismatch

C++:
int32_t distance = std::max<uint32_t>(Position::getDistanceX(attackerPos, targetPos), Position::getDistanceY(attackerPos, targetPos));
        if (distance <= 1) {
            distance = 5;
        }

        distance *= 15;

        bool hit = false;

        if (rand() % distance <= skillValue) {                       //<----------
            hit = rand() % 100 <= hitChance;
        }

        if (Player* player = attacker->getPlayer()) {
            if (player->getAddAttackSkill()) {
                switch (player->getLastAttackBlockType()) {
                    case BLOCK_NONE: {
                        player->addSkillAdvance(SKILL_DISTANCE, 2);
                        break;
                    }

                    case BLOCK_DEFENSE:
                    case BLOCK_ARMOR: {
                        player->addSkillAdvance(SKILL_DISTANCE, 1);
                        break;
                    }

                    default: break;
                }
            }
        }



src\combat.cpp(1242,72): warning C4018: '<': signed/unsigned mismatch
C++:
bool Combat::canUseWeapon(Player* player, Item* weapon)
{
    if (player->hasFlag(PlayerFlag_IgnoreWeaponCheck)) {
        return true;
    }

    if (player->getLevel() < weapon->getMinimumLevel()) {
        return false;
    }
                                                              //----------v
    if (!player->hasFlag(PlayerFlag_HasInfiniteMana) && player->getMana() < weapon->getManaConsumption()) {              
        return false;
    }

    const ItemType& itemType = Item::items[weapon->getID()];
    if (hasBitSet(WIELDINFO_VOCREQ, itemType.wieldInfo)) {
        if (!hasBitSet(player->getVocationFlagId(), itemType.vocations)) {
            return false;
        }
    }

    return true;
}

src\condition.cpp(759,7): warning C4189: 'ret': local variable is initialized but not referenced

C++:
bool ConditionDamage::setParam(ConditionParam_t param, int32_t value)
{
    bool ret = Condition::setParam(param, value);                                          //<----------

    switch (param) {
        case CONDITION_PARAM_OWNER:
            owner = value;
            return true;

        case CONDITION_PARAM_CYCLE:
            cycle = value;
            return true;

        case CONDITION_PARAM_COUNT:
            count = value;
            return true;

        case CONDITION_PARAM_MAX_COUNT:
            max_count = value;
            return true;

        case CONDITION_PARAM_HIT_DAMAGE:
            hit_damage = value;
            return true;

        default:
            return false;
    }
}
 
Last edited:
Solution
solved, problem is else where.

warnings just ignore!

solved, problem is else where.

warnings just ignore!

 
Solution
Back
Top