Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Bits going negative?

Bits going negative?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Cash   USA  (626 posts)  Bio
Date Thu 29 Jul 2004 09:39 PM (UTC)
Message
Ok, well, I figure I havent stirred up trouble in a while, so here I go. I'm working with SocketMud 1.8. I've installed numerous bits of code, including some bitmask code by Runter. It works correctly, however, I keep getting this problem. I create an area like this:

new_area "Dragon's Den" Odis dragonsden.xml 1 100

This is all good and fine since one_arg now supports quoting, but for an odd reason it crashes. Here's a backtrace on the core file:

#0  0x08050849 in set_bit (mask=0x805bb48, bit=-1) at bits.c:89
89              if (pBlist->set == bit / 32) { /* Is this the correct set? */
(gdb) bt
#0  0x08050849 in set_bit (mask=0x805bb48, bit=-1) at bits.c:89
#1  0x080503bc in create_area (dMob=0x805ba70, area_name=0xbfffe070 "Dragon's Den", author=0xbfffe050 "Odis",
    filename=0xbfffe030 "dragonsden.xml", low_num=1, high_num=100) at areas.c:367
#2  0x080501b3 in cmd_new_area (dMob=0x805ba70, argument=0x805e4ea "100") at areas.c:305
#3  0x0804c4dc in handle_cmd_input (dsock=0x805d8a8, arg=0x805e4c5 "\"Dragon's Den\" Odis dragonsden.xml 1 100")
    at interpret.c:29
#4  0x080496d0 in game_loop (cont=3) at socket.c:176
#5  0x08049427 in main (argc=1, argv=0xbfffe654) at socket.c:84
#6  0x42017589 in __libc_start_main () from /lib/i686/libc.so.6

However, if I make an area like this:

new_area "Dragons Den" Odis dragonsden.xml 1 100

It works perfectly. I've tested the bitmask code, it works fine. My worries is here:

#0 0x08050849 in set_bit (mask=0x805bb48, bit=-1) at

It isnt -1, it should be 0. When I take the ' out of the name it seems to clear it up. Here is the corrosponding line of code that crashes it:

set_bit( new_area->flags, FLAG_DEFAULT );

Flag default is defined as:

#define FLAG_DEFAULT 0

Any thoughts? I've tested the bitmask system quite a few times and it works correctly, but the darned apostrophe keeps messing it up. I obviously can't have the code base crashing because of a silly apostrophe. :P

Thanks for any and all help. I always appreciate it.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 30 Jul 2004 02:50 AM (UTC)
Message
-1 basically means "all bits set" which isn't necessarily a disaster.

I don't have the source for this, I suggest you step through with the debugger on a new_area and see why it is doing that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #2 on Tue 03 Aug 2004 10:39 PM (UTC)
Message
Strange. I left it alone for a while ( a couple days ), came back, completely recompiled and its fine now. I guess its just one of those things :P

~Nick Cash
http://www.nick-cash.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,101 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.