コード例 #1
0
ファイル: GameRules.C プロジェクト: kylegibson/yloponom
bool GameRules::release_assets(const PlayerState& plr)
{
	const net::PropertyList_t& p_list = plr.get_owned_properties();
	net::PropertyList_t::const_iterator it;

	// iterate through the list freeing assets
	for (it = p_list.begin(); it != p_list.end(); ++it)
	{
		// set the property to unowned
		fState->get_property(*it).set_unowned();
		
		// set the property level to zero
		// TODO is this necessary?
		fState->get_property(*it).set_level(0);
	}

	return true;
}
コード例 #2
0
ファイル: GameRules.C プロジェクト: kylegibson/yloponom
unsigned GameRules::count_mems(const PlayerState& plr, unsigned id)
{
	vector<unsigned> vec;
	unsigned mems = fBase.group_members(id, vec);
	unsigned cnt = 0;
	const net::PropertyList_t props = plr.get_owned_properties();
	net::PropertyList_t::const_iterator it;

	for (unsigned i = 0; i < mems; ++i)
	{
		for (it = props.begin(); it != props.end(); ++it)
			if (vec[i] == *it)
			{
				++cnt;
				break;
			}
	}

	return cnt;
}