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

C++ [tfs 1.2] canWalkthrough NOPVPZONE

_M4G0_

Well-Known Member
Joined
Feb 6, 2016
Messages
504
Solutions
16
Reaction score
98
I did this modification

C++:
const Tile* playerTile = player->getTile();
    if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE) && !playerTile->hasFlag(TILESTATE_NOPVPZONE)) {
        return false;
    }
on windows compile normally and work, on linux this error

Code:
In member function ‘bool Player::canWalkthrough(const Creature*) const’:
/home/servidor/tfs/src/player.cpp:713:68: error: suggest parentheses around ‘&&’ within ‘||’ [-Werror=parentheses]
  if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE) && !playerTile->hasFlag(TILESTATE_NOPVPZONE)) {

if i insert

C++:
playerTile->hasFlag(TILESTATE_PROTECTIONZONE) || !playerTile->hasFlag(TILESTATE_NOPVPZONE)) {
compile on linux but dont work

TFS 1.2 10.99
 
Google what parentheses mean.

if (something || (something2 && something3))
thanks... but i tried :oops:
C++:
((!playerTile || (!playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) || (!playerTile->hasFlag(TILESTATE_NOPVPZONE))))
 
thanks... but i tried :oops:
C++:
((!playerTile || (!playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) || (!playerTile->hasFlag(TILESTATE_NOPVPZONE))))
It's not the same.

It should be:
Code:
if (!playerTile || (!playerTile->hasFlag(TILESTATE_PROTECTIONZONE) && !playerTile->hasFlag(TILESTATE_NOPVPZONE))) {
 
Back
Top