.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Air Assault Task Force- Save $8.00
Bronze- Save $10.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 2: The Ascension Wars

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #25  
Old March 27th, 2004, 03:53 PM
Cainehill's Avatar

Cainehill Cainehill is offline
Lieutenant General
 
Join Date: Mar 2004
Location: Albuquerque New Mexico
Posts: 2,997
Thanks: 0
Thanked 0 Times in 0 Posts
Cainehill is on a distinguished road
Default Re: Best (CD Bootable?) Linux Distro for Dominions?

Quote:
Originally posted by alexti:
quote:
Originally posted by Cainehill:
Hard to say how to rewrite the expression without seeing the source code and expression
Johan has posted the code that was causing problems. It was like that:
code:
  if (n + d6() < m + d6())

and different compilers evaluated left and right subexpressions in a different order.

Ah - Graeme is right, parenthesis's wouldn't do it, but it wouldn't be 100% necessary to use discrete lines of code either:

code:
  if ((int left = n + d6()) && (int right = m + d6()) && (left < right))

Still not pretty, but each '&&' introduces a sequence point, and the short-circuit boolean rules means that the ones to the right are only executed if the previous one was true. Presuming that d6() returns a value between 1 and 6 (and that n and m are unsigned or otherwise always non-negative values), the first two are true, and the final, real, test is whether left is less than right.

Somewhat ugly, but not as counter-intuitive as using non-stochastic dice rolls.

[ March 27, 2004, 13:54: Message edited by: Cainehill ]
__________________
Wormwood and wine, and the bitter taste of ashes.
Reply With Quote
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.