• 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 0.X warning switch break sources

fitorey

New Member
Joined
Mar 9, 2025
Messages
8
Reaction score
2

Code:
weapons.cpp: In member function ‘bool Weapons::loadDefaults()’:
weapons.cpp:86:41: warning: this statement may fall through [-Wimplicit-fallthrough=]
   86 |                                         if(it->ammoType != AMMO_NONE) {
      |                                         ^~
weapons.cpp:93:33: note: here
   93 |                                 case WEAPON_AMMO:
      |                                 ^~~~


this break only on:
if(it->ammoType != AMMO_NONE)
break;

is right?
intentional or it is an error?
i wanna fix the warning on build, but idk why this if is created
 
On OTX2 it looks like this ( otxserver/sources/weapons.cpp at otxserv2 · mattyx14/otxserver (https://github.com/mattyx14/otxserver/blob/otxserv2/sources/weapons.cpp#L84-L97) ):
C++:
				case WEAPON_AMMO:
				case WEAPON_DIST:
				{
					if(it->weaponType == WEAPON_DIST && it->ammoType != AMMO_NONE)
						continue;

					if(WeaponDistance* weapon = new WeaponDistance(&m_interface))
					{
						weapon->configureWeapon(*it);
						weapons[it->id] = weapon;
					}

					break;
				}
I would copy it and then test in game spear, bow with arrows, bow without arrows, arrows in hand to be sure it all works fine.
 
On OTX2 it looks like this ( otxserver/sources/weapons.cpp at otxserv2 · mattyx14/otxserver (https://github.com/mattyx14/otxserver/blob/otxserv2/sources/weapons.cpp#L84-L97) ):
C++:
                case WEAPON_AMMO:
                case WEAPON_DIST:
                {
                    if(it->weaponType == WEAPON_DIST && it->ammoType != AMMO_NONE)
                        continue;

                    if(WeaponDistance* weapon = new WeaponDistance(&m_interface))
                    {
                        weapon->configureWeapon(*it);
                        weapons[it->id] = weapon;
                    }

                    break;
                }
I would copy it and then test in game spear, bow with arrows, bow without arrows, arrows in hand to be sure it all works fine.
thank you very much
i'm not on my computer this week
i'll test it when i can and then i ping here
 
Back
Top