// open a door int Script::openDoor(lua_State* L){ short x = (short)luaL_checknumber(L, 1); short y = (short)luaL_checknumber(L, 2); Vector2D pos = Vector2D(x,y); string direction = string(luaL_checkstring(L, 3)); Direction dir = TOP; if (direction == "TOP") dir = TOP; else if (direction == "RIGHT") dir = RIGHT; else if (direction == "BOTTOM") dir = BOTTOM; else if (direction == "LEFT") dir = LEFT; else cerr << "openDoor: wrong direction"; Door* d = wrld.getDoor(Vector2D(x,y), dir); if (d == NULL){ cerr << "openDoor: No Door!"; return 0; } d->setType(0); if(d->getScript() != NULL){ scr.call(OnOpen, d->getScript(), Vector2D(x,y)); } d->setClosed(false); //update visibility wrld.update_visibility(d->getPosition()); wrld.update_visibility(d->getPosition2()); return 0; }