From f1f5acc552ab2ee492d37b5f3a74f4e44b09cd22 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Sun, 12 Jan 2020 18:26:00 +0100 Subject: [PATCH] Simplify initializations This is similar to what was reverted in 3011911 but this time should use syntax available even before C++11, tested on Clang with `-std=c++98 -Wall -pedantic`. --- desktop_version/src/Graphics.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 39a2922d..d0e0eebc 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -88,32 +88,26 @@ Graphics::Graphics() resumegamemode = false; //Textboxes! - for (int i = 0; i < 30; i++) - { - textboxclass t; - textbox.push_back(t); - } + textbox.resize(30); ntextbox = 0; //Fading stuff - for (int i = 0; i < 15; i++) - { - fadebars.push_back(0); - } + fadebars.resize(15); + fadeamount = 0; fademode = 0; // initialize everything else to zero backBuffer = NULL; - backboxrect.x = 0, backboxrect.y = 0, backboxrect.w = 0, backboxrect.h = 0; + backboxrect = SDL_Rect(); bcol = 0; bcol2 = 0; - ct.colour = 0; - foot_rect.x = 0, foot_rect.y = 0, foot_rect.w = 0, foot_rect.h = 0; + ct = colourTransform(); + foot_rect = SDL_Rect(); foregrounddrawn = false; foregroundBuffer = NULL; backgrounddrawn = false; - images_rect.x = 0, images_rect.y = 0, images_rect.w = 0, images_rect.h = 0; + images_rect = SDL_Rect(); j = 0; k = 0; m = 0; @@ -121,12 +115,12 @@ Graphics::Graphics() menubuffer = NULL; screenbuffer = NULL; tempBuffer = NULL; - tl.x = 0, tl.y = 0; + tl = point(); towerbuffer = NULL; trinketr = 0; trinketg = 0; trinketb = 0; - warprect.x = 0, warprect.y = 0, warprect.w = 0, warprect.h = 0; + warprect = SDL_Rect(); } Graphics::~Graphics()