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

Few question about compiling TFS

MalyFanek

New Member
Joined
Oct 10, 2019
Messages
37
Reaction score
2
When i see warning/note while compiling TFS but compile goes fine anyway shall i be worried? Or its message from libs/etc that warns me? Or as i think, those warnings might cause some bugs? Sry if its stupid question but im fresh in making ots, and mostly at linux x;

And what about NOTE?
 
Well problem is i got pretty much of those warnings cuz i been trying to change skills etc and thats why im asking cuz my skills grows so fast even with config script for them+they have no limit ;/ one guy have 300+ fishing (energy def at my ots/ while i had it on windows it been fine, but now while using vps and compiled for linux thats happend ;x)

Okay so i post all i have of them for now:

luascript.h:
Code:
In file included from baseevents.h:22:0,
                 from actions.h:20,
                 from actions.cpp:20:
luascript.h: In member function ‘virtual bool Action::executeUse(Player*, Item*, const PositionEx&, const PositionEx&, bool, uint32_t)’:
luascript.h:277:106: warning: ‘<anonymous>.PositionEx::stackpos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  L, const PositionEx& position) {pushPosition(L, position, position.stackpos);}
As i guess its about push, works but dunno can it cause any bug?

game.cpp:
Code:
game.cpp: In member function ‘bool Game::combatChangeHealth(CombatType_t, Creature*, Creature*, int64_t, MagicEffect_t, Color_t, bool)’:
game.cpp:4431:39: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
    sprintf(buffer, "+%d", healthChange);
                                       ^
game.cpp:4456:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (random_range(1, 500) <= critx) //use that random function if it works for you, but I used to always use the uniform_random(int,int) func on tfs
             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
game.cpp:4483:38: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
      sprintf(buffer, "%d", manaDamage);
                                      ^
game.cpp:4664:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
      sprintf(buffer, "%d", damage);
                                  ^
game.cpp: In member function ‘bool Game::combatChangeMana(Creature*, Creature*, int64_t)’:
game.cpp:4697:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
    sprintf(buffer, "+%d", manaChange);
                                     ^
game.cpp:4735:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
    sprintf(buffer, "%d", manaLoss);
                                  ^
game.cpp: In constructor ‘Game::Game()’:
game.cpp:80:24: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
   globalSaveMessage[i] = false;
   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
game.cpp:79:23: note: within this loop
  for(int32_t i = 0; i < 3; i++)
                     ~~^~~
In file included from game.cpp:18:0:
game.h: In member function ‘void Game::globalSave()’:
game.h:615:78: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
 setGlobalSaveMessage(int16_t key, bool value) {globalSaveMessage[key] = value;}
                                                ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
game.cpp:6384:23: note: within this loop
  for(int16_t i = 0; i < 3; i++)
                     ~~^~~
Most of them are int64 not 32, cuz of hp/mp% but the other? Ah and critical skill there too


item.cpp:
Code:
item.cpp: In member function ‘virtual Attr_ReadValue Item::readAttr(AttrTypes_t, PropStream&)’:
item.cpp:649:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
     break;
          ^
item.cpp:652:3: note: here
   default:
   ^~~~~~~
No idea


manager.cpp:
Code:
manager.cpp: In member function ‘virtual void ProtocolManager::parsePacket(NetworkMessage&)’:
manager.cpp:254:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    }
    ^
manager.cpp:257:3: note: here
   case MP_MSG_CHAT_REQUEST:
   ^~~~
Same here...

monster.cpp:
Code:
monster.cpp: In member function ‘bool Monster::isFriend(const Creature*)’:
monster.cpp:315:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if(creature->getPlayer() && !targetPlayers)
     ^~
monster.cpp:318:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if(!isSummon() || !master->getPlayer())
  ^~
delete if?

player.cpp:
Code:
player.cpp: In member function ‘int32_t Player::getWeaponSkill(const Item*) const’:
player.cpp:400:60: warning: left operand of comma operator has no effect [-Wunused-value]
    return getSkill(SKILL_SWORD, SKILL_LEVEL) && (SKILL_AXE,SKILL_LEVEL);
                                                            ^~~~~~~~~~~
