本文整理汇总了C++中set_target函数的典型用法代码示例。如果您正苦于以下问题:C++ set_target函数的具体用法?C++ set_target怎么用?C++ set_target使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_target函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_move
void on_move( object src ) {
::on_move( src );
if( !src ) return;
if( !solid && !environment()->query_container() ) {
object old_targ;
old_targ = query_target();
set_target(this_object());
if( this_player() )
this_player()->msg_local( "~CACT~Subt ~vertdissipate as ~name ~verbpour it out.~CDEF" );
set_target( old_targ );
destruct( this_object() );
}
}
示例2: on_cast
varargs int on_cast(mapping param) {
object jack, ai;
int bonus = param["caster"]->skill_check("magic.mana.fire",50,60,70,80,90,100);
set_actor(param["caster"]);
set_target(param["target"]);
param["caster"]->msg_local("~[030~Subt ~verttake on a life of ~post own and ~vertbegin to float next to ~name.~CDEF");
destruct(param["target"]);
jack = clone_object("/monsters/summon/jackolantern");
jack->move(environment(param["caster"]));
jack->validate_position();
// heal pumpkin man
jack->set_stat("con",jack->query_stat("con")+(bonus/2));
jack->set_stat("int",jack->query_stat("int")+(bonus/2));
jack->set_stat("spd",jack->query_stat("spd")+bonus);
jack->set_stat("wil",jack->query_stat("wil")+bonus);
jack->set_hp(jack->query_max_hp());
jack->set_mana(jack->query_max_mana());
jack->set_endurance(jack->query_max_endurance());
// unfortunately, on_hire is a bit flaky right now and only works if the caster is
// set to this_player()
ai = present_clone("/ai/worker",jack);
ai->on_hire();
command("follow "+(param["caster"]->query_name()),jack);
jack->set_time_to_live( max(20,param["caster"]->get_skill_roll("magic.faith.blessing")/2) );
return 1;
}
示例3: main
main(string param) {
object ob, *obs, i, n, env;
string s;
ADM_CHECK
if(!param) {
msg("==> [Format] nuke <objects>");
return 1;
}
ob = find_thing(param);
if(!ob) {
notify_fail("==> [Error] Unable to locate object "+param+"\n");
return 0;
}
obs = all_inventory( ob );
set_target(ob);
this_player()->msg_local("~CBRT~Name ~verbclap ~poss hands. A heavy banging sound is heard, like a cannon-shot.~CDEF");
foreach( ob : obs ) {
if( !ob->query_is_player() )
destruct(ob);
}
return 1;
}
示例4: set_target
void Camera::init_camera (Actor *target)
{
m_frame.x = 0;
m_frame.y = 0;
if (target)
{
set_target (target);
}
m_frame.w = Constants::WINDOW_WIDTH;
m_frame.h = Constants::WINDOW_HEIGHT;
PRINT_TRACE (1, "Ouverture de la fenetre (de taille %d*%d)", m_frame.w, m_frame.h)
if (!m_initialized)
{
if (Constants::FULL_SCREEN == 0)
{
m_window = new sf::RenderWindow (sf::VideoMode (m_frame.w, m_frame.h, 32), "SuperBadbar");
}
else
{
m_window = new sf::RenderWindow (sf::VideoMode (m_frame.w, m_frame.h, 32), "SuperBadbar", sf::Style::Fullscreen);
}
EventKeyboard::initEventKeyboard();
}
m_target = target;
#ifdef DEBUG_COLL
m_green_coll = new Surface (PIC_DEBUG_R + "green_col.png");
m_red_coll = new Surface (PIC_DEBUG_R + "red_col.png");
#endif
m_initialized = true;
}
示例5: get_target_range_radial
void
AATPoint::set_target(const fixed range, const fixed radial,
const TaskProjection &proj)
{
fixed oldrange = fixed_zero;
fixed oldradial = fixed_zero;
get_target_range_radial(oldrange, oldradial);
const FlatPoint fprev = proj.fproject(get_previous()->get_location_remaining());
const FlatPoint floc = proj.fproject(get_location());
const FlatLine flb (fprev,floc);
const FlatLine fradius (floc,proj.fproject(get_location_min()));
const fixed bearing = fixed_minus_one * flb.angle().value_degrees();
const fixed radius = fradius.d();
fixed swapquadrants = fixed_zero;
if (positive(range) != positive(oldrange))
swapquadrants = fixed(180);
const FlatPoint ftarget1 (fabs(range) * radius *
cos((bearing + radial + swapquadrants)
/ fixed(360) * fixed_two_pi),
fabs(range) * radius *
sin( fixed_minus_one * (bearing + radial + swapquadrants)
/ fixed(360) * fixed_two_pi));
const FlatPoint ftarget2 = floc + ftarget1;
const GeoPoint targetG = proj.funproject(ftarget2);
set_target(targetG, true);
}
示例6: on_use
int on_use( object target ) {
object bldg;
object ilock, idoor;
if( target ) return 0;
bldg = query_condemn_obj();
if( !bldg ) {
msg( "The building has disappeared! This condemnation isn't valid anymore." );
destruct(this_object());
return 1;
}
if( condemn_time > time() ) {
msg( "The warning time hasn't expired yet. You can't enforce the condemnation." );
return 1;
}
foreach( ilock : deep_inventory(bldg) ) {
if( ilock->query_is_lock() ) destruct(ilock);
}
foreach( idoor: all_inventory(environment(bldg)) ) {
if( idoor->query_host() == bldg )
foreach( ilock: all_inventory(idoor) )
if( ilock->query_is_lock() ) destruct(ilock);
}
set_target(bldg);
this_player()->msg_local( "~CACT~Name ~verbenforce the condemnation on ~targ by uprooting the sign and whacking the building with it. Ka-boom!~CDEF" );
msg( "All locks have been removed from the building, and anyone can raze it now." );
bldg->set_owner( 0 );
destruct( this_object() );
return 1;
}
示例7: exportData
void ProtoBufExport::Include(clang::FileEntry const *origin, clang::FileEntry const *target) {
exportData([&](ct::proto::Envelope &env) {
auto incl = env.mutable_include();
incl->set_origin(origin->getName());
incl->set_target(target->getName());
});
}
示例8: on_cast
varargs int on_cast(mapping param) {
object decoy;
int hp;
// debit hp first
hp = to_int(param["caster"]->query_hp() * 0.95);
param["caster"]->add_hp( -hp );
// check for existing decoys... backlash
decoy = present_clone( "/monsters/summon/decoy", environment(param["caster"]) );
if( decoy ) {
param["caster"]->msg_local( "~[030~Name ~verbstand completely still until ~pron ~verbis knocked down by a green blast.~CDEF" );
msg_object( param["caster"], "~CWRNThere is already a decoy spirit at this location. Your spell has backfired.~CDEF" );
param["caster"]->set_stance( ST_LYING );
return 1;
}
// actually create the pet now
decoy = clone_object( "/monsters/summon/decoy" );
decoy->move(environment(param["caster"]));
decoy->set_coord(WALK_DAEMON->query_random_adjacent(param["caster"]));
decoy->validate_position();
decoy->setup( param["caster"]->query_name(), hp );
set_actor(param["caster"]);
set_target(decoy);
param["caster"]->msg_local( "~[030~Name ~verbstand completely still as ~targ ~vertfade into view beside ~obje.~CDEF" );
return 1;
}
示例9: m_target
Messenger::Messenger(Handler* target_, Looper* looper_, status_t* result)
: m_target(NULL),
m_looper(NULL)
{
status_t sts = set_target(target_, looper_);
if(result) *result = sts;
}
示例10: parse_probe_event_argv
static int parse_probe_event_argv(int argc, const char **argv)
{
int i, len, ret, found_target;
char *buf;
found_target = set_target(argv[0]);
if (found_target < 0)
return found_target;
if (found_target && argc == 1)
return 0;
/* Bind up rest arguments */
len = 0;
for (i = 0; i < argc; i++) {
if (i == 0 && found_target)
continue;
len += strlen(argv[i]) + 1;
}
buf = zalloc(len + 1);
if (buf == NULL)
return -ENOMEM;
len = 0;
for (i = 0; i < argc; i++) {
if (i == 0 && found_target)
continue;
len += sprintf(&buf[len], "%s ", argv[i]);
}
params.mod_events = true;
ret = parse_probe_event(buf);
free(buf);
return ret;
}
示例11: main
int main(string arg) {
object who, victim;
WIZ_CHECK
if( !arg )
return notify_fail("==> [Format] frotz victim\n");
victim = find_player(arg);
if( !victim )
return notify_fail("I can't find any such player '"+arg+"' to zap.\n");
AUDIO_DAEMON->sfx_mud("thunder.wav");
foreach( who : users() ) {
set_actor( this_player() );
set_target( victim );
set_listener( who );
msg_object(who,"~CTITFROTZ! ~CBRT~Name ~verbstrike ~targ with lightning.~CDEF");
}
victim->set_env_var( "cause_of_death", "was frotzed by "+capitalize(this_player()->query_name())+"." );
victim->add_hp( this_player()->query_level() / -4);
return 1;
}
示例12: remove_armour
varargs int remove_armour(int silent) {
object owner = environment(this_object()), obj;
if (!worn)
return 0;
if (!owner->query_is_living())
return 0;
set_target(this_object());
// check if they're wearing anything over this item
foreach ( obj : all_inventory(owner) ) {
if( obj->query_is_apparel() &&
(obj->query_body_parts() & query_body_parts()) &&
obj->query_layer() > layer) {
if( !silent )
msg("You can't remove ~targ, without first removing "+obj->query_name()+".");
return 0;
}
}
// returns true if on_remove() has been defined, so false means we have
// to do this our selves as well
if (this_object()->on_remove() == 0) {
if (this_object()->query_cursed()) {
if (!silent)
msg_object(owner,"You can't remove ~targ! It appears to be cursed!");
} else {
if (!silent)
owner->msg_local("~Name ~verbremove ~targ.");
set_worn(0);
owner->recalc();
return 1;
}
}
}
示例13: bcf_srs
bcf_srs(bcf_srs_helper::init &init) : bcf_srs() {
if (!init.region.empty()) {
if (init.useIndex)
set_region(init.region);
else
set_target(init.region);
}
}
示例14: kms_base_hub_link_src_pad
static gboolean
kms_base_hub_link_src_pad (KmsBaseHub * mixer, const gchar * gp_name,
const gchar * template_name, GstElement * internal_element,
const gchar * pad_name, gboolean remove_on_unlink)
{
GstPad *gp, *target;
gboolean ret;
if (GST_OBJECT_PARENT (internal_element) != GST_OBJECT (mixer)) {
GST_ERROR_OBJECT (mixer, "Cannot link %" GST_PTR_FORMAT " wrong hierarchy",
internal_element);
return FALSE;
}
target = gst_element_get_static_pad (internal_element, pad_name);
if (target == NULL) {
target = gst_element_get_request_pad (internal_element, pad_name);
if (target != NULL && remove_on_unlink) {
g_signal_connect (G_OBJECT (target), "unlinked",
G_CALLBACK (remove_unlinked_pad), NULL);
}
}
if (target == NULL) {
GST_ERROR_OBJECT (mixer, "Cannot get target pad");
return FALSE;
}
gp = gst_element_get_static_pad (GST_ELEMENT (mixer), gp_name);
if (gp == NULL) {
GstPadTemplate *templ;
templ =
gst_element_class_get_pad_template (GST_ELEMENT_CLASS
(G_OBJECT_GET_CLASS (mixer)), template_name);
gp = gst_ghost_pad_new_from_template (gp_name, target, templ);
if (GST_STATE (mixer) >= GST_STATE_PAUSED
|| GST_STATE_PENDING (mixer) >= GST_STATE_PAUSED
|| GST_STATE_TARGET (mixer) >= GST_STATE_PAUSED) {
gst_pad_set_active (gp, TRUE);
}
ret = gst_element_add_pad (GST_ELEMENT (mixer), gp);
if (!ret) {
g_object_unref (gp);
}
} else {
ret = set_target (gp, target);
g_object_unref (gp);
}
g_object_unref (target);
return ret;
}
示例15: main
int main(string str) {
string what, as_str;
int quality, fail;
object ob, as;
if( !str ) {
notify_fail("What do you want to sign?\n");
return 0;
}
/* forging commented out for now
if (sscanf( str, "%s as %s", what, as_str ) < 2) {
what = str;
as = this_player();
} else {
as = find_player(as_str);
if (!as)
as = present(as_str,environment(this_player()));
if (!as || !as->query_is_living()) {
notify_fail("I don't know who you mean by '"+str+"'.");
return 0;
}
}
*/
what=str;
as=this_player();
ob = single_present( what, this_player() );
if( !ob ) ob = single_present( str, environment(this_player()) );
if( !ob ) {
notify_fail("I don't know what you mean by "+str+"\n");
return 0;
}
// quality is indication of how much it looks right
// won't look right if you're tired
if (as == this_player()) {
quality = 100;
if (this_player()->query_endurance() < this_player()->query_max_endurance())
quality = quality - this_player()->query_max_endurance() + this_player()->query_endurance();
} else {
quality = 1;
}
if( (fail = ob->on_sign(as->query_name(), quality)) > 0) {
set_target(ob);
this_player()->msg_local("~CACT~Name ~verbsign ~targ.~CDEF");
this_player()->set_doing("signing ~targ", this_object());
return 1;
} else {
switch(fail) {
case HAS_SIGNED: notify_fail("You've already signed it.\n"); break;
case CANT_EDIT: //fall through
default: notify_fail("You can't sign that.\n"); break;
}
return 0;
}
}