Пример #1
0
void G_SetPlayerSkill( gclient_t *client, skillType_t skill )
{
	int i;

#ifdef LUA_SUPPORT

	// Lua API callbacks
	if ( G_LuaHook_SetPlayerSkill( client - level.clients, skill ) )
	{
		return;
	}

#endif // LUA_SUPPORT

	for ( i = NUM_SKILL_LEVELS - 1; i >= 0; i-- )
	{
		if ( client->sess.skillpoints[ skill ] >= skillLevels[ i ] )
		{
			client->sess.skill[ skill ] = i;
			break;
		}
	}

	G_SetPlayerScore( client );
}
Пример #2
0
/**
 * @brief G_SetPlayerSkill
 * @param[in,out] client
 * @param[in] skill
 */
void G_SetPlayerSkill(gclient_t *client, skillType_t skill)
{
	int i;

#ifdef FEATURE_LUA
	// *LUA* API callbacks
	if (G_LuaHook_SetPlayerSkill(client - level.clients, skill))
	{
		return;
	}
#endif

	for (i = NUM_SKILL_LEVELS - 1; i >= 0; i--)
	{
		if (GetSkillTableData(skill)->skillLevels[i] != -1 && client->sess.skillpoints[skill] >= GetSkillTableData(skill)->skillLevels[i])
		{
			client->sess.skill[skill] = i;
			break;
		}
	}

	G_SetPlayerScore(client);
}