From: Christian Heller Date: Sun, 12 May 2013 22:00:27 +0000 (+0200) Subject: Use pointers instead of putting the whole struct on the stack. X-Git-Tag: tce~1307 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/foo.html?a=commitdiff_plain;h=2467a76b53f78815d2233d12ba9e896b59db49f5;p=plomrogue Use pointers instead of putting the whole struct on the stack. --- diff --git a/roguelike.c b/roguelike.c index 4bc6f74..44082d2 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); }