I have been trying to set hit points, mana and move past the stock 30,000 limit. I changed hp and max_hp from a short int to an int and set the max hit points to 2,000,000,000. I did this for mana and move also. I do not think anyone would ever reach that limit I would just like to have some room. When I set my hit points to the max at random I will end up with negative numbers for both current and max hit points. The negative number always seems to be the same. Any ideas would be great!
Sometimes you have to do more than that. If you're using 'set char goran hp 200000' take a look at the set function to make sure it's using an int instead of a short int when converting between string and integer, because it may not be the ch->max_hp variable, but instead a temporary holder for it somewhere in the flow.
Indeed you were right on the money. In mset when you set a characters hit points it applies them through perm_hit which is still declared as a short int.
On some systems int type may not guarantee type of long. On some systems int can refer to 16 bit and in others, most, it refers to 32 bit vars. I would probably stick to definitive built in types like "short" and "long". 16 and 32 bit variables.
It would be a very rare system today where an int was not 32 bits. This isn't 1985 anymore :)
It should be perfectly safe to expect an int to be 32 bits. If you happen to be one of those rare cases where it's 16 bits, you're going to have a lot more trouble than just some screwed up hit points.
29 Apr, 2008, David Haley wrote in the 6th comment:
Votes: 0
If the size in bits actually matters (as it sometimes does) you should declare it as an int32_t or uint32_t. Much less ambiguous than hoping that a system will define something one way or another. Don't have to think about 32- vs. 64-bit systems, which are the main source of difference these days (rather than 16 vs. 32). Also helps make sure that the code will work in the future. Basically, if you mean 32 bits, you should say 32 bits. :smile:
If the size in bits actually matters (as it sometimes does) you should declare it as an int32_t or uint32_t. Much less ambiguous than hoping that a system will define something one way or another. Don't have to think about 32- vs. 64-bit systems, which are the main source of difference these days (rather than 16 vs. 32). Also helps make sure that the code will work in the future. Basically, if you mean 32 bits, you should say 32 bits. :smile:
30,000 limit. I changed hp and max_hp from a short int to an int
and set the max hit points to 2,000,000,000. I did this for mana
and move also. I do not think anyone would ever reach that limit
I would just like to have some room. When I set my hit points to
the max at random I will end up with negative numbers for both
current and max hit points. The negative number always seems to
be the same. Any ideas would be great!