From a00261feabc1b0d9fa31879f714edb0eb36c9a70 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Wed, 18 Jun 2008 20:17:33 +0100 Subject: [PATCH] Really fix the stars-going-upwards bug --- src/Menu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Menu.cpp b/src/Menu.cpp index ddbdf35..737a6a9 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -274,11 +274,11 @@ MenuStar::MenuStar() const int screenWidth = OpenGL::GetInstance().GetWidth(); const int screenHeight = OpenGL::GetInstance().GetHeight(); - double x = (double)(rand()%(screenWidth/2) + screenWidth/4); - double y; - do + double x, y; + do { + x = (double)(rand()%(screenWidth/2) + screenWidth/4); y = (double)(rand()%(screenHeight/2) + screenHeight/4); - while (y == 0); + } while (y == 0); pos = Position(x, y); double ratio = (pos.GetY() - screenHeight/2) / (pos.GetX() - screenWidth/2); -- 2.39.2