Ejemplo n.º 1
0
Archivo: dumpprog.c Proyecto: cosin/XYJ
int main(object me,string arg)
{
    object obj;

    seteuid(geteuid(me));

    obj=new(arg);
    if(!obj) return 0;
    dump_prog(obj,1,"dump1");
    dump_prog(obj,2,"dump2");
    destruct (obj);

	return 1;
}
Ejemplo n.º 2
0
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() );
   }
}
Ejemplo n.º 3
0
void init()
{
	object me;

	::init();
	if( interactive(me = this_player()) ) 
	{
		if( (me->query("family/family_name") != "少林派"
		||  me->query("family/generation") > 36
		||  me->query_temp("win_times") < 3)
		&& me->query( "family/master_name") != "觉心" )
		destruct(this_object());
	}
}
Ejemplo n.º 4
0
fasthash_node *fasthash_node_destroy(fasthash_node *node, fasthash_destructor destruct) {
    fasthash_node *temp;
    while (node) {
        temp = node->next;
        if (destruct) {
            destruct(node->data);
        }
        
        free(node->key);
        free(node);
        node = temp;
    }
    return 0;
}
Ejemplo n.º 5
0
void String::StringImplementation::destructString() {
    if (string) {
#if !defined(WITHOUT_THREAD)
        ScopedLock<Mutex> SL_MUTEX(&mutex);
#endif
        for (SIZE i = 0; i < length; ++i)
            destruct(string + i);
        deallocate(string);
        ::operator delete(cstring);
        string = 0;
        cstring = 0;
        length = 0;
    }
}
Ejemplo n.º 6
0
object connect()
{
	object login_ob;
	mixed err;
   
	err = catch(login_ob = new(LOGIN_OB));

