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
➜ Unsure how to use diffrent things from different files.
Unsure how to use diffrent things from different files.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gtr
(38 posts) Bio
|
Date
| Sat 10 Jul 2004 01:57 PM (UTC) Amended on Sat 10 Jul 2004 01:58 PM (UTC) by Gtr
|
Message
| Ahh, hey. I was wondering if anyone could expline to me how to use different things from different files. Like if I wanted to use things from track.c like 'int find_first_step'
and all the defines that go along with it if thats possible, but in another file, if anyone can help me out thanks. | Top |
|
Posted by
| Nick Cash
USA (626 posts) Bio
|
Date
| Reply #1 on Sat 10 Jul 2004 07:24 PM (UTC) |
Message
| It depends on if its locally defined (as in, for use only by that file) or globally (the entire mud). It its defined locally, there will be a prototype declaration at the top of the file. To make it global, delete that definition and put it in mud.h. Generally thats all there is to it. If the declaration is NOT there then it should work from other files anyways. |
~Nick Cash
http://www.nick-cash.com | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #2 on Sat 10 Jul 2004 09:40 PM (UTC) Amended on Sat 10 Jul 2004 09:41 PM (UTC) by Greven
|
Message
| Another option is to simply put declarations at the top of the new file. If you want to be able to call find_first_step else where, you can add:int find_first_step(whatever the arguments for it is);
This says this is what is needed, but it will reference the function in another file.
If your using global variables declared in track.c, you can reference them with the "extern" prefix:
And if you need macros in another file, you can put them in mud.h as whiteknight says, or just copy and paste into your new file. If you willbe using it in only a few places, better individual files, but if more than a few, better to put them in mud.h |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Gtr
(38 posts) Bio
|
Date
| Reply #3 on Sat 10 Jul 2004 11:22 PM (UTC) |
Message
| Hrmm I see, thanks guys. | 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.
13,916 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top