From 324f978e2fe45d2ebb4dc81cd8adfbc45f06604d Mon Sep 17 00:00:00 2001 From: Pawel Kolodziejski Date: Tue, 7 Apr 2009 12:15:12 +0000 Subject: [PATCH] ops --- engine/lua.cpp | 26 +++++++++----------------- engine/textobject.cpp | 2 +- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/engine/lua.cpp b/engine/lua.cpp index 1430f85d426..bada6e9035c 100644 --- a/engine/lua.cpp +++ b/engine/lua.cpp @@ -2385,38 +2385,30 @@ static void KillTextObject() { * in the table in the LUA parameter 2. */ static void ChangeTextObject() { - TextObject *modifyObject, *textObject; + TextObject *textObject; lua_Object tableObj; const char *line; DEBUG_FUNCTION(); textObject = check_textobject(1); - // when called in certain instances (such as don's computer) - // the second parameter is the string and the third is the table if (lua_isstring(lua_getparam(2))) { tableObj = lua_getparam(3); } else tableObj = lua_getparam(2); - modifyObject = TextObjectExists((char *)textObject->name()); - if (!modifyObject) { - if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL) - warning("ChangeTextObject(): Cannot find active text object"); - return; - } - - modifyObject->destroyBitmap(); + textObject->destroyBitmap(); if (lua_istable(tableObj)) - getTextObjectParams(modifyObject, tableObj); - else if (lua_isstring(lua_getparam(2))) { + getTextObjectParams(textObject, tableObj); + + if (lua_isstring(lua_getparam(2))) { line = lua_getstring(lua_getparam(2)); - modifyObject->setText((char *)line); + textObject->setText((char *)line); } - modifyObject->createBitmap(); + textObject->createBitmap(); - lua_pushnumber(modifyObject->getBitmapWidth()); - lua_pushnumber(modifyObject->getBitmapHeight()); + lua_pushnumber(textObject->getBitmapWidth()); + lua_pushnumber(textObject->getBitmapHeight()); } /* Return the "text speed", this option must be handled diff --git a/engine/textobject.cpp b/engine/textobject.cpp index f276584ce85..6e64b1a24a3 100644 --- a/engine/textobject.cpp +++ b/engine/textobject.cpp @@ -156,7 +156,7 @@ void TextObject::createBitmap() { } _textBitmap = new uint8[_font->getHeight() * (_bitmapWidthPtr[j] + 1)]; - memset(_textBitmap, 0, _font->getHeight() * (_bitmapWidthPtr[j] + 1)); + memset(_textBitmap, 0xff, _font->getHeight() * (_bitmapWidthPtr[j] + 1)); // Fill bitmap int startOffset = 0;