diff --git a/src/hashtable.c b/src/hashtable.c index 0a11e60..4af14c6 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -70,7 +70,7 @@ ht_set(Hashtable *table, const char *key, void *val) { int hashkey = 0; Entry *newEntry = NULL; - Entry *next = NULL; + Entry *next; Entry *last = NULL; hashkey = hash(table, key); @@ -86,6 +86,9 @@ ht_set(Hashtable *table, const char *key, void *val) next = next->next; } + if (last == NULL) + last = table->entries[hashkey]; + if (next && next->key && strcmp(key, next->key) == 0) { /* Collision */ free(next->value); diff --git a/src/player.c b/src/player.c index 29a25ec..f4c3d86 100644 --- a/src/player.c +++ b/src/player.c @@ -217,7 +217,7 @@ player_print(Player *p) printf("\n"); printf("--------=== <[ Player Stats ]> ===--------\n"); printf("HP: %d\n", p->stats.hp); - printf("Level: %d XP: %u\n", p->stats.lvl, p->xp); + printf("Level: %u XP: %u\n", p->stats.lvl, p->xp); printf("Pos: %dx%d RoomPos: %dx%d\n", pos.x, pos.y, roomPos.x, roomPos.y); printf("Steps: %u\n", p->total_steps); printf("------------------------------------------\n");