コード例 #1
0
ファイル: seen.c プロジェクト: worldwise001/ircbot
void parse(irccfg_t * info, msg_t * data)
{
	if (data->sender != NULL && index(data->sender, '!') != NULL)
		add_event(info->tid, data);
	bot_t temp = bot_command(data->message);
	if (temp.command != NULL)
	{
		if (strcasecmp(temp.command, "last") == 0)
		{
			field_t target = get_target(data);
			if (temp.args == NULL)
				respond(info, "PRIVMSG %s :Syntax: %slast <nickname>\n", target.field, SENTINEL);
			else
			{
				char nick[CFG_FLD+1];
				memset(nick, 0, CFG_FLD+1);
				int length = strlen(temp.args);
				
				if (index(temp.args, ' ') != NULL)
					length = index(temp.args, ' ') - temp.args;
				if (length > CFG_FLD) length = CFG_FLD;
					strncpy(nick, temp.args, length);
				
				find_target_last(info, nick, target.field);
			}
		}
		if (strcasecmp(temp.command, "seen") == 0)
		{
			field_t target = get_target(data);
			field_t snick = get_nick(data->sender);
			if (temp.args == NULL)
				respond(info, "PRIVMSG %s :Syntax: %sseen <nickname>\n", target.field, SENTINEL);
			else
			{
				char nick[CFG_FLD+1];
				memset(nick, 0, CFG_FLD+1);
				int length = strlen(temp.args);

				if (index(temp.args, ' ') != NULL)
					length = index(temp.args, ' ') - temp.args;
				if (length > CFG_FLD) length = CFG_FLD;
					strncpy(nick, temp.args, length);

				if (strcasecmp(nick, snick.field) == 0)
					respond(info, "PRIVMSG %s :%s, look in a mirror\n", target.field, snick.field);
				else
					find_target_seen(info, nick, target.field);
			}
		}
	}
}
コード例 #2
0
void talk_function::lead_to_safety( npc &p )
{
    const auto mission = mission::reserve_new( mission_type_id( "MISSION_REACH_SAFETY" ), -1 );
    mission->assign( g->u );
    p.goal = mission->get_target();
    p.set_attitude( NPCATT_LEAD );
}
コード例 #3
0
	void	as_environment::set_variable (
	    const tu_string &varname,
	    const as_value &val,
	    const array<with_stack_entry>& with_stack )
	// Given a path to variable, set its value.
	{
		IF_VERBOSE_ACTION ( log_msg ( "-------------- %s = %s\n", varname.c_str(), val.to_string() ) ); //xxxxxxxxxx
		// Path lookup rigamarole.
		character	*target = get_target();
		tu_string	path;
		tu_string	var;

		if ( parse_path ( varname, &path, &var ) )
		{
			target = cast_to<character> ( find_target ( path.c_str() ) );

			if ( target )
			{
				target->set_member ( var, val );
			}
		}

		else
		{
			set_variable_raw ( varname, val, with_stack );
		}
	}
コード例 #4
0
 void generate() {
     assert(get_target().has_feature(Target::CPlusPlusMangling));
     std::vector<ExternFuncArgument> args;
     args.push_back(Halide::user_context_value());
     args.push_back(input);
     args.push_back(cast<int8_t>(1));
     args.push_back(cast<uint8_t>(2));
     args.push_back(cast<int16_t>(3));
     args.push_back(cast<uint16_t>(4));
     args.push_back(cast<int32_t>(5));
     args.push_back(cast<uint32_t>(6));
     args.push_back(cast<int64_t>(7));
     args.push_back(cast<uint64_t>(8));
     args.push_back(cast<bool>(9 == 9));
     args.push_back(cast<float>(10.0f));
     args.push_back(cast<double>(10.0f));
     args.push_back(int_ptr);
     args.push_back(const_int_ptr);
     args.push_back(void_ptr);
     args.push_back(const_void_ptr);
     args.push_back(string_ptr);
     args.push_back(const_string_ptr);
     output1.define_extern("HalideTest::cxx_mangling_1",
                      args, Float(64), 1, NameMangling::Default);
     output2.define_extern("HalideTest::cxx_mangling_2",
                      args, Float(64), 1, NameMangling::CPlusPlus);
     output3.define_extern("cxx_mangling_3",
                      args, Float(64), 1, NameMangling::C);
 }
