March 20, 200620 yr Moderator If the value of COM_mem[12] is 0.00, then I want to suppress display, otherwise, display the value: if (COM_mem[12] != 0.00f) { swprintf(buf,L"%3.2f",COM_mem[12]); } else { swprintf(buf,L""); }Unfortunately, it isn't working as expected... swprintf(buf,L"");by itself works as expected, so obviously the problem is in the if condition... I've tried using simply 0, 0.00, and now 0.00f and none of 'em work. Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
March 21, 200620 yr Author Moderator Just for the record, the syntax for the evaluation is quite correct and works perfectly...The problem turned out to be that the contents of the array weren't actually zero...Lesson learned: don't try to use an integer variable to initialize a float variable... ;)Another lesson learned: don't try to run a loop in PRE_UPDATE or PRE_DRAW, unless you provide a flag to inhibit it from running twice... since both PRE_UPDATE and PRE_DRAW are run twice per gauge cycle... Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
Create an account or sign in to comment