src/strgen/strgen.cpp
changeset 7393 f3d27c82fec3
parent 7110 bda0a45e30e5
child 7755 7038d5001e0a
--- a/src/strgen/strgen.cpp	Fri Aug 03 02:21:10 2007 +0000
+++ b/src/strgen/strgen.cpp	Fri Aug 03 09:08:49 2007 +0000
@@ -1019,19 +1019,20 @@
 	out = fopen("tmp.xxx", "w");
 	if (out == NULL) fatal("can't open tmp.xxx");
 
-	fprintf(out, "enum StringIdEnum {");
+	fprintf(out, "/* This file is automatically generated. Do not modify */\n\n");
+	fprintf(out, "#ifndef TABLE_STRINGS_H\n");
+	fprintf(out, "#define TABLE_STRINGS_H\n");
 
 	lastgrp = 0;
 
 	for (i = 0; i != lengthof(_strings); i++) {
 		if (_strings[i] != NULL) {
-			fprintf(out, next == i ? "\t%s,\n" : "\n\t%s = 0x%X,\n", _strings[i]->name, i);
+			if (next != i) fprintf(out, "\n");
+			fprintf(out, "static const StringID %s = 0x%X;\n", _strings[i]->name, i);
 			next = i + 1;
 		}
 	}
 
-	fprintf(out, "};\n");
-
 	fprintf(out,
 		"\nenum {\n"
 		"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
@@ -1039,6 +1040,8 @@
 		"};\n", (uint)_hash
 	);
 
+	fprintf(out, "\n#endif /* TABLE_STRINGS_H */\n");
+
 	fclose(out);
 
 	if (CompareFiles("tmp.xxx", filename)) {