コード例 #5
0
ファイル: Targets.cpp プロジェクト: yonggang985/Touch
Cell_Target Targets::cell_target(const Label & label) const
{
    const Target & target = get_target(label);

    // check if target compatible with cells object
    if (target.type() != CELL_TARGET && target.type() != NESTED_TARGET)
    {
        throw Target_Not_Found(
            "Conversion of Target object to Cell_Target object failed. "
            "Target type incompatible with a Neurons object");
    }

    Cell_Target cells(label);
    
    // insert the cell ids of the cell target into cells object
    std::vector<Cell_GID> cell_members;
    target.get_all_gids( cell_members );
    
    for ( unsigned int cellIndex=0; 
        cellIndex < cell_members.size(); cellIndex++ )
    {
        cells.insert( cell_members[cellIndex] );
    }
    
    return cells;
}
コード例 #6
0
ファイル: libotirc.c プロジェクト: blunderer/libotirc
/*
 * parse a raw message 
 * This function parse the raw message and return usefull information
 * by calling get_user and get_target functions.
 */
PRIVATE_API int parse_message(char * data, char * to, char * from, char * chan, char * msg)	
{
	int i;

	/* get sender */
	data = get_user(data, from);
	i = strlen(from)-1;
	if(i > 0)
		while((from[i] == ' ')||(from[i] == '\t')) { from[i--] = '\0'; }


	/* get dest */
	data = get_target(data, to, chan);
	i = strlen(chan)-1;
	if(i > 0)
		while((chan[i] == ' ')||(chan[i] == '\t')) { chan[i--] = '\0'; }
	i = strlen(to)-1;
	if(i > 0)
		while((to[i] == ' ')||(to[i] == '\t')) { to[i--] = '\0'; }
	
	/* get message */
	strcpy(msg, data);
	i = strlen(msg)-1;
	if(i > 0)
		while((msg[i] == ' ')||(msg[i] == '\t')) { msg[i--] = '\0'; }

	return 0;
}
コード例 #7
0
ファイル: target.c プロジェクト: kuiro5/Hake---The-Fake-Make
int target_check(char *name)                                // check to see if a target exists
{
  if(get_target(name) != NULL)
  {return 1;}
  else
  {return 0;}
}
コード例 #8
0
ファイル: game.cpp プロジェクト: Black-wingsvV/GwanKei
  bool Feedback::is_route_turned() const {
    std::vector<Cell> route_arr;
    std::vector<Bound> bounds;
    for(auto I=route.begin(); I!=route.end(); I++) {
      route_arr.push_back(*I);
    }
    for(int i=0; (i+1)<route_arr.size(); i++) {
      Cell current = route_arr[i];
      Cell next = route_arr[i+1];
      std::list<Bound> adjacents = current.get_adjacents();
      for(auto J=adjacents.begin(); J!=adjacents.end(); J++) {
	if(J->get_target() == next) {
	  bounds.push_back(*J);
	} // the corressponding bound
      } // for adjacents
    } // for i (index of arr)
    for(int i=0; (i+1)<bounds.size(); i++) {
      Bound current = bounds[i];
      Bound next = bounds[i+1];
      if(!next.is_linkable(current, false)) {
	// 不能轉向的話接不上
	// 結論:轉向了
	return true;
      }
    }
    return false;
  }
