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.
This commit is contained in:
Chris Laurel 2008-09-04 21:00:08 +00:00
parent b1cb2fdebf
commit 04855da259

View file

@ -1653,8 +1653,8 @@ int celestia_getscreendimension(lua_State* l)
// Get the dimensions of the current viewport // Get the dimensions of the current viewport
GLint viewport[4]; GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport); glGetIntegerv(GL_VIEWPORT, viewport);
lua_pushnumber(l, viewport[2]-viewport[0]); lua_pushnumber(l, viewport[2]);
lua_pushnumber(l, viewport[3]-viewport[1]); lua_pushnumber(l, viewport[3]);
return 2; return 2;
} }
@ -1973,7 +1973,7 @@ static int celestia_setconstellationcolor(lua_State* l)
lua_pushnil(l); lua_pushnil(l);
while (lua_next(l, -2) != 0) while (lua_next(l, -2) != 0)
{ {
const char* constellation; const char* constellation = NULL;
if (lua_isstring(l, -1)) if (lua_isstring(l, -1))
{ {
constellation = lua_tostring(l, -1); constellation = lua_tostring(l, -1);