void UDoor::toggle() { const Items::DoorDesc* dd = static_cast<const Items::DoorDesc*>( &itemdesc( ) ); unsigned short oldx = x, oldy = y; set_dirty(); if ( is_open() ) { if ( dd->graphic ) graphic = dd->graphic; else graphic = static_cast<u16>( objtype_ ); x -= dd->xmod; y -= dd->ymod; } else { graphic = dd->open_graphic; x += dd->xmod; y += dd->ymod; } MoveItemWorldPosition( oldx, oldy, this, NULL ); send_item_to_inrange( this ); }
bool UDoor::is_open() const { const Items::DoorDesc* dd = static_cast<const Items::DoorDesc*>( &itemdesc( ) ); if ( graphic == dd->open_graphic ) return true; else return false; }
void UArmor::set_onhitscript( const std::string& scriptname ) { if ( scriptname.empty() ) { onhitscript_.clear(); } else { onhitscript_.config( scriptname, itemdesc().pkg, "scripts/items/", true ); } }