silvertogold.txt
snippets · 715 B · 2010-03-30
Silver to gold converter by Jekeld of Acropolis.
Download « Back to the snippets list
/*
* Silver to Gold Converter
* Code by Jekeld of Acropolis (dinchak.dynu.com: 5500)
* You may use this code as long as you leave this header
*/
char * silver_to_gold(int silver)
{
char buf[MSL];
int Tgold = 0; //True Gold
int Tsilver = 0; //True Silver
int i;
Tsilver = silver;
for (i = 0;;i++)
{
if (Tsilver < 100)
break;
Tgold++;
Tsilver-= 100;
if (i > 1299999999)
return str_dup("bug");
}
if (Tgold <= 0)
{
sprintf(buf, "{w%d{Ws{x", Tsilver);
}
else if ((Tgold > 0) && (Tsilver <= 0))
{
sprintf(buf, "{y%d{Yg{x", Tgold);
}
else
{
sprintf(buf, "{y%d{Yg {w%d{Ws{x", Tgold, Tsilver);
}
return str_dup(buf);
}
/* End Snipper */