コード例 #9
0
ファイル: gl_camera.cpp プロジェクト: HaoTNN/AcmGame
vector3 gl_camera::get_right() const
{
    vector3 Y(0,1,0);
    vector3 right;
    right = get_target().cross(Y);//right.cross(get_target(), Y);
    right.normalize();
    return right;
}
コード例 #10
0
ファイル: tcl.c プロジェクト: Xplorer001/openocd
static COMMAND_HELPER(create_nand_device, const char *bank_name,
		struct nand_flash_controller *controller)
{
	struct nand_device *c;
	struct target *target;
	int retval;

	if (CMD_ARGC < 2)
	{
		return ERROR_COMMAND_SYNTAX_ERROR;
	}
	target = get_target(CMD_ARGV[1]);
	if (!target) {
		LOG_ERROR("invalid target %s", CMD_ARGV[1]);
		return ERROR_COMMAND_ARGUMENT_INVALID;
	}

	if (NULL != controller->commands)
	{
		retval = register_commands(CMD_CTX, NULL,
				controller->commands);
		if (ERROR_OK != retval)
			return retval;
	}
	c = malloc(sizeof(struct nand_device));
	if (c == NULL)
	{
		LOG_ERROR("End of memory");
		return ERROR_FAIL;
	}

	c->name = strdup(bank_name);
	c->target = target;
	c->controller = controller;
	c->controller_priv = NULL;
	c->manufacturer = NULL;
	c->device = NULL;
	c->bus_width = 0;
	c->address_cycles = 0;
	c->page_size = 0;
	c->use_raw = 0;
	c->next = NULL;

	retval = CALL_COMMAND_HANDLER(controller->nand_device_command, c);
	if (ERROR_OK != retval)
	{
		assert(controller->usage != NULL);
		LOG_ERROR("'%s' driver rejected nand flash. Usage: %s",
			controller->name,
			controller->usage);
		free(c);
		return retval;
	}

	nand_device_add(c);

	return ERROR_OK;
}
コード例 #11
0
ファイル: bullet.cpp プロジェクト: HamboLagos/shooty-face
void
Bullet::fire()
{
    auto* physics = get_component<Physics>();
    auto trajectory = get_target() - physics->get_position();

    physics->set_velocity(util::direction(trajectory) * physics->get_move_speed());
    physics->set_static(false);
}
コード例 #12
0
ファイル: eventqueue.cpp プロジェクト: SFTtech/openage
size_t EventQueue::OnChangeElement::Equal::operator()(const OnChangeElement& left,
                                                      const OnChangeElement& right) const {
	auto left_evnt = left.evnt.lock();
	auto right_evnt = right.evnt.lock();
	if (left_evnt && right_evnt) {
		if (left_evnt->get_eventclass()->id() == right_evnt->get_eventclass()->id()) {
			return true;
		}
	} else {
		return false;
	}

	auto left_trgt = left_evnt->get_target().lock();
	auto right_trgt = right_evnt->get_target().lock();

	return left_trgt && right_trgt &&
	left_trgt->id() == right_trgt->id();
}
コード例 #13
0
ファイル: target_loader.cpp プロジェクト: medsec/mack
	/**
	 * Return the i-th target with known target size. If the index is out of bounds, mack will be terminated.
	 */
	unsigned char*
	mack::targetloaders::Target_Loader::
	get_target(size_t index, unsigned char* targets){
		if(index >= _target_count){
			printf("Target index %lu is out of bounds. Number of loaded targets: %lu\n", index, _target_count);
			exit(EXIT_FAILURE);
		}
		return get_target(index, targets, _target_size);
	}
コード例 #14
0
ファイル: csr_matrix.hpp プロジェクト: pkambadu/Covariance
 /**
  * Pretty print the graph
  */
 void pretty_print (int source) const {
   assert(M>source);
   for (int index = begin (source);
        index < end (source);
        ++index) {
     int target = get_target (index);
     double weight = get_weight (index);
     std::cout << source << " " << target << " " << weight << std::endl;
   }
 }
