Adventure Game Studio

AGS Development => Engine Development => Topic started by: Crimson Wizard on Fri 20/07/2012 15:15:30

Title: Typo in 3.2.1, acroom.h?
Post by: Crimson Wizard on Fri 20/07/2012 15:15:30
Something I noticed two months ago but forgot about.
Here's what is on SVN:
(acroom.h)
Code (cpp) Select

#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.
Title: Re: Typo in 3.2.1, acroom.h?
Post by: 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.

E: || should be used, the other option is confusing.
Title: Re: Typo in 3.2.1, acroom.h?
Post by: Crimson Wizard on Fri 20/07/2012 15:55:53
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.