aboutsummaryrefslogtreecommitdiff
path: root/src/world.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2016-03-31 17:05:37 -0400
committerFranklin Wei <git@fwei.tk>2016-03-31 17:05:37 -0400
commit207850187986568b17ea9b2d9c29510cb00bf9da (patch)
treeaee87cf74280e8f9dd29aca88d12a638f37b2493 /src/world.c
parentb3699dd5df18db3c060bb88a74c1b05e37154c76 (diff)
downloadnetcosm-207850187986568b17ea9b2d9c29510cb00bf9da.zip
netcosm-207850187986568b17ea9b2d9c29510cb00bf9da.tar.gz
netcosm-207850187986568b17ea9b2d9c29510cb00bf9da.tar.bz2
netcosm-207850187986568b17ea9b2d9c29510cb00bf9da.tar.xz
lots of things
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/world.c b/src/world.c
index a06b08e..8c25d7d 100644
--- a/src/world.c
+++ b/src/world.c
@@ -134,13 +134,13 @@ void world_save(const char *fname)
void *ptr = world_map, *save;
for(unsigned int i = 0; i < world_sz; ++i)
{
- void *key;
- struct room_t *room = hash_iterate(ptr, &save, &key);
- if(!room)
- break;
- ptr = NULL;
- write_string(fd, key);
- write_roomid(fd, &room->id);
+ void *key;
+ struct room_t *room = hash_iterate(ptr, &save, &key);
+ if(!room)
+ break;
+ ptr = NULL;
+ write_string(fd, key);
+ write_roomid(fd, &room->id);
}
close(fd);
@@ -250,13 +250,13 @@ bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz
/* read in the room name -> room map */
world_map = hash_init(world_sz * 2, hash_djb, compare_strings);
-
+
for(unsigned int i = 0; i < world_sz; ++i)
{
- const char *key = read_string(fd);
- room_id id = read_roomid(fd);
- debugf("'%s' -> %d\n", key, id);
- hash_insert(world_map, key, world + id);
+ const char *key = read_string(fd);
+ room_id id = read_roomid(fd);
+ debugf("'%s' -> %d\n", key, id);
+ hash_insert(world_map, key, world + id);
}
close(fd);
@@ -269,7 +269,7 @@ static SIMP_EQUAL(enum direction_t, dir_equal);
/* loads room data (supplied by the world module) into our internal format */
void world_init(const struct roomdata_t *data, size_t sz, const char *name)
{
- debugf("Loading world with %lu rooms.\n", sz);
+ debugf("Loading world with %zu rooms.\n", sz);
world = calloc(sz, sizeof(struct room_t));
world_sz = 0;
world_name = strdup(name);
@@ -400,7 +400,7 @@ room_id room_get_id(const char *uniq_id)
{
struct room_t *room = hash_lookup(world_map, uniq_id);
if(!room)
- return ROOM_NONE;
+ return ROOM_NONE;
else
- return room->id;
+ return room->id;
}