	if (err) {
		write("现在有人正在修改使用者连线部份的程式,请待会再来。\n");
		write(err);
		destruct(this_object());
	}
	return login_ob;
}
Ejemplo n.º 7
0
int checking(object me, object ob)
{
	object obj;

	if ( !me->is_fighting() ) {
		obj = new(__DIR__"buqun");
		obj->move(environment(me));
		obj->set("eff_qi", me->query("eff_qi"));
		obj->set("qi", me->query("qi"));
		obj->set("neili", me->query("neili"));
		obj->set("eff_jing", me->query("eff_jing"));
		obj->set("jing", me->query("jing"));
		destruct(me);
	}
static void destroy(
	struct hw_ctx_audio **ptr)
{
	struct hw_ctx_audio_dce112 *hw_ctx_dce112;

	hw_ctx_dce112 = container_of(
		*ptr, struct hw_ctx_audio_dce112, base);

	destruct(hw_ctx_dce112);
	/* release memory allocated for struct hw_ctx_audio_dce112 */
	dm_free(hw_ctx_dce112);

	*ptr = NULL;
}
Ejemplo n.º 9
0
AMVoid	IAccountModel_Destroy(IAccountModel *pAcntModel)
{
	AMAssert(0 != pAcntModel && pAcntModel == pSingleAcntModel);
	DPRINT("IAccountModel_Destroy................Remove Reference %d\n", pAcntModel->iRefCount);
	IAccountModel_Store(pAcntModel);
	pAcntModel->iRefCount--;
	if(0 >= pAcntModel->iRefCount)
	{
		destruct(List, &pAcntModel->listAcnt);
		AMFree(pSingleAcntModel);
		pSingleAcntModel = 0;
		DPRINT("IAccountModel_Destroy.................AcntModle Destroyed\n");
	}
}
Ejemplo n.º 10
0
Archivo: quit.c Proyecto: mudchina/sjsh
int do_drop(object me, object obj)
{
    	//if obj is a self-made fabao, save first...
        //if( obj->query("series_no") && obj->query("fabao") ) obj->save();
           
        if( obj->query("no_drop") ){
                destruct(obj);
                return 0;
        }
        if (obj->move(environment(me))) {
                if( obj->is_character() )
                        message_vision("$N将$n从背上放了下来,躺在地上。\n", me, obj);
                else {
                        message_vision( sprintf("$N丢下一%s$n。\n",     obj->query("unit")), me, obj );
                        if( !obj->query("value") && !obj->value() ) {
                                tell_object(me,"因为这样东西并不值钱,所以人们并不会注意到它的存在。\n");
                                destruct(obj);
                        }
                }
                return 1;
        }
        return 0;
}
Ejemplo n.º 11
0
int do_qian (string arg)
{
  object me = this_player();
  string what;
  int amount;
  string money;
  object ob;

  if (! arg ||
      sscanf (arg,"%s %d %s",what,amount,money) != 3)
    return notify_fail("请使用: qian <押签种类> <数目> <货币>\n");

  if (what != "dqq" &&
      what != "dkq" &&
      what != "xqq" &&
      what != "xkq" &&
      what != "qq" &&
      what != "kq")
    return notify_fail("你要押什么签?\n");

  ob = present (money+"_money", me);
  if (! ob)
    return notify_fail("你身上没有这种货币。\n");
  if (amount < 1)
    return notify_fail("请多押一些钱。\n");
  if (amount > ob->query_amount())
    return notify_fail("你身上的钱不够押。\n");

  if (me->query_temp ("gamble_qian/amount") > 0)
    return notify_fail("你已经押过了。\n");

  if (room_status > 1)
    return notify_fail("现在正在赌呢,稍等片刻。\n");

  me->set_temp("gamble_qian/kind",what);
  me->set_temp("gamble_qian/amount",amount);
  me->set_temp("gamble_qian/money",money);
  message_vision (sprintf("$N拿出%s%s%s,押在%s上。\n",
                          chinese_number(amount),
                          ob->query("base_unit"),
                          ob->query("name"),
                          qians[what]),
                  me);
  if (amount == ob->query_amount())
    destruct (ob);
  else
    ob->add_amount(-amount);

  return 1;
}
Ejemplo n.º 12
0
/// clears both stacks
void TextUndoStack::clear()
{
    destruct();
    lastCoalesceIdStack_.push(0);   // always 1 item

    // point all the indices to BLANK
    changeIndex_ = 0;
    setPersistedIndex(-1); // clearing the undo-stack must result in a non-saved state
    QMapIterator<TextEditorController*, int> itr(controllerIndexMap_);
    while (itr.hasNext()) {
        itr.next();
        controllerIndexMap_.insert( itr.key(), 0 );
    }
}
Ejemplo n.º 13
0
void heart_beat()
{
  int i;
  if(!environment())
  {
    set_heart_beat(0);
    destruct(this_object());
    return;
  }
  if(living(environment()))
  {
    set_heart_beat(0);
    destruct(this_object());
    return;
  }
  if (!alter)
    tell_room(environment(), "Fuerchterlicher Gestank erfuellt den Raum.\n");
  alter++;
  if (!random(10))
  {
    i = random (5);
    if (i==0)
      tell_room(environment(), furzerWESSEN+" Furz stinkt wirklich grauenerregend.\n");
    if (i==1)
      tell_room(environment(), "Du haeltst Dir die Nase zu.\n");
    if (i==2)
      tell_room(environment(), "Widerliche Duenste erfuellen den Raum.\n");
    if (i==3)
      tell_room(environment(), "Der Furz riecht, als wuerde " + furzerWER +" innerlich verfaulen.\n");
    if (i==4)
      tell_room(environment(), "Du musst Dich beinah uebergeben, als " + furzerWESSEN + " Furz in Deine Nase kriecht.\n"); 
  }
  if (alter==45) {
      tell_room(environment(), furzerWESSEN + " widerlicher Furz hat sich endlich verzogen.\n");
      destruct(this_object());
    }
}
Ejemplo n.º 14
0
int main(object me, string arg)
{
	string option, target, msg;

	object obj;

	if (!arg) return notify_fail("╓╕┴ю╕ё╩╜ : dest <╬я╝■╓о├√│╞╗Є╡╡├√>\n" );

	if( sscanf(arg, "-%s %s", option, target)!=2 ) target = arg;

	if( option == "-r" && (string)SECURITY_D->get_status(me)=="(admin)" )
		seteuid(ROOT_UID);
	else
		seteuid(geteuid(me));

	obj = find_object(target);
	if (!obj) obj = present(target, me);
	if (!obj) obj = present(target, environment(me));
	if (!obj) obj = find_object( resolve_path(me->query("cwd"), target) );
	
	if (!objectp(obj)) 
		return notify_fail("├╗╙╨╒т╤∙╬я╝■....бг\n");

	if ( userp(obj) &&  (string)SECURITY_D->get_status(me)!="(admin)" )
		return notify_fail("─у├╗╙╨┤▌╗┘╢╘╖╜╡─╚и╧▐бг\n");
	
	tell_object( me, sprintf("┤▌╗┘╬я╝■г║ %O\n", obj));
	
	msg = "";
	
	if( environment(me)==environment(obj) )
	{
		if( !stringp(msg = me->query("env/msg_dest")) )
			msg = "$N╒┘╗╜│Ў╥╗╕Ў║┌╢┤гм╜л$n═╠├╗┴╦бг\n";
		message_vision(msg + "\n", me, obj);
	}
	else {
		msg = "$N╒┘╗╜│Ў╥╗╕Ў║┌╢┤гм░╤╓▄╬з═╠├╗┴╦бг\n";
		message_vision(msg + "\n", me);
	}
	
	destruct(obj);
	if(obj) 
		write("─у╬▐╖и╜л╒т╕Ў╬я╝■┤▌╗┘бг\n");
	else 
		write("╬я╝■┤▌╗┘│╔╣жбг\n");

	return 1;
}
Ejemplo n.º 15
0
/*
 * close and free the contents of a struct output
 * Note that the output struct is not freed or unlinked here,
 * that is taken care of later.
 */
static INLINE void output_finish(struct object *obj)
{
  struct output *o, *oi;
  struct object *obji;

  debug_malloc_touch(obj);

  o=(struct output *)(obj->storage);

  if (o->obj)
  {
    if(obj==THIS->firstoutput){
      THIS->firstoutput=o->next;
    } else
    for(obji=THIS->firstoutput;obji;obji=oi->next)
    {
      oi=(struct output *)(obji->storage);
      if(oi->next==obj)
      {
       oi->next=o->next;
      }
    }
    if(o->obj->prog)
    {
#ifdef BLOCKING_CLOSE
      apply_low(o->obj,o->set_blocking_offset,0);
      pop_stack();
#endif
      push_int(0);
      apply(o->obj,"set_id",1);
      pop_stack();

      apply(o->obj,"close",0);
      pop_stack();
      if(!THISOBJ->prog)
	Pike_error("Pipe done callback destructed pipe.\n");
      destruct(o->obj);
    }
    free_object(o->obj);
    noutputs--;
    o->obj=NULL;

    THIS->living_outputs--;

    finished_p(); /* Moved by per, one line down.. :) */

    /* free_object(THISOBJ); */		/* What? /Hubbe */
  }
}
Ejemplo n.º 16
0
int  do_sai  (string  arg)
{
    object  me  =  this_player();
    string  what;
    int  amount;
    string  money;
    object  ob;

    if  (!  arg  ||
            sscanf  (arg,"%s %d %s",what,amount,money)  !=  3)
        return  notify_fail("请使用:  sai <押龟种类> <数目> <货币>\n");

    if  (what  !=  "cs"  &&
            what  !=  "qn"  &&
            what  !=  "bl")
        return  notify_fail("你要押什么样的龟?\n");

    ob  =  present  (money+"_money",  me);
    if  (!  ob)
        return  notify_fail("你身上没有这种货币。\n");
    if  (amount  <  1)
        return  notify_fail("请多押一些钱。\n");
    if  (amount  >  ob->query_amount())
        return  notify_fail("你身上的钱不够押。\n");
    if  (amount * (ob->query("base_value")) > 10000 )
        return  notify_fail("你想豪赌啊,拜托!官兵就上来了。\n");

    if  (me->query_temp  ("gamble_gui/amount")  >  0)
        return  notify_fail("你已经押过了。\n");

    if  (room_status  >  1)
        return  notify_fail("现在正在赛龟呢,稍等片刻。\n");

    me->set_temp("gamble_gui/kind",what);
    me->set_temp("gamble_gui/amount",amount);
    me->set_temp("gamble_gui/money",money);
    message_vision  (sprintf("$N拿出%s%s%s放在紫檀龟台上,押%s。\n",
                                                    chinese_number(amount),
                                                    ob->query("base_unit"),
                                                    ob->query("name"),
                                                    guis[what]),
                                    me);
    if  (amount  ==  ob->query_amount())
        destruct  (ob);
    else
        ob->add_amount(-amount);

    return  1;
}
Ejemplo n.º 17
0
do_chop()	{
	object vege;
	if((int) query("pulled") <= 20)
	{
		vege = new(__DIR__"obj/tree");
		if (!vege->move(this_player()))
			{
				write("̫��̫���ˣ�û�����ˣ�����\n");
				destruct(vege);
				return 1;
			}
		write("�㿳��һ��÷��������ڻ��\n");
		add("pulled",1);
		return 1;
	}
Ejemplo n.º 18
0
void jump_away ()
{
  string s;
  object room;
  object me = this_object();
  
  s = sprintf ("/d/qujing/maoying/shanpo%d.c",random(10)+1);
  room = load_object(s);
  message_vision ("ವ�һ����$N������ȥ����\n",me);
  me->move(room);
  if (present("tu jing 6",environment(me)))
    destruct (me);
  else
    message_vision ("$Nವ�һ�����˹�������\n",me);
}
Ejemplo n.º 19
0
int main(object me, string str)
{
	object ob, where, *ob_list;
	int old_size, i;

	if (!str) return notify_fail("指令格式:cleanup <档名>\n"); 

	str = resolve_path(me->query("cwd"), str);
	ob_list = children(str);
	old_size = sizeof(ob_list);
	ob_list->clean_up();
	for(i=0; i<sizeof(ob_list); i++)
		if( ob_list[i] && clonep(ob_list[i]) && !environment(ob_list[i]) )
			destruct(ob_list[i]);
	ob_list -= ({ 0 });
Ejemplo n.º 20
0
// 结束任务的函数
// 直接调用析构函数
void cancel_quest()
{
        // 设置结束时间
        set("finish_time", time());

        // 从QUEST_D中去掉有关这个对象的信息
        QUEST_D->remove_all_information(this_object());

        // 如果没有析构这个任务,则设置标识,然后析构这个任务
        if (! destructing)
        {
                destructing = 1;
                destruct(this_object());
        }
}
Ejemplo n.º 21
0
Archivo: objects.c Proyecto: rmanis/lil
void deep_destruct(object o) {
    mixed *ancestors;
    mixed ancestor;

    if (!o) {
        return;
    }

    ancestors = deep_inherit_list(o);
    foreach (ancestor in ancestors) {
        ancestor = find_object(ancestor);
        if (ancestor) {
            destruct(ancestor);
        }
    }
Ejemplo n.º 22
0
Archivo: cron.c Proyecto: mudchina/fy2
void check_whonature()
{
	mixed *info;
	int i;
	object ob;
	int who=0, nature=0;
	info = call_out_info();
	for(i=0; i<sizeof(info); i++)
	{
	if( "/"+sprintf("%O",info[i][0]) == WHO_D ) who =1;
	if( "/"+sprintf("%O",info[i][0]) == NATURE_D ) nature=1;
	}
	if(!who)
	{
		if(ob=find_object(WHO_D)) destruct(ob);
		call_other(WHO_D,"???");	
	}
        if(!nature)
        {
                if(ob=find_object(NATURE_D)) destruct(ob);
                call_other(NATURE_D,"???");
        }
        return;
}
Ejemplo n.º 23
0
int randommove()
{
        mapping exits;
        string *dirs;
	string thisdir;
        if( !mapp(exits = environment()->query("exits")) ) 
	{
	destruct(this_object());
	return 0;
	}
        dirs = keys(exits);
	thisdir = dirs[random(sizeof(dirs))];
	this_object()->set("last_dir",thisdir);
        command("go " + thisdir);
}
Ejemplo n.º 24
0
int accept_object(object ob, object obj)
{
	object me ;
	//string men ;
	mapping family;

	me = this_object ();
	ob = this_player ();

	if (obj->query("id") == "tuijian xin1" &&
	    ob->query_temp("have_letter") )
	{
		if (ob->query("can_apprentice_tuoba"))
			return notify_fail("还不赶快去找风字门门主拓跋学我光明圣教的入门武功!\n");

   		if (! mapp(family = ob->query("family")))
   		{
			ob->delete_temp("have_letter");

			if ((string)ob->query("gender") == "女性")
				command("say 我明教又得一女中豪杰,真是可"
					"喜可贺!");
			else 
				command("say 我明教又得一英雄好汉,真是可"
					"喜可贺!");

			ob->set("can_apprentice_menzhu", "风字门");

			command("smile");
			tell_object(ob,"接引使者对你说道:光明圣教光明左使手下有天、地、风、雷四门,你先到风字门门主拓跋那里学入门武功吧!\n");
			destruct(obj);
			return 1;
		}

   		if (family["family_name"] != "明教")
		{
			message_vision("$N对$n摇摇头,说道:你已经加入"
				       "其他门派了,不能再入我明教。\n",
				       me, ob);
			return 1;
		} else
			message_vision("$N摇摇头,对$n说道:你已经是我明教"
				       "的人了。\n", me, ob);
	}
        command("?");
        command("say 这东西给我可没有什麽用。");
	return 0;
}
Ejemplo n.º 25
0
int remove() {

// Leto added this 95-04-09
    if (previous_object()) {
        if (this_player(1) &&
            !adminp(geteuid(this_player(1))))
            return 0;
        if (geteuid(previous_object()) != ROOT_UID &&
            geteuid(previous_object()) != geteuid(this_object()) &&
            file_name(previous_object()) != FINGER_D)
            return 0;
    }
    save_data_conn();
    destruct(this_object());
    return 1;
}
    void weak_release() // nothrow
    {
        long new_weak_count;

        {
#if defined(BOOST_HAS_THREADS)
            mutex_type::scoped_lock lock(mtx_);
#endif
            new_weak_count = --weak_count_;
        }

        if(new_weak_count == 0)
        {
            destruct();
        }
    }
Ejemplo n.º 27
0
void init()
{
   int i;
        object* inv;
        object me = this_player();
        inv = all_inventory(this_player());
        for(i=0; i<sizeof(inv); i++) 
        {
                if( inv[i]->query_unique() ) {
message_vision(HIW"突然间,$n化一道白光飞去,无影无踪!\n"NOR,me,inv[i]);
                        destruct(inv[i]);
                }
        }
        add_action("do_put", "put");
        set("no_clean_up", 1);
}
Ejemplo n.º 28
0
int do_put(string arg)
{
        object shendian, ob, me;
        me=this_player();

        if( !arg)
                return notify_fail("你要放什么东西?\n");

if( !arg || arg!="niepan" || !(ob=present(arg, me)))
                return notify_fail("似乎神台上放不下这个东西。\n");

    message_vision(HIY"$N将$n放在神台上,一道五彩光芒洒了下来。\n"NOR, me, ob);
                destruct(ob);
      call_out( "shendian_stage", 3, me, 0 );
    return 1;
}
Ejemplo n.º 29
0
 Text& Text::operator=(const Text& sa){
   if(this != &sa){
     destruct();
     _data = new Line*[_size = sa._size];
     _textlines = sa._textlines;
     for(unsigned int i=0;i<_size;i++){
       if(_data[i]&& sa._data[i]){
         _data[i] = new Line(*sa._data[i]);
       }
       else{
         _data[i] = (Line*)0;
       }
     }
   }
   return *this;
 }
Ejemplo n.º 30
0
  void call_dtors()
  {
     ctor destruct;

     	// Please keep __dtor_list aligned in the linker script
      void *dtors = (void*)(((uint32)&__dtor_list));
	     
	   while  (  ((uint32)dtors) < ((uint32)&__dtor_end))
	   {
	     void **indirect = (void**)dtors;
	     destruct = (ctor)(*indirect);
	     destruct();	
	     dtors = (void*)(dtors + sizeof(void*));
	   }

  }