mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-08 10:28:50 +01:00
New mail system, with inbox OLC, index rebuilder and initial mail
This commit is contained in:
parent
d257dc0c75
commit
e068bfd5c0
28 changed files with 4085 additions and 588 deletions
21
src/utils.c
21
src/utils.c
|
|
@ -1516,3 +1516,24 @@ bool set_admin_level(struct char_data *ch, int admlvl)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* add_commas takes a numeric value, and adds commas to it, returning a string */
|
||||
char *add_commas(long num)
|
||||
{
|
||||
int i, j = 0, len;
|
||||
int negative = (num < 0);
|
||||
char num_string[MAX_INPUT_LENGTH];
|
||||
static char commastring[MAX_INPUT_LENGTH];
|
||||
|
||||
sprintf(num_string, "%ld", num);
|
||||
len = strlen(num_string);
|
||||
|
||||
for (i = 0; num_string[i]; i++) {
|
||||
if ((len - i) % 3 == 0 && i && i - negative)
|
||||
commastring[j++] = ',';
|
||||
commastring[j++] = num_string[i];
|
||||
}
|
||||
commastring[j] = '\0';
|
||||
|
||||
return commastring;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue