negative numbers in DFNs

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
Post Reply
jr
UOX3 Newbie
Posts: 15
Joined: Mon Mar 07, 2005 1:40 pm
Location: Kiel
Has thanked: 0
Been thanked: 0

negative numbers in DFNs

Post by jr »

The following problem occuring with my cygwin build I have worked around but not solved properly.

All DFN numbers (e.g. DEXADD) are currently converted using UString::toULong and later casted to signed if necessary. But unfortunately the gcc standard library doesn't convert the string '-1' to 0xffffffff when parsed as an unsigned long. I've just replaced all occurences of negative numbers by the corresponding unsigned bit representation, but thast isn't exactly readable :)

A new Datatype DFN_SIGNED and an extended sectData field would be possible, but perhaps there is a simpler solution?
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Well, logically there are no DFN tags that go up to 0xFFFFFFFF so we could just convert to an SLong, and cast from there.
Scott
Post Reply