X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=roguelike.c;h=44995457b69247e9b96513cb27a6acde063c698d;hb=478bf71176d67ec2528a722b763d32dbd3b32782;hp=4bc6f74f6ef2ada3da10759d5361502128fd81b3;hpb=de5e703e644f824d7d688e64def1afb554675b13;p=plomrogue
diff --git a/roguelike.c b/roguelike.c
index 4bc6f74..4499545 100644
--- a/roguelike.c
+++ b/roguelike.c
@@ -106,8 +106,8 @@ void draw_text_from_bottom (struct Win * win, char * text) {
void draw_log (struct Win * win) {
// Draw log text from world struct in win->data from bottom to top.
- struct World world = * (struct World *) win->data;
- draw_text_from_bottom(win, world.log); }
+ struct World * world = (struct World *) win->data;
+ draw_text_from_bottom(win, world->log); }
void draw_map (struct Win * win) {
// Draw map determined by win->data Map struct into window. Respect offset.
@@ -130,8 +130,8 @@ void draw_map (struct Win * win) {
void draw_info (struct Win * win) {
// Draw info window by appending win->data integer value to "Turn: " display.
- struct World world = * (struct World *) win->data;
- int count = world.turn;
+ struct World * world = (struct World *) win->data;
+ int count = world->turn;
char text[100];
snprintf(text, 100, "Turn: %d", count);
draw_with_linebreaks(win, text, 0); }
@@ -338,15 +338,12 @@ int main () {
struct Win win_keys = init_window(&win_meta, "Keys");
win_keys.draw = draw_keys_window;
win_keys.data = &world;
-
struct Win win_map = init_window(&win_meta, "Map");
win_map.draw = draw_map;
win_map.data = &world;
-
struct Win win_info = init_window(&win_meta, "Info");
win_info.draw = draw_info;
win_info.data = &world;
-
struct Win win_log = init_window(&win_meta, "Log");
win_log.draw = draw_log;
win_log.data = &world;