Skip to content
Snippets Groups Projects
Commit a6883c69 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix off-by-one issue in previous commit, text.dat string numbers are 1-based

parent 4686d955
No related branches found
No related tags found
1 merge request!455Update branch with changes from master
......@@ -38,11 +38,16 @@ int lprintf(int level, const char *fmt, ...); /* log output */
/* readtext.c */
char * readtext(long *line, FILE *stream, long dflt);
// Returns 0-based text string index
int get_text_num(const char* id)
{
int i;
if (isdigit(*id))
return atoi(id);
if (isdigit(*id)) {
i = atoi(id);
if (i < 1)
return TOTAL_TEXT;
return i - 1;
}
for (i = 0; i < TOTAL_TEXT; ++i)
if (strcmp(text_id[i], id) == 0)
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment