172 |
|
|
173 |
if (lua_isnil(L, 3)) |
if (lua_isnil(L, 3)) |
174 |
fl = 0; |
fl = 0; |
175 |
else if (is_object(L,3)) |
else if (is_object(L,3)) { |
176 |
fl = static_cast<world::Floor*>(lua_touserdata(L,3)); |
fl = static_cast<world::Floor*>(lua_touserdata(L,3)); |
177 |
else |
if( ! fl) |
178 |
|
lua_error(L, "object is no valid floor"); |
179 |
|
} else |
180 |
lua_error(L, "argument 3 must be an Object or nil"); |
lua_error(L, "argument 3 must be an Object or nil"); |
181 |
world::SetFloor(GridPos(x,y), fl); |
world::SetFloor(GridPos(x,y), fl); |
182 |
return 0; |
return 0; |
188 |
int x = int(lua_tonumber(L, 1)); |
int x = int(lua_tonumber(L, 1)); |
189 |
int y = int(lua_tonumber(L, 2)); |
int y = int(lua_tonumber(L, 2)); |
190 |
world::Item *it = dynamic_cast<world::Item*>(to_object(L, 3)); |
world::Item *it = dynamic_cast<world::Item*>(to_object(L, 3)); |
191 |
|
if( ! it) |
192 |
|
lua_error(L, "object is no valid item"); |
193 |
world::SetItem(GridPos(x,y), it); |
world::SetItem(GridPos(x,y), it); |
194 |
return 0; |
return 0; |
195 |
} |
} |
199 |
int x = int(lua_tonumber(L, 1)); |
int x = int(lua_tonumber(L, 1)); |
200 |
int y = int(lua_tonumber(L, 2)); |
int y = int(lua_tonumber(L, 2)); |
201 |
world::Stone *st = dynamic_cast<world::Stone*>(to_object(L, 3)); |
world::Stone *st = dynamic_cast<world::Stone*>(to_object(L, 3)); |
202 |
|
if( ! st) |
203 |
|
lua_error(L, "object is no valid stone"); |
204 |
world::SetStone(GridPos(x,y), st); |
world::SetStone(GridPos(x,y), st); |
205 |
return 0; |
return 0; |
206 |
} |
} |
219 |
double x = lua_tonumber(L,1); |
double x = lua_tonumber(L,1); |
220 |
double y = lua_tonumber(L,2); |
double y = lua_tonumber(L,2); |
221 |
world::Actor *ac = dynamic_cast<world::Actor*>(to_object(L, 3)); |
world::Actor *ac = dynamic_cast<world::Actor*>(to_object(L, 3)); |
222 |
|
if( ! ac) |
223 |
|
lua_error(L, "object is no valid actor"); |
224 |
world::AddActor(x, y, ac); |
world::AddActor(x, y, ac); |
225 |
return 0; |
return 0; |
226 |
} |
} |