MCPcopy Create free account
hub / github.com/NetHack/NetHack / create_force_field

Function create_force_field

src/region.c:1002–1030  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1000}
1001
1002NhRegion *
1003create_force_field(coordxy x, coordxy y, int radius, long ttl)
1004{
1005 int i;
1006 NhRegion *ff;
1007 int nrect;
1008 NhRect tmprect;
1009
1010 ff = create_region((NhRect *) 0, 0);
1011 nrect = radius;
1012 tmprect.lx = x;
1013 tmprect.hx = x;
1014 tmprect.ly = y - (radius - 1);
1015 tmprect.hy = y + (radius - 1);
1016 for (i = 0; i < nrect; i++) {
1017 add_rect_to_reg(ff, &tmprect);
1018 tmprect.lx--;
1019 tmprect.hx++;
1020 tmprect.ly++;
1021 tmprect.hy--;
1022 }
1023 ff->ttl = ttl;
1024 if (!gi.in_mklev && !svc.context.mon_moving)
1025 set_heros_fault(ff); /* assume player has created it */
1026 /* ff->can_enter_f = enter_force_field; */
1027 /* ff->can_leave_f = enter_force_field; */
1028 add_region(ff);
1029 return ff;
1030}
1031
1032#endif /*0*/
1033

Callers

nothing calls this directly

Calls 3

create_regionFunction · 0.85
add_rect_to_regFunction · 0.85
add_regionFunction · 0.85

Tested by

no test coverage detected