Typo in 3.2.1, acroom.h?

Started by Crimson Wizard, Fri 20/07/2012 15:15:30

Previous topic - Next topic

Crimson Wizard

Something I noticed two months ago but forgot about.
Here's what is on SVN:
(acroom.h)
Code: cpp

#ifdef THIS_IS_THE_ENGINE
  if ((rstruc->wasversion < 17) | (rstruc->wasversion > ROOM_FILE_VERSION))
#else
  if ((rstruc->wasversion < 15) || (rstruc->wasversion > ROOM_FILE_VERSION))
#endif
  {
    fclose(opty);
    quit("Load_Room: Bad packed file. Either the file requires a newer or older version of\n"
      "this program or the file is corrupt.\n");
  }

Do you see a different operator here? Engine branch is using '|' (bitwise OR), Editor branch is using '||' (logical OR).
Is it a typo (hence a bug)? And which one is?

My guess is for '||', but... maybe there's some witty plan behind this.

JJS

Both ORs are with boolean values, so the ORed values are only 0 or 1. So it doesn't matter if a bitwise or a boolean OR operator is used, it has the same result.

E: || should be used, the other option is confusing.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

Crimson Wizard

Quote from: JJS on Fri 20/07/2012 15:23:27
Both ORs are with boolean values, so the ORed values are only 0 or 1. So it doesn't matter if a bitwise or a boolean OR operator is used, it has the same result.
Ahhh.... :D cannot think properly at the Friday's evening.

SMF spam blocked by CleanTalk