From 04855da25998f0d4069223e877eacb3b10589c73 Mon Sep 17 00:00:00 2001 From: Chris Laurel Date: Thu, 4 Sep 2008 21:00:08 +0000 Subject: [PATCH] Committing a patch from Julien Woillez that fixes a bug in the celx function celestia:getscreendimension; width and height were incorrectly computed when the viewport corner wasn't the origin. Also fixed an uninitialized variable warning from the compiler. --- src/celestia/celx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/celestia/celx.cpp b/src/celestia/celx.cpp index 7880be71..77442fa0 100644 --- a/src/celestia/celx.cpp +++ b/src/celestia/celx.cpp @@ -1653,8 +1653,8 @@ int celestia_getscreendimension(lua_State* l) // Get the dimensions of the current viewport GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); - lua_pushnumber(l, viewport[2]-viewport[0]); - lua_pushnumber(l, viewport[3]-viewport[1]); + lua_pushnumber(l, viewport[2]); + lua_pushnumber(l, viewport[3]); return 2; } @@ -1973,7 +1973,7 @@ static int celestia_setconstellationcolor(lua_State* l) lua_pushnil(l); while (lua_next(l, -2) != 0) { - const char* constellation; + const char* constellation = NULL; if (lua_isstring(l, -1)) { constellation = lua_tostring(l, -1);