[Moeng-cvs] BBRpg/src script.cpp,1.18,1.19
Status: Alpha
Brought to you by:
b_lindeijer
From: Bjørn L. <b_l...@us...> - 2007-02-08 17:51:59
|
Update of /cvsroot/moeng/BBRpg/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24535 Modified Files: script.cpp Log Message: Added some sanity checks to prevent crashing and adapted three for loops to Lua 5.1. Probably a lot more will need fixing though. Index: script.cpp =================================================================== RCS file: /cvsroot/moeng/BBRpg/src/script.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** script.cpp 7 Feb 2007 17:50:31 -0000 1.18 --- script.cpp 8 Feb 2007 17:51:49 -0000 1.19 *************** *** 834,837 **** --- 834,838 ---- if (found_bitmap) { + console.log(CON_LOG, CON_ALWAYS, "Loaded bitmap %s", name); return putLuaArguments(L, "b", found_bitmap); } else { *************** *** 952,956 **** if (map) { Tile* tile = map->mapLayers[0]->getTile(Point(x, y)); ! if (tile) { char *tileTypeName = tile->getType()->getName(); return putLuaArguments(L, "si", tileTypeName, tile->obstacle); --- 953,957 ---- if (map) { Tile* tile = map->mapLayers[0]->getTile(Point(x, y)); ! if (tile && tile->getType()) { char *tileTypeName = tile->getType()->getName(); return putLuaArguments(L, "si", tileTypeName, tile->obstacle); *************** *** 977,981 **** TileType *type = tileRepository->getTileType(tileName); Tile *tile = map->mapLayers[0]->getTile(Point(x, y)); ! if (tile) tile->setType(type); return 0; } --- 978,982 ---- TileType *type = tileRepository->getTileType(tileName); Tile *tile = map->mapLayers[0]->getTile(Point(x, y)); ! if (tile) tile->setType(type); return 0; } *************** *** 1017,1021 **** int object_gettable(lua_State *L) { ! if (lua_isstring(L, -1)) { const char *index = lua_tostring(L, -1); // table key --- 1018,1022 ---- int object_gettable(lua_State *L) { ! if (lua_isstring(L, -1)) { const char *index = lua_tostring(L, -1); // table key |