projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added description for BD style explosion
[rocksndiamonds.git]
/
src
/
libgame
/
setup.c
diff --git
a/src/libgame/setup.c
b/src/libgame/setup.c
index 493fc74e53283bc6dacc901bc5e6e7ec783c4e5d..4027a6e065a4f23823b7c1050345a08330c9b6a7 100644
(file)
--- a/
src/libgame/setup.c
+++ b/
src/libgame/setup.c
@@
-725,7
+725,7
@@
char *getScoreTapeBasename(char *name)
sprintf(timestamp, "%s", getCurrentTimestamp());
sprintf(basename_raw, "%s-%s", timestamp, name);
sprintf(timestamp, "%s", getCurrentTimestamp());
sprintf(basename_raw, "%s-%s", timestamp, name);
- sprintf(basename, "%s-%08x", timestamp, get_hash_from_
key
(basename_raw));
+ sprintf(basename, "%s-%08x", timestamp, get_hash_from_
string
(basename_raw));
return basename;
}
return basename;
}
@@
-2281,7
+2281,7
@@
DEFINE_HASHTABLE_REMOVE(remove_hash_entry, char, char);
#define remove_hash_entry hashtable_remove
#endif
#define remove_hash_entry hashtable_remove
#endif
-unsigned int get_hash_from_
key
(void *key)
+unsigned int get_hash_from_
string
(void *key)
{
/*
djb2
{
/*
djb2
@@
-2311,15
+2311,27
@@
unsigned int get_hash_from_key(void *key)
return hash;
}
return hash;
}
-int hash_keys_are_equal(void *key1, void *key2)
+unsigned int get_hash_from_integer(void *key)
+{
+ unsigned int hash = PTR_TO_UINT(key);
+
+ return hash;
+}
+
+int hash_key_strings_are_equal(void *key1, void *key2)
{
return (strEqual((char *)key1, (char *)key2));
}
{
return (strEqual((char *)key1, (char *)key2));
}
+int hash_key_integers_are_equal(void *key1, void *key2)
+{
+ return (key1 == key2);
+}
+
SetupFileHash *newSetupFileHash(void)
{
SetupFileHash *new_hash =
SetupFileHash *newSetupFileHash(void)
{
SetupFileHash *new_hash =
- create_hashtable(
16, 0.75, get_hash_from_key, hash_keys_are_equal
);
+ create_hashtable(
get_hash_from_string, hash_key_strings_are_equal, free, free
);
if (new_hash == NULL)
Fail("create_hashtable() failed -- out of memory");
if (new_hash == NULL)
Fail("create_hashtable() failed -- out of memory");
@@
-2332,7
+2344,7
@@
void freeSetupFileHash(SetupFileHash *hash)
if (hash == NULL)
return;
if (hash == NULL)
return;
- hashtable_destroy(hash
, 1); // 1 == also free values stored in hash
+ hashtable_destroy(hash
);
}
char *getHashEntry(SetupFileHash *hash, char *token)
}
char *getHashEntry(SetupFileHash *hash, char *token)
@@
-2358,12
+2370,12
@@
void setHashEntry(SetupFileHash *hash, char *token, char *value)
Fail("cannot insert into hash -- aborting");
}
Fail("cannot insert into hash -- aborting");
}
-
char *
removeHashEntry(SetupFileHash *hash, char *token)
+
void
removeHashEntry(SetupFileHash *hash, char *token)
{
if (hash == NULL)
{
if (hash == NULL)
- return
NULL
;
+ return;
- re
turn re
move_hash_entry(hash, token);
+ remove_hash_entry(hash, token);
}
#if ENABLE_UNUSED_CODE
}
#if ENABLE_UNUSED_CODE
@@
-4594,6
+4606,12
@@
static boolean AddTreeSetToTreeInfoExt(TreeInfo *tree_node_old, char *tree_dir,
TreeInfo *tree_node_new = getTreeInfoFromIdentifier(*tree_node_first,
tree_subdir_new);
TreeInfo *tree_node_new = getTreeInfoFromIdentifier(*tree_node_first,
tree_subdir_new);
+ // if not found, check if added node is level group or artwork group
+ if (tree_node_new == NULL)
+ tree_node_new = getTreeInfoFromIdentifierExt(*tree_node_first,
+ tree_subdir_new,
+ TREE_NODE_TYPE_GROUP);
+
if (tree_node_new == NULL) // should not happen
return FALSE;
if (tree_node_new == NULL) // should not happen
return FALSE;