stringtable.cxx

changeset 36
a8838b5f1213
parent 21
ae602e667879
child 38
e4bbd540663b
--- a/stringtable.cxx	Sat Jul 28 17:57:37 2012 +0300
+++ b/stringtable.cxx	Sun Jul 29 04:02:07 2012 +0300
@@ -46,6 +46,8 @@
 #include "bots.h"
 #include "stringtable.h"
 
+// ============================================================================
+// Initializes the string table
 void InitStringTable() {
 	// Zero out everything first.
 	for (unsigned int a = 0; a < MAX_LIST_STRINGS; a++)
@@ -53,10 +55,13 @@
 			g_StringTable[a][b] = 0;
 }
 
+// ============================================================================
+// Potentially adds a string to the table and returns the index of it.
 unsigned int PushToStringTable (char* s) {
 	// Find a free slot in the table. 
 	unsigned int a;
 	for (a = 0; a < MAX_LIST_STRINGS; a++) {
+		// String is already in the table, thus return it.
 		if (!strcmp (s, g_StringTable[a]))
 			return a;
 		
@@ -81,6 +86,8 @@
 	return a;
 }
 
+// ============================================================================
+// Counts the amount of strings in the table.
 unsigned int CountStringTable () {
 	unsigned int count = 0;
 	for (unsigned int a = 0; a < MAX_LIST_STRINGS; a++) {

mercurial