MCPcopy Index your code
hub / github.com/NetHack/NetHack / l_obj_placeobj

Function l_obj_placeobj

src/nhlobj.c:412–435  ·  view source on GitHub ↗

Place an object on the map at (x,y). local o = obj.new("rock"); o:placeobj(u.ux, u.uy); */

Source from the content-addressed store, hash-verified

410 local o = obj.new("rock");
411 o:placeobj(u.ux, u.uy); */
412staticfn int
413l_obj_placeobj(lua_State *L)
414{
415 int argc = lua_gettop(L);
416 struct _lua_obj *lo = l_obj_check(L, 1);
417 coordxy x, y;
418
419 if (argc != 3)
420 nhl_error(L, "l_obj_placeobj: Wrong args");
421
422 x = (coordxy) luaL_checkinteger(L, 2);
423 y = (coordxy) luaL_checkinteger(L, 3);
424 cvt_to_abscoord(&x, &y);
425
426 lua_pop(L, 3);
427
428 if (lobj_is_ok(lo)) {
429 obj_extract_self(lo->obj);
430 place_object(lo->obj, x, y);
431 newsym(x, y);
432 }
433
434 return 0;
435}
436
437RESTORE_WARNING_UNREACHABLE_CODE
438

Callers

nothing calls this directly

Calls 6

l_obj_checkFunction · 0.85
nhl_errorFunction · 0.85
cvt_to_abscoordFunction · 0.85
obj_extract_selfFunction · 0.85
place_objectFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected