fixed bug where expressions like %02d would not be evaluated correctly

This commit is contained in:
Pavol Marko 2004-08-30 15:14:50 +00:00
parent bec1e418e7
commit b33a53d258

View File

@ -785,7 +785,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
char format[16]; char format[16];
format[0] = '%'; format[0] = '%';
char *ptr = format+1; char *ptr = format+1;
if (*src == 's' || *src == 'd' || *src == 'f' || *src == 'i' || *src == 'g') if (*src != '%')
{ {
while (*src != 0 && !isalpha(*ptr++ = *src++)) while (*src != 0 && !isalpha(*ptr++ = *src++))
/*nothing*/; /*nothing*/;
@ -819,8 +819,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
} }
default: default:
{ {
*outptr++ = '%'; strcpy(outptr, format);
*outptr++ = *(ptr-1);
break; break;
} }
} }