コード例 #15
0
ファイル: link.c プロジェクト: rkd77/elinks-tv
void
html_a(struct html_context *html_context, unsigned char *a,
       unsigned char *xxx3, unsigned char *xxx4, unsigned char **xxx5)
{
	unsigned char *href;

	href = get_url_val(a, (unsigned char *)"href", html_context->doc_cp);
	if (href) {
		unsigned char *target;

		mem_free_set(&format.link,
			     join_urls(html_context->base_href,
				       trim_chars(href, ' ', 0)));

		mem_free(href);

		target = get_target(html_context->options, a);
		if (target) {
			mem_free_set(&format.target, target);
		} else {
			mem_free_set(&format.target, stracpy(html_context->base_target));
		}

		if (0) {
			; /* Shut up compiler */
#ifdef CONFIG_GLOBHIST
		} else if (get_global_history_item(format.link)) {
			format.style.color.foreground = format.color.vlink;
			html_top->pseudo_class &= ~ELEMENT_LINK;
			html_top->pseudo_class |= ELEMENT_VISITED;
#endif
#ifdef CONFIG_BOOKMARKS
		} else if (get_bookmark(format.link)) {
			format.style.color.foreground = format.color.bookmark_link;
			html_top->pseudo_class &= ~ELEMENT_VISITED;
			/* XXX: Really set ELEMENT_LINK? --pasky */
			html_top->pseudo_class |= ELEMENT_LINK;
#endif
		} else {
			format.style.color.foreground = format.color.clink;
			html_top->pseudo_class &= ~ELEMENT_VISITED;
			html_top->pseudo_class |= ELEMENT_LINK;
		}

		mem_free_set(&format.title,
		             get_attr_val(a, (unsigned char *)"title", html_context->doc_cp));

		html_focusable(html_context, a);

	} else {
		pop_html_element(html_context);
	}

	set_fragment_identifier(html_context, a, (unsigned char *)"name");
}
コード例 #16
0
 /**
  * Pretty print the graph
  */
 void pretty_print () const {
   for (int source = 0; source < N; ++source) {
     for (int target_index = begin (source);
          target_index < end (source);
          ++target_index) {
       std::cout << source << " ---> " << get_target (target_index) 
                 << " (weight=" << get_weight (target_index) << ")" 
                 << std::endl;
     }
   }
 }
