本文整理汇总了C++中Thing::Move方法的典型用法代码示例。如果您正苦于以下问题:C++ Thing::Move方法的具体用法?C++ Thing::Move怎么用?C++ Thing::Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thing
的用法示例。
在下文中一共展示了Thing::Move方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
const void Get::Run( Character* character, const string& cmd, const string& arg ) const
{
Thing* object = NULL;
Thing* target = NULL;
string args, sobj, star;
if ( character )
{
args = arg;
sobj = Utils::Argument( args );
star = Utils::Argument( args );
if ( sobj.empty() )
{
character->Send( "Get what?" CRLF );
return;
}
// No 'from' target specified, so search the room
if ( star.empty() )
{
object = Handler::FindThing( sobj, THING_TYPE_OBJECT, HANDLER_SCOPE_LOCATION, character );
if ( object )
{
character->Send( "You get " + object->gDescription( THING_DESCRIPTION_SHORT ) + "." + CRLF );
character->gContainer()->Send( character->gName() + " gets " + object->gDescription( THING_DESCRIPTION_SHORT ) + "." + CRLF, character );
object->Move( character->gContainer(), character );
}
else
{
character->Send( "There is no " + arg + " here." CRLF );
return;
}
}
else
{
target = Handler::FindThing( star, THING_TYPE_OBJECT, HANDLER_SCOPE_LOC_INV, character );
if ( !target )
{
character->Send( "There is no " + star + " here." CRLF );
return;
}
object = Handler::FindThing( sobj, THING_TYPE_OBJECT, HANDLER_SCOPE_INVENTORY, target );
if ( object )
{
character->Send( "You get " + object->gDescription( THING_DESCRIPTION_SHORT ) + " from " + target->gDescription( THING_DESCRIPTION_SHORT ) + "." CRLF );
character->gContainer()->Send( character->gName() + " gets " + object->gDescription( THING_DESCRIPTION_SHORT ) + " from " + target->gDescription( THING_DESCRIPTION_SHORT )+ "." CRLF, character );
object->Move( target, character );
}
else
{
character->Send( "There is no " + sobj + " inside the " + target->gDescription( THING_DESCRIPTION_SHORT ) + "." CRLF );
return;
}
}
}
return;
}