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, confirm your email, resolve issues, 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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ Compiling the server ➜ Problems with act_object.c

Problems with act_object.c

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


Posted by Creeper386   USA  (62 posts)  Bio
Date Mon 22 Apr 2002 02:06 AM (UTC)
Message
Okay first off I'm running Cygwin B20, Win98 machine.

I'm trying Sadiq's changes for a clean compile getting rid of all the stupid little errors mostly the 'suggest braces' warnings, and the 'comparison always zero' warnings.

I know it would still compile but a clean compile would be nice.

I have already made the changes suggested on Garwain's site for compiling smaug 1.4a on cygwin b20 but the site seems to have dissapeared of the net but luckily I had a soft copy on one of my comps, I compiled it after these changes and it worked just fine.

Now I made the changes from Sadiq's site:
( http://sadiq.adahost.com/smaug_winport.txt )

And the first changes work but I come to act_obj.c and I get the following:


act_obj.c: In function `do_auction':
act_obj.c:2903: parse error before `void'
act_obj.c:2911: `is_falling' undeclared (first use in this function)
act_obj.c:2911: (Each undeclared identifier is reported only once
act_obj.c:2911: for each function it appears in.)
act_obj.c:2914: `fall_count' undeclared (first use in this function)
act_obj.c:2927: `pexit' undeclared (first use in this function)
act_obj.c:2928: `to_room' undeclared (first use in this function)
act_obj.c:2930: `through' undeclared (first use in this function)
make[1]: *** [act_obj.o] Error 1
make: *** [all] Error 2



Any help would be appreciated, and thank you ahead of time,

Creeper
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 22 Apr 2002 02:44 AM (UTC)
Message
Very hard to say without seeing the source. Try posting lines 2900 to 2920 of your source.

- Nick Gammon

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

Posted by Creeper386   USA  (62 posts)  Bio
Date Reply #2 on Tue 23 Apr 2002 02:49 AM (UTC)
Message
I beleive this is the part where there is a problem but I'm not sure. Doesn't look like any part that I edited...



/* Make objects in rooms that are nofloor fall - Scryn 1/23/96 */

void obj_fall( OBJ_DATA *obj, bool through )
{
    EXIT_DATA *pexit;
    ROOM_INDEX_DATA *to_room;
    static int fall_count;
    char buf[MAX_STRING_LENGTH];
    static bool is_falling; /* Stop loops from the call to obj_to_room()  -- A

    if ( !obj->in_room || is_falling )
        return;

    if (fall_count > 30)
    {
        bug( "object falling in loop more than 30 times", 0 );
        extract_obj(obj);
        fall_count = 0;
        return;
     }
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 23 Apr 2002 04:16 AM (UTC)
Message
The error message said the problem was in function do_auction, however you have posted obj_fall.

- Nick Gammon

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

Posted by Creeper386   USA  (62 posts)  Bio
Date Reply #4 on Tue 23 Apr 2002 06:30 AM (UTC)

Amended on Tue 23 Apr 2002 06:34 AM (UTC) by Creeper386

Message
Those are lines 2900 to 2920 or right around there.. And it also contains all the is_falling and such like that that it is saying that it's the first time it's being used. do_auction is around 2482 or so. Thats another reason why I don't really understand the error message. Because I edited something in do auction adding brackets but didn't change anything in obj_fall. I'll post the whole do_auction in the next post.

Okay never mind about posting it.. It is way too long to stick on here. If I can find it I'll show you the changes I made in there.. Just hoping I can get to Sadiq's site again.

Creep
Top

Posted by Creeper386   USA  (62 posts)  Bio
Date Reply #5 on Tue 23 Apr 2002 07:15 AM (UTC)
Message
I think the problem was that area in the code was just fine and so Sadiq's fixings there was unneccessary giving too many braces in that area because I replace to act_obj.c with the original one and there is only three problems with the braces and that isn't in do_auction. Besides those three braces problems I have something about an unused variable buf which I'm going to look into next. Trying to get a completely clean compile before I get going with other things. So I know there aren't any problems except things I make....

I'll be back I'm sure... But hopefully I'll figure this out on my own... After this I'm planning on making an alternative to the slist going to make a section for everything someone like taking practice and splitting it up.. Planning on using the code for practice to get it done.

Thanks again,

Creep
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 23 Apr 2002 09:39 PM (UTC)
Message
Ah I see. If you have been fiddling around adding or removing braces then that might well happen. Just adding one extra brace effectively can cause the compiler to "not see" a function definition, and eventually give the error message it did, somewhat further on than it should.

Some editors have a "match braces" function (including MUSHclient's notepad) - you can use that to see if braces end where they should.

- Nick Gammon

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

Posted by Creeper386   USA  (62 posts)  Bio
Date Reply #7 on Fri 26 Apr 2002 02:38 AM (UTC)
Message
Where is Mush Notepad?

Also do you know anything about unused variables and why they would come up? Rather know what exactly they are then just how to fix a specific one.

Thanks for the help.

Creep
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Fri 26 Apr 2002 02:48 AM (UTC)

Amended on Fri 26 Apr 2002 02:49 AM (UTC) by Nick Gammon

Message
Use the Edit Menu -> Notepad (Ctrl+Alt+W).

Or, Flip To Notepad (Ctrl+Alt+Space).

Then you can use the Edit menu (in the Notepad) and "Go to matching brace" (Ctrl+E) or "select to matching brace" (Shift+Ctrl+E).

You may need to fiddle with the General Preferences -> Notepad configuration to tell it how to do the brace matching.

For example, for C code, you would probably have:


[X] Braces nest
[X] \ escapes next character
[ ] % escapes next character
[X] ' quotes a string   [X] ... with escape inside quotes
[X] " quotes a string   [X] ... with escape inside quotes 


As for unused variables, they will be because the programmer declared a variable but never used it. They do no harm, but can be confusing. eg.


int myfunction (int i, int j)
  {
  int k;
  int m;

  k = i + j;
  return k;
  }


In the example above the variable "m" is never used, and would generate that warning. You could delete the declaration for it.

- Nick Gammon

www.gammon.com.au, www.mushclient.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.


26,515 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.