コード例 #17
0
ファイル: symlink.c プロジェクト: rrowicki/Chrono_Kernel-1
int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
{
	int ret;
	struct path path;
	struct configfs_dirent *sd;
	struct config_item *parent_item;
	struct config_item *target_item = NULL;
	struct config_item_type *type;

	ret = -EPERM;  /* What lack-of-symlink returns */
	if (dentry->d_parent == configfs_sb->s_root)
		goto out;

	sd = dentry->d_parent->d_fsdata;
	/*
	 * Fake invisibility if dir belongs to a group/default groups hierarchy
	 * being attached
	 */
	ret = -ENOENT;
	if (!configfs_dirent_is_ready(sd))
		goto out;

	parent_item = configfs_get_config_item(dentry->d_parent);
	type = parent_item->ci_type;

	ret = -EPERM;
	if (!type || !type->ct_item_ops ||
	    !type->ct_item_ops->allow_link)
		goto out_put;

	ret = get_target(symname, &path, &target_item);
	if (ret)
		goto out_put;

	ret = type->ct_item_ops->allow_link(parent_item, target_item);
	if (!ret) {
		mutex_lock(&configfs_symlink_mutex);
		ret = create_link(parent_item, target_item, dentry);
		mutex_unlock(&configfs_symlink_mutex);
		if (ret && type->ct_item_ops->drop_link)
			type->ct_item_ops->drop_link(parent_item,
						     target_item);
	}

	config_item_put(target_item);
	path_put(&path);

out_put:
	config_item_put(parent_item);

out:
	return ret;
}
コード例 #18
0
ファイル: ch22.c プロジェクト: talshorer/cryptopals
int main(int argc, char *argv[])
{
	mt19937_int_t target;
	unsigned int seed;

	target = get_target();
	for (seed = faketime(); seed; seed--)
		if (mt19937_first(seed) == target)
			break;
	printf("%10s: seed is %u\n", __func__, seed);
	return 0;
}
コード例 #19
0
ファイル: display.cpp プロジェクト: Quna/mspdev
/**
   Generates target name listing, designed for text output and console viewing.
*/
static void
print_target_plain (const struct target_opts *defaults)
{
    const char* const target_name = get_target ();

    assert (0 == defaults->verbose);

    printf ("%-40.40s ", target_name);

    /* flush to prevent killing a signal from not displaying the text */
    fflush (stdout);
}
コード例 #20
0
ファイル: control_jump.cpp プロジェクト: 2asoft/xray
void CControlJump::activate()
{
	m_man->capture_pure	(this);
	m_man->subscribe	(this, ControlCom::eventAnimationEnd);
	m_man->subscribe	(this, ControlCom::eventAnimationStart);
	m_man->subscribe	(this, ControlCom::eventVelocityBounce);

	if (m_data.target_object)
		start_jump	(get_target(m_data.target_object));
	else 
		start_jump	(m_data.target_position);

}
コード例 #21
0
ファイル: result.cpp プロジェクト: AlanDeSmet/htcondor
 std::string suggestion::to_string() const {
   std::stringstream sbuilder;
   switch(get_kind()) {
   case NONE:
     return std::string("No suggestion");
   case MODIFY_ATTRIBUTE:
     sbuilder << "Modify attribute " << get_target() << " to " << get_value();
     return sbuilder.str();
   case MODIFY_CONDITION:
     sbuilder << "Modify condition " << get_target() << " to " << get_value();
     return sbuilder.str();
   case DEFINE_ATTRIBUTE:
     sbuilder << "Define attribute " << get_target();
     return sbuilder.str();
   case REMOVE_CONDITION:
     sbuilder << "Remove condition " << get_target();
     return sbuilder.str();
   default:
     // XXX:  assert here
     sbuilder << "Unknown: (" << get_kind() << ", " << get_target() << ", " << get_value() << ")";
     return sbuilder.str();
   }
 }
