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 ➜ SMAUG coding ➜ Increasing values

Increasing values

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


Posted by Zeno   USA  (2,871 posts)  Bio
Date Sun 22 Jun 2003 01:03 AM (UTC)
Message
Is there a variable (like int or sh_int) that holds more than 1 billion? I wish to use it for gold or exp of the such.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #1 on Sun 22 Jun 2003 03:01 AM (UTC)
Message
Quick rundown for length of common numeric variable types:

short        32, 767
int/long     2,147,483,647
float        ~10^38
double       ~10^308
long double  ~10^4392

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Sun 22 Jun 2003 05:18 PM (UTC)

Amended on Sun 22 Jun 2003 05:19 PM (UTC) by Zeno

Message
So if I were to change in mud.h -
 int          exp

to
 double       exp

it would increase how the value of how high it can hold exp?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Sun 22 Jun 2003 06:41 PM (UTC)

Amended on Sun 22 Jun 2003 06:42 PM (UTC) by Meerclar

Message
Yep, thats about the extent of it.


dbl     exp


rather than


double exp

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #4 on Sun 22 Jun 2003 10:07 PM (UTC)
Message
Ok, when I did that I got a bunch of error while compiling.

 dereferencing pointer to incomplete type

All over

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Sun 22 Jun 2003 11:55 PM (UTC)
Message
I tried that and got no errors, however I would be a bit worried about display routines that expect a long but get passed a double.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 22 Jun 2003 11:57 PM (UTC)
Message
You could also try a "long long" which will give you 9,223,372,036,854,775,807 (signed) experience points. However you still have the problem of changing appropriate displays so they know they are getting a long long.

- Nick Gammon

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

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #7 on Mon 23 Jun 2003 06:08 AM (UTC)
Message
Hmm, if you tried that and it worked than perhaps I am not doing it correctly. Around line 2288

    sh_int              numattacks;
    dbl                 gold;
    int                 exp;
    EXT_BV              act;

After doing a clean recompile I get a lot of

act_comm.c: In function `talk_auction':
act_comm.c:2939: dereferencing pointer to incomplete type
act_comm.c:2940: dereferencing pointer to incomplete type

Thats just an example of what I get, there's a lot more of the same.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #8 on Mon 23 Jun 2003 03:53 PM (UTC)
Message
The functions that were being passed a gold value are expecting an int value and will all need to be changed to reflect the change of the gold data type to dbl.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #9 on Mon 23 Jun 2003 09:07 PM (UTC)
Message
dbl - what's that?

The C data type is "double". I did get a warning this time in build.c, for printing exp, on this line:


        fprintf( fpout, "%d %d\n",      pMobIndex->gold,
                                        pMobIndex->exp                  );


The error was:


buildc:5971: warning: int format, double arg (arg 4)

- Nick Gammon

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

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #10 on Mon 23 Jun 2003 09:13 PM (UTC)
Message
Sorry, too much vb code lately I guess. Yes, C is double for data type.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #11 on Mon 23 Jun 2003 11:05 PM (UTC)
Message
Err, so what do I use? dbl or double?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #12 on Tue 24 Jun 2003 12:05 AM (UTC)
Message
Would use double for the value changes but you would need to change any struct that references the value changed to expect double instead of int.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #13 on Wed 25 Jun 2003 02:02 AM (UTC)
Message
Alright, I see. I'm doing that now, but I think an example would help me of changing any struct references, so if anyone could provide one, it would help me so much.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
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.


28,620 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.