player.cpp:406:60: warning: left operand of comma operator has no effect [-Wunused-value]
    return getSkill(SKILL_AXE, SKILL_LEVEL) && (SKILL_SWORD,SKILL_LEVEL);
                                                            ^~~~~~~~~~~
player.cpp:409:60: warning: left operand of comma operator has no effect [-Wunused-value]
    return getSkill(SKILL_AXE, SKILL_LEVEL) && (SKILL_SWORD,SKILL_LEVEL);
                                                            ^~~~~~~~~~~
player.cpp: In member function ‘virtual void Player::drainHealth(Creature*, CombatType_t, int64_t)’:
player.cpp:1870:143: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 s.", damage, (damage != 1 ? "s" : ""), attacker->getNameDescription().c_str());
                                                                              ^
player.cpp:1872:80: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 sprintf(buffer, "You lose %lld hitpoint%s.", damage, (damage != 1 ? "s" : ""));
                                                                              ^
player.cpp: In member function ‘virtual void Player::drainMana(Creature*, CombatType_t, int64_t)’:
player.cpp:1883:111: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 na blocking an attack by %s.", damage, attacker->getNameDescription().c_str());
                                                                              ^
player.cpp:1885:46: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
   sprintf(buffer, "You lose %d mana.", damage);
                                              ^
player.cpp: In member function ‘virtual void Player::onAttackedCreatureDrain(Creature*, int64_t)’:
player.cpp:3858:93: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t {aka long int}’ [-Wformat=]
 , "You deal %lld damage to %s.", points, target->getNameDescription().c_str());
                                                                              ^
player.cpp: In member function ‘virtual void Player::onSummonAttackedCreatureDrain(Creature*, Creature*, int64_t)’:
player.cpp:3867:124: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘int64_t {aka long int}’ [-Wformat=]
 %s.", summon->getName().c_str(), points, target->getNameDescription().c_str());
                                                                              ^
player.cpp: In member function ‘ItemVector Player::getWeapons() const’:
player.cpp:345:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
     if(item->getAmmoType() != AMMO_NONE)
     ^~
player.cpp:348:4: note: here
    case WEAPON_SWORD:
    ^~~~
player.cpp: In member function ‘void Player::manageAccount(const string&)’:
player.cpp:4870:20: warning: iteration 11 invokes undefined behavior [-Waggressive-loop-optimizations]
       talkState[i] = false;
       ~~~~~~~~~~~~~^~~~~~~
player.cpp:4869:26: note: within this loop
      for(int8_t i = 2; i <= 14; i++)
                        ~~^~~~~
As i said few of them are here cuz i changed skills from fist etc to crit blabla, and made to advance 2 skills from 1 weap


protocolgame.cpp:
Code:
protocolgame.cpp: In member function ‘void ProtocolGame::sendMagicEffect(const Position&, uint8_t)’:
protocolgame.cpp:2260:10: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  if(type > MAGIC_EFFECT_LAST || !canSee(pos))
     ~~~~~^~~~~~~~~~~~~~~~~~~
protocolgame.cpp: In member function ‘void ProtocolGame::AddCreatureSpeak(NetworkMessage_ptr, const Creature*, SpeakClasses, std::__cxx11::string, uint16_t, uint32_t, Position*, ProtocolGame*)’:
protocolgame.cpp:2978:158: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 CustomFlag(PlayerCustomFlag_HideLevel) && (pg == NULL || pg != NULL && !pg->getIsCast()))
                                                          ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~

weapons.cpp:
Code:
weapons.cpp: In member function ‘bool Weapons::loadDefaults()’:
weapons.cpp:85:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
      if(it->ammoType != AMMO_NONE)
      ^~
weapons.cpp:88:5: note: here
     case WEAPON_AMMO:
     ^~~~
 
Back
Top