コード例 #22
0
int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
{
	int ret;
	struct path path;
	struct configfs_dirent *sd;
	struct config_item *parent_item;
	struct config_item *target_item = NULL;
	struct config_item_type *type;

	sd = dentry->d_parent->d_fsdata;
	/*
                                                                        
                  
  */
	ret = -ENOENT;
	if (!configfs_dirent_is_ready(sd))
		goto out;

	parent_item = configfs_get_config_item(dentry->d_parent);
	type = parent_item->ci_type;

	ret = -EPERM;
	if (!type || !type->ct_item_ops ||
	    !type->ct_item_ops->allow_link)
		goto out_put;

	ret = get_target(symname, &path, &target_item, dentry->d_sb);
	if (ret)
		goto out_put;

	ret = type->ct_item_ops->allow_link(parent_item, target_item);
	if (!ret) {
		mutex_lock(&configfs_symlink_mutex);
		ret = create_link(parent_item, target_item, dentry);
		mutex_unlock(&configfs_symlink_mutex);
		if (ret && type->ct_item_ops->drop_link)
			type->ct_item_ops->drop_link(parent_item,
						     target_item);
	}

	config_item_put(target_item);
	path_put(&path);

out_put:
	config_item_put(parent_item);

out:
	return ret;
}
コード例 #23
0
ファイル: context_plan.cpp プロジェクト: jordirovira/craft
std::shared_ptr<BuiltTarget> ContextPlan::get_built_target( const std::string& name )
{
    std::shared_ptr<Target_Base> target = get_target(name);

    if (!target)
    {
        AXE_LOG("fatal",axe::Level::Error,"Unknown target [%s]", name.c_str());
        assert(target);
    }

    std::shared_ptr<BuiltTarget> result;

    if (target->is_configuration_sensitive())
    {
        assert(m_currentBuiltTargets);
        auto it = m_currentBuiltTargets->m_targets.find(target);
        if ( it==m_currentBuiltTargets->m_targets.end() )
        {
            AXE_LOG("plan",axe::Level::Error,"Building new target [%s], %d built", name.c_str(), m_currentBuiltTargets->m_targets.size() );
            result = target->build( *this );
            result->m_sourceTarget = target;
            m_currentBuiltTargets->m_targets[target] = result;
            m_tasks.insert(m_tasks.end(),result->m_outputTasks.begin(),result->m_outputTasks.end());
        }
        else
        {
            AXE_LOG("plan",axe::Level::Error,"Reused target [%s]", name.c_str());
            result = it->second;
        }
    }
    else
    {
        auto it = m_insensitiveBuiltTargets.find(target);
        if ( it==m_insensitiveBuiltTargets.end() )
        {
            result = target->build( *this );
            result->m_sourceTarget = target;
            m_insensitiveBuiltTargets[target] = result;
            m_tasks.insert(m_tasks.end(),result->m_outputTasks.begin(),result->m_outputTasks.end());
        }
        else
        {
            AXE_LOG("plan",axe::Level::Error,"Reused target [%s]", name.c_str());
            result = it->second;
        }
    }

    return result;
}
コード例 #24
0
    Func build() {
        assert(get_target().has_feature(Target::CPlusPlusMangling));
        Var x("x");
        Func f("f");

        Expr offset = offset_i8 + offset_u8 + offset_i16 + offset_u16 +
                      offset_i32 + offset_u32 + offset_i64 + offset_u64 +
                      extract_value_global(ptr) + extract_value_ns(const_ptr);

        // No significance to the calculation here.
        f(x) = select(scale_direction, (input(x) * scale_f + offset) / scale_d,
                                       (input(x) * scale_d + offset) / scale_f);

        return f;
    }
