[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Bits going negative?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Bits going negative?

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


Posted by Nick Cash   USA  (626 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[Go to top] top

Posted by Nick Cash   USA  (626 posts)  [Biography] 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
[Go to top] 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.


2,713 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]