MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetTotalStringCount

Function GetTotalStringCount

Descent3/localization.cpp:442–467  ·  view source on GitHub ↗

returns the total number of strings in all the string table files returns 0 on error

Source from the content-addressed store, hash-verified

440// returns the total number of strings in all the string table files
441// returns 0 on error
442int GetTotalStringCount(void) {
443 int scount = 0;
444 int findex = 0;
445 CFILE *file;
446 char tempbuffer[MAX_LINE_LENGTH + 1];
447 ASSERT(Localization_language != -1);
448
449 while (String_table_list[findex]) {
450 // open the file up
451 char fname[_MAX_PATH];
452 FixFilenameCase(String_table_list[findex], fname);
453 file = cfopen(fname, "rt");
454 if (!file)
455 return 0;
456
457 while (!cfeof(file)) {
458 cf_ReadString(tempbuffer, MAX_LINE_LENGTH + 1, file);
459 if (_parse_line_information(tempbuffer) == Localization_language)
460 scount++;
461 }
462
463 cfclose(file);
464 findex++;
465 }
466 return scount;
467}
468
469// Loads a string table file, returns number of strings read if everything went ok,else 0
470int LoadStringFile(const char *filename, int starting_offset) {

Callers 1

LoadStringTablesFunction · 0.85

Calls 6

FixFilenameCaseFunction · 0.85
cfopenFunction · 0.85
cfeofFunction · 0.85
cf_ReadStringFunction · 0.85
_parse_line_informationFunction · 0.85
cfcloseFunction · 0.85

Tested by

no test coverage detected