コード例 #25
0
Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {

#ifdef DEBUG_ENABLED
	if (conn_target_id && !ObjectDB::get_instance(conn_target_id)) {
		ERR_EXPLAIN("Resumed after await, but class instance is gone");
		ERR_FAIL_V(Variant());
	}
#endif

	if (p_argcount < 1) {
		r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
		r_error.argument = 1;
		return Variant();
	}

	Ref<SignalAwaiterHandle> self = *p_args[p_argcount - 1];

	if (self.is_null()) {
		r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
		r_error.argument = p_argcount - 1;
		r_error.expected = Variant::OBJECT;
		return Variant();
	}

	set_completed(true);

	int signal_argc = p_argcount - 1;
	MonoArray *signal_args = mono_array_new(SCRIPTS_DOMAIN, CACHED_CLASS_RAW(MonoObject), signal_argc);

	for (int i = 0; i < signal_argc; i++) {
		MonoObject *boxed = GDMonoMarshal::variant_to_mono_object(*p_args[i]);
		mono_array_set(signal_args, MonoObject *, i, boxed);
	}

	GDMonoUtils::SignalAwaiter_SignalCallback thunk = CACHED_METHOD_THUNK(SignalAwaiter, SignalCallback);

	MonoException *exc = NULL;
	GD_MONO_BEGIN_RUNTIME_INVOKE;
	thunk(get_target(), signal_args, (MonoObject **)&exc);
	GD_MONO_END_RUNTIME_INVOKE;

	if (exc) {
		GDMonoUtils::set_pending_exception(exc);
		ERR_FAIL_V(Variant());
	}

	return Variant();
}
コード例 #26
0
ファイル: util.cpp プロジェクト: Quna/mspdev
void
warn (const char* const format, ...)
{
    const char* const target_name = get_target ();
    va_list args;

    assert (0 != format);

    if (target_name)
        fprintf (stderr, "%s (%s): ", exe_name, target_name);
    else
        fprintf (stderr, "%s: ", exe_name);

    va_start (args, format);
    vfprintf (stderr, format, args);
    va_end (args);
}
コード例 #27
0
SignalAwaiterHandle::~SignalAwaiterHandle() {

	if (!completed) {
		GDMonoUtils::SignalAwaiter_FailureCallback thunk = CACHED_METHOD_THUNK(SignalAwaiter, FailureCallback);

		MonoObject *awaiter = get_target();

		if (awaiter) {
			MonoObject *ex = NULL;
			thunk(awaiter, &ex);

			if (ex) {
				mono_print_unhandled_exception(ex);
				ERR_FAIL_V();
			}
		}
	}
}
コード例 #28
0
  /**
   * Sort the edges in ascending order so that we can search for things 
   * far more easily later. This procedure repeatedly calls binary search.
   */
  void sort () {
    /*
     * For each vertex's adjacency, we want to sort the targets by their 
     * vertex index. For this, we can directly use std::sort(). The only 
     * catch is that we need to reorganize the weights based on the sorted
     * values. So, what we do instead is std::sort() on a copy of the 
     * adjacencies, and once then reorganize the weights to match the new 
     * values.
     */
    std::vector<VertexIndexType> columns_copy(columns.begin(), columns.end());
    std::vector<EdgeWeightType> weights_copy (nnz, 0.0);
    for (int source = 0; source < N; ++source) {
      const int target_begin = begin (source);
      const int target_end = end (source);
      std::sort ((columns_copy.begin()+target_begin), 
                 (columns_copy.begin()+target_end));

      for (int target_index = begin (source);
           target_index < end (source);
           ++target_index) {
        const VertexIndexType target = get_target (target_index);
        const EdgeWeightType weight = get_weight (target_index);

        const int target_new_position = std::lower_bound 
                                    ((columns_copy.begin()+target_begin),
                                     (columns_copy.begin()+target_end),
                                     target) - columns_copy.begin();

        if (target_new_position == 
            ((columns_copy.begin()+target_end)-columns_copy.begin())) {
          fprintf (stderr, "Could not locate (%d,%d) in graph\n", 
                                              source, target);
          exit (1);
        }

        weights_copy [target_new_position] = weight;
      }
    }
    columns.swap (columns_copy);
    weights.swap (weights_copy);
    sorted = true;
  }
コード例 #29
0
SignalAwaiterHandle::~SignalAwaiterHandle() {

	if (!completed) {
		GDMonoUtils::SignalAwaiter_FailureCallback thunk = CACHED_METHOD_THUNK(SignalAwaiter, FailureCallback);

		MonoObject *awaiter = get_target();

		if (awaiter) {
			MonoException *exc = NULL;
			GD_MONO_BEGIN_RUNTIME_INVOKE;
			thunk(awaiter, (MonoObject **)&exc);
			GD_MONO_END_RUNTIME_INVOKE;

			if (exc) {
				GDMonoUtils::set_pending_exception(exc);
				ERR_FAIL_V();
			}
		}
	}
}
コード例 #30
0
ファイル: game.cpp プロジェクト: Black-wingsvV/GwanKei
  bool Game::has_living_piece(Player player) const {
    assert(enabled[player]);
    for(int i=0; i<4631; i++) {
      if(is_valid_cell_id(i)) {
	if(!board[i].is_empty()) {
	  assert(!board[i].is_unknown());
	  if(board[i].get_player() == player) {	    
	    Cell cell(i);
	    std::list<Bound> bounds = cell.get_adjacents();
	    for(auto I=bounds.begin(); I!=bounds.end(); I++) {
	      if(is_movable(cell, I->get_target()) ) {
		return true;
	      } // movable
	    } // for adjacents
	  } // this player
	} // not empty
      } // valid cell id
    } // for cell id
    return false;
  }