Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Boolean values in scene files
#1
The new scene parser that was added some time ago supports a new way of defining boolean values.

In original colobot, there was no real boolean values, just numbers - 0 for false, 1 for true.
Now, you can actually use true/false for these values.

Code:
CreateObject selectable=0     // old syntax
CreateObject selectable=false     // new syntax

My only question now is: Should the true/false become the new recommended standard used in default Colobot scene files, or should we keep using 1/0?
#2
I think there should be support for both standards. There's sometimes other options than 0/false and 1/true, like 2, 3 etc. True/False standard is more human-friendly, but it have one disadvantage - it's longer and creates more not really necessary bytes in text file.
#3
If a scene file is created by a human, then use true/false, if a scene file is created by an editor, then use 1/0. It doesn't really matter, though. It's the same situation as with some guys preferring to write code like that:

Code:
void f() {
   return;
}

or like that:

Code:
void f()
{
   return;
}



I have a question if does it work the following way: 0 is false, any other value is true?
[Image: XvN5CTW.png] [Image: UYXyyMS.png]
#4
(05-30-2015, 04:43 PM)Raptor Wrote: I think there should be support for both standards.
Both standards are supported, I'm just asking which should be the preferred one.

(05-30-2015, 05:42 PM)Simbax Wrote: I have a question if does it work the following way: 0 is false, any other value is true?
I'm not sure. It's whatever boost::lexical_cast uses. It's probably either 0 = false, anything else = true or 0 = false, 1 = true, anything else = level loading error.
In the old implementation this really depended on the actual command (some did if(param == 0) {} else {}, others did if(param == 1) {} else {}). It's more standarized now.


Forum Jump:


Users browsing this thread: 1 Guest(s)