summaryrefslogtreecommitdiff
path: root/src/doom/r_data.c
diff options
context:
space:
mode:
authorSimon Howard2010-12-10 22:44:01 +0000
committerSimon Howard2010-12-10 22:44:01 +0000
commit8dab0a3e635db40359c8ddeb9afaa9eca626ee98 (patch)
treecfd01bd0c96a97fcffad588782a5d106ca1b3d2f /src/doom/r_data.c
parent005747a6174d2d5b72e1af196a72cafb9b801a58 (diff)
parent678a8f9aeea9fa1966b3e8a94974688fda4d8fe1 (diff)
downloadchocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.tar.gz
chocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.tar.bz2
chocolate-doom-8dab0a3e635db40359c8ddeb9afaa9eca626ee98.zip
Merge from trunk. This is slightly out of date as I did the merge
several days ago. Subversion-branch: /branches/raven-branch Subversion-revision: 2212
Diffstat (limited to 'src/doom/r_data.c')
-rw-r--r--src/doom/r_data.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/doom/r_data.c b/src/doom/r_data.c
index b999e916..505f1ff7 100644
--- a/src/doom/r_data.c
+++ b/src/doom/r_data.c
@@ -413,6 +413,7 @@ R_GetColumn
static void GenerateTextureHashTable(void)
{
+ texture_t **rover;
int i;
int key;
@@ -429,12 +430,25 @@ static void GenerateTextureHashTable(void)
textures[i]->index = i;
- // Hook into hash table
+ // Vanilla Doom does a linear search of the texures array
+ // and stops at the first entry it finds. If there are two
+ // entries with the same name, the first one in the array
+ // wins. The new entry must therefore be added at the end
+ // of the hash chain, so that earlier entries win.
key = W_LumpNameHash(textures[i]->name) % numtextures;
- textures[i]->next = textures_hashtable[key];
- textures_hashtable[key] = textures[i];
+ rover = &textures_hashtable[key];
+
+ while (*rover != NULL)
+ {
+ rover = &(*rover)->next;
+ }
+
+ // Hook into hash table
+
+ textures[i]->next = NULL;
+ *rover = textures[i];
}
}