23 Feb, 2013, thebigirish wrote in the 1st comment:
Votes: 0
sprintf( buf2, "%s [%d]\n\rYou gain %d PL. Your new PL is %ld\n\r%s [%d]\n\rYou gain %d PL. Your new PL is %ld",
buf5, dam, gainexp, (ch->exp - gainexp), buf5, dam, gainexp, ch->exp);



is returning;


fight.c: In function `new_dam_message':
fight.c:4297: warning: long int format, different type arg (arg 6)
fight.c:4297: warning: long int format, different type arg (arg 10)
23 Feb, 2013, Igabod wrote in the 2nd comment:
Votes: 0
it's telling you that argument 6 on line 4297 is defined as %ld but the information it is receiving is of a format other than a long int. Try fiddling around with the %ld and %d and see what happens when you change them.

And maybe do a google search on that error message. You will be able to find a tutorial somewhere explaining what the difference between %s and %d and %ls/%ld is.

I'm not really skilled enough to tell you exactly what you need to change without having access to the code to experiment with myself. But I've run across this problem before and found the information I just gave you to be helpful in finding the solution. You may just learn more this way than you would if I told you what to change. Hope this helps.
23 Feb, 2013, Rarva.Riendf wrote in the 3rd comment:
Votes: 0
24 Feb, 2013, Vigud wrote in the 4th comment:
Votes: 0
24 Feb, 2013, Rarva.Riendf wrote in the 5th comment:
Votes: 0


Better ? I would say complete. But for general use: unreadable.
Like readin a man page of a bash command, sure it is the more complete ressource….is it the most usable for general purpose ? definitely not.
24 Feb, 2013, Vigud wrote in the 6th comment:
Votes: 0
Better, since it's correct, while www.cplusplus.com/reference is not.
24 Feb, 2013, Rarva.Riendf wrote in the 7th comment:
Votes: 0
What are the errors ?
04 Mar, 2013, Davenge wrote in the 8th comment:
Votes: 0
I'm with Rarva, that shit's unreadable. If I was still struggling with format stuff like that, I'd close that link and look for another immediately.
04 Mar, 2013, quixadhal wrote in the 9th comment:
Votes: 0
The man page for sprintf pretty much explains all the various format options. If you're on Windows, google for "printf man page".

%d is the integer format code. l is a modifier indicating it's a "long int", which is usually 32-bit or 64-bit (depending on your architecture). I usually suggest people use %zd to avoid such size issues, as the z modifier uses the sizeof for pointers. You can usually pass smaller integers to a longer format without any issues (perhaps a warning), whereas passing a long int to a short printf code will cause a crash.

To fix the issue, you need to typecast the thing you're passing so the compiler doesn't warn you about it.

You can patch the existing code via:

sprintf( buf2, "%s [%d]\n\rYou gain %d PL. Your new PL is %ld\n\r%s [%d]\n\rYou gain %d PL. Your new PL is %ld",
buf5, dam, gainexp, (long int)(ch->exp - gainexp), buf5, dam, gainexp, (long int)ch->exp);


However…. look to see what ch->exp actually is declared as… I bet it's an unsigned long int, in which case anything over 2 billion (or 2^63 on a 64-bit platform) will show up as negative unless you use the 'u' printf token… IE: %lu, or %zu.
0.0/9