home · contact · privacy
Restructured main() start. Start with empty log.
[plomrogue] / roguelike.c
index c5c13094c59e3439560fe0e0312520e24d387cdc..0521ae953e818299c41bf6b461649cfbd347d527 100644 (file)
@@ -55,7 +55,7 @@ void write_uint32_bigendian(uint32_t x, FILE * file) {
   fputc(d, file); }
 
 void load_game(struct World * world) {
-// Load seed integer from seed file.
+// Load game data from game file.
   FILE * file = fopen("savefile", "r");
   world->seed = read_uint32_bigendian(file);
   world->turn = read_uint32_bigendian(file);
@@ -66,7 +66,7 @@ void load_game(struct World * world) {
   fclose(file); }
 
 void save_game(struct World * world) {
-// Save seed integer to seed file.
+// Save game data to game file.
   FILE * file = fopen("savefile", "w");
   write_uint32_bigendian(world->seed, file);
   write_uint32_bigendian(world->turn, file);
@@ -220,6 +220,10 @@ void player_wait (struct World * world) {
 
 int main (int argc, char *argv[]) {
   struct World world;
+  init_keybindings(&world);
+
+  world.log = calloc(1, sizeof(char));
+  update_log (&world, " ");
   struct Player player;
   world.player = &player;
   struct Monster monster;
@@ -234,10 +238,6 @@ int main (int argc, char *argv[]) {
     world.seed = time(NULL);
     world.turn = 1; }
   rrand(1, world.seed);
-
-  init_keybindings(&world);
-  world.log = calloc(1, sizeof(char));
-  update_log (&world, "Start!");
   struct Map map = init_map();
   world.map = ↦