當前位置: 首頁>>代碼示例>>C++>>正文


C++ Character函數代碼示例

本文整理匯總了C++中Character函數的典型用法代碼示例。如果您正苦於以下問題:C++ Character函數的具體用法?C++ Character怎麽用?C++ Character使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Character函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: ChangeTeamState

void CGameTeams::SetForceCharacterTeam(int ClientID, int Team)
{
	m_TeeFinished[ClientID] = false;
	if(m_Core.Team(ClientID) != TEAM_FLOCK 
		&& m_Core.Team(ClientID) != TEAM_SUPER 
		&& m_TeamState[m_Core.Team(ClientID)] != TEAMSTATE_EMPTY)
	{
		bool NoOneInOldTeam = true;
		for(int i = 0; i < MAX_CLIENTS; ++i)
			if(i != ClientID && m_Core.Team(ClientID) == m_Core.Team(i))
			{
				NoOneInOldTeam = false;//all good exists someone in old team
				break;
			} 
		if(NoOneInOldTeam)
			m_TeamState[m_Core.Team(ClientID)] = TEAMSTATE_EMPTY;
	}
	if(Count(m_Core.Team(ClientID)) > 0) m_MembersCount[m_Core.Team(ClientID)]--;
	m_Core.Team(ClientID, Team);
	if(m_Core.Team(ClientID) != TEAM_SUPER) m_MembersCount[m_Core.Team(ClientID)]++;
	if(Team != TEAM_SUPER && m_TeamState[Team] == TEAMSTATE_EMPTY)
		ChangeTeamState(Team, TEAMSTATE_OPEN);
	
	for (int LoopClientID = 0; LoopClientID < MAX_CLIENTS; ++LoopClientID)
	{
		if(Character(LoopClientID) && Character(LoopClientID)->GetPlayer()->m_IsUsingDDRaceClient)
			SendTeamsState(LoopClientID);
	}
}
開發者ID:Fear-cool,項目名稱:dDDRace,代碼行數:29,代碼來源:teams.cpp

示例2: Character

bool CGameTeams::SetCharacterTeam(int ClientID, int Team)
{
	//Check on wrong parameters. +1 for TEAM_SUPER
	if(ClientID < 0 || ClientID >= MAX_CLIENTS || Team < 0 || Team >= MAX_CLIENTS + 1)
		return false;
	//You can join to TEAM_SUPER at any time, but any other group you cannot if it started
	if(Team != TEAM_SUPER && m_TeamState[Team] >= TEAMSTATE_CLOSED)
		return false;
	//No need to switch team if you there
	if(m_Core.Team(ClientID) == Team)
		return false;
	//You cannot be in TEAM_SUPER if you not super
	if(Team == TEAM_SUPER && !Character(ClientID)->m_Super) return false;
	//if you begin race
	if(Character(ClientID)->m_DDRaceState != DDRACE_NONE)
	{
		//you will be killed if you try to join FLOCK
		if(Team == TEAM_FLOCK && m_Core.Team(ClientID) != TEAM_FLOCK)
			Character(ClientID)->GetPlayer()->KillCharacter(WEAPON_GAME);
		else if(Team != TEAM_SUPER)
			return false;
	}
	SetForceCharacterTeam(ClientID, Team);
	
	
	//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());
	return true;
}
開發者ID:Fear-cool,項目名稱:dDDRace,代碼行數:28,代碼來源:teams.cpp

示例3: Server

bool CWeapon_GenericGun07::OnFire(vec2 Direction)
{
	if(m_ReloadTimer > 0)
		return false;
		
	// check for ammo
	if(!m_Ammo)
	{
		// 125ms is a magical limit of how fast a human can click
		m_ReloadTimer = 125 * Server()->TickSpeed() / 1000;
		if(m_LastNoAmmoSound+Server()->TickSpeed() <= Server()->Tick())
		{
			CEvent_Sound(GameServer()).World(WorldID())
				.Send(Character()->GetPos(), SOUND_WEAPON_NOAMMO);
		
			m_LastNoAmmoSound = Server()->Tick();
		}
		return false;
	}
	
	vec2 ProjStartPos = Character()->GetPos() + Direction * Character()->GetProximityRadius()*0.75f;
	
	CreateProjectile(ProjStartPos, Direction);
	
	m_Ammo--;
	
	m_ReloadTimer = g_pData->m_Weapons.m_aId[m_TW07ID].m_Firedelay * Server()->TickSpeed() / 1000;
	
	return true;
}
開發者ID:teeworlds-modapi,項目名稱:teeworlds,代碼行數:30,代碼來源:weapon.cpp

示例4: if

int64_t CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
{
	int64_t Mask = 0;

	for (int i = 0; i < MAX_CLIENTS; ++i)
	{
		if (i == ExceptID)
			continue; // Explicitly excluded
		if (!GetPlayer(i))
			continue; // Player doesn't exist

		if (!(GetPlayer(i)->GetTeam() == -1 || GetPlayer(i)->m_Paused))
		{ // Not spectator
			if (i != Asker)
			{ // Actions of other players
				if (!Character(i))
					continue; // Player is currently dead
				if (!GetPlayer(i)->m_ShowOthers)
				{
					if (m_Core.GetSolo(Asker))
						continue; // When in solo part don't show others
					if (m_Core.GetSolo(i))
						continue; // When in solo part don't show others
					if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)
						continue; // In different teams
				} // ShowOthers
			} // See everything of yourself
		}
		else if (GetPlayer(i)->m_SpectatorID != SPEC_FREEVIEW)
		{ // Spectating specific player
			if (GetPlayer(i)->m_SpectatorID != Asker)
			{ // Actions of other players
				if (!Character(GetPlayer(i)->m_SpectatorID))
					continue; // Player is currently dead
				if (!GetPlayer(i)->m_ShowOthers)
				{
					if (m_Core.GetSolo(Asker))
						continue; // When in solo part don't show others
					if (m_Core.GetSolo(GetPlayer(i)->m_SpectatorID))
						continue; // When in solo part don't show others
					if (m_Core.Team(GetPlayer(i)->m_SpectatorID) != Team && m_Core.Team(GetPlayer(i)->m_SpectatorID) != TEAM_SUPER)
						continue; // In different teams
				} // ShowOthers
			} // See everything of player you're spectating
		}
		else
		{ // Freeview
			if (GetPlayer(i)->m_SpecTeam)
			{ // Show only players in own team when spectating
				if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)
					continue; // in different teams
			}
		}

		Mask |= 1LL << i;
	}
	return Mask;
}
開發者ID:Enyltyn,項目名稱:AllTheHaxx,代碼行數:58,代碼來源:teams.cpp

示例5: on_testAchieve_clicked

void MainWindow::on_testAchieve_clicked()
{
    action = TESTACHIEVE;
    ArmoryCharacter::insert(Character("Giganteus", "Thrall"));
    ArmoryCharacter::insert(Character("Gigahuf", "Thrall"));
    ArmoryCharacter::insert(Character("Sauerbruch", "Thrall"));
    ArmoryCharacter::insert(Character("Giganteus", "Antonidas"));
    db->updatePlayers();
}
開發者ID:gpiez,項目名稱:battlecrawler,代碼行數:9,代碼來源:mainwindow.cpp

示例6: common_refill_and_read_nolock

static int __cdecl common_refill_and_read_nolock(__crt_stdio_stream const stream) throw()
{
    typedef __acrt_stdio_char_traits<Character> stdio_traits;

    _VALIDATE_RETURN(stream.valid(), EINVAL, stdio_traits::eof);

    if (!stream.is_in_use() || stream.is_string_backed())
        return stdio_traits::eof;

    if (stream.has_all_of(_IOWRITE))
    {
        stream.set_flags(_IOERROR);
        return stdio_traits::eof;
    }

    stream.set_flags(_IOREAD);

    // Get a buffer, if necessary:
    if (!stream.has_any_buffer())
        __acrt_stdio_allocate_buffer_nolock(stream.public_stream());

    auto const context = get_context_nolock(stream, Character());

    stream->_ptr = stream->_base;
    stream->_cnt = _read(_fileno(stream.public_stream()), stream->_base, stream->_bufsiz);

    if (!is_buffer_valid_nolock(stream, Character()))
    {
        stream.set_flags(stream->_cnt != 0 ? _IOERROR : _IOEOF);
        stream->_cnt = 0;
        return stdio_traits::eof;
    }

    if (!stream.has_any_of(_IOWRITE | _IOUPDATE) &&
        ((_osfile_safe(_fileno(stream.public_stream())) & (FTEXT | FEOFLAG)) == (FTEXT | FEOFLAG)))
    {
        stream.set_flags(_IOCTRLZ);
    }

    // Check for small _bufsiz (_SMALL_BUFSIZ). If it is small and if it is our
    // buffer, then this must be the first call to this function after an fseek
    // on a read-access-only stream. Restore _bufsiz to its larger value
    // (_INTERNAL_BUFSIZ) so that the next call to this function, if one is made,
    // will fill the whole buffer.
    if (stream->_bufsiz == _SMALL_BUFSIZ &&
        stream.has_crt_buffer() &&
        !stream.has_all_of(_IOBUFFER_SETVBUF))
    {
        stream->_bufsiz = _INTERNAL_BUFSIZ;
    }

    return read_character_nolock(stream, context, Character());
}
開發者ID:DinrusGroup,項目名稱:DinrusUcrtBased,代碼行數:53,代碼來源:_filbuf.cpp

示例7: Character

void PlayerController::Tick(sf::Window *window) {
  b2Body *body = Character()->Body();
  b2Vec2 chrPos = body->GetPosition();
  b2Vec2 base = Character()->ClosestPlanet()->Position();
  float angle_r = RadiansOf(chrPos - base);
  if (chrPos.x < base.x)
    angle_r = -angle_r;
  Character()->Body()->SetTransform(chrPos, angle_r);
  if (left_down_) {
    b2Vec2 mouseVec(mouse_x_ - window->getSize().x / 2.0f,
                    mouse_y_ - window->getSize().y / 2.0f);
    b2Vec2 rotated = RotatedVector(mouseVec, angle_r);
    body->ApplyLinearImpulse(rotated, body->GetPosition());
  }
}
開發者ID:Bredgren,項目名稱:CosmicCombat_old,代碼行數:15,代碼來源:PlayerController.cpp

示例8: while

void MWState::CharacterManager::createCharacter(const std::string& name)
{
    std::ostringstream stream;

    // The character name is user-supplied, so we need to escape the path
    for (std::string::const_iterator it = name.begin(); it != name.end(); ++it)
    {
        if (std::isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters
            stream << *it;
        else
            stream << "_";
    }

    boost::filesystem::path path = mPath / stream.str();

    // Append an index if necessary to ensure a unique directory
    int i=0;
    while (boost::filesystem::exists(path))
    {
           std::ostringstream test;
           test << stream.str();
           test << " - " << ++i;
           path = mPath / test.str();
    }

    mCharacters.push_back (Character (path, mGame));

    mCurrent = &mCharacters.back();
}
開發者ID:AAlderman,項目名稱:openmw,代碼行數:29,代碼來源:charactermanager.cpp

示例9: main

int main()
{
	Character cube = Character("Cube", 5, 25, 123);
	Environment earth = Environment(137, "Earth", EARTH_GRAVITY);
	PhysicsController controller = PhysicsController();

	float maxJumpHeightOnEarth = controller.getMaxJumpHeightInMeters(earth, cube);
	float timeInAirOnEarth = controller.getJumpDurationInSeconds(earth, cube);
	float bookHeight = 0.05;
	bool canJumpOverBookOnEarth = controller.canJumpOverObstacle(earth, cube, bookHeight);
	std::cout << "EARTH:" << std::endl <<
		"--max jump height: " << maxJumpHeightOnEarth << " meters" << std::endl <<
		"--time in air: " << timeInAirOnEarth << " seconds" << std::endl <<
		"--can jump over book: " << (canJumpOverBookOnEarth ? "Yes" : "No") << std::endl;
	std::cout << std::endl;

	Environment moon = Environment(321, "Moon", MOON_GRAVITY);
	float maxJumpHeightOnTheMoon = controller.getMaxJumpHeightInMeters(moon, cube);
	float timeInAirOnTheMoon = controller.getJumpDurationInSeconds(moon, cube);
	bool canJumpOverBookOnTheMoon = controller.canJumpOverObstacle(moon, cube, bookHeight);
	std::cout << "MOON:" << std::endl <<
		"--max jump height: " << maxJumpHeightOnTheMoon << " meters" << std::endl <<
		"--time in air: " << timeInAirOnTheMoon << " seconds" << std::endl <<
		"--can jump over book: " << (canJumpOverBookOnTheMoon ? "Yes" : "No") << std::endl;

	return 0;
}
開發者ID:krasi070,項目名稱:CPlusPlus,代碼行數:27,代碼來源:Source.cpp

示例10: main

int main() {
    
    Character character = Character();
    character.prompt();
    
    return 0;
}
開發者ID:temportalflux,項目名稱:DnDCharacters,代碼行數:7,代碼來源:main.cpp

示例11: scanner

Lexer::Lexer(char* filename)
    :
    scanner(),
    token(Character(NULL, NULL, NULL, NULL, NULL), &scanner, NULL)
{
    scanner.OpenFile(filename);
}
開發者ID:patrickmortensen,項目名稱:theEngine,代碼行數:7,代碼來源:Lexer.cpp

示例12: CLaser

void CMod_Weapon_Laser::CreateProjectile(vec2 Pos, vec2 Direction)
{
	new CLaser(GameWorld(), Pos, Direction, GameServer()->Tuning()->m_LaserReach, Player()->GetCID());
	
	CModAPI_WorldEvent_Sound(GameServer(), WorldID())
		.Send(Character()->GetPos(), SOUND_LASER_FIRE);
}
開發者ID:teeworlds-modapi,項目名稱:mod-target,代碼行數:7,代碼來源:laser.cpp

示例13: Character

HumanChar::HumanChar(Gtk * graphic, HumanBox* hb)
{
  this->letter = Character();
  this->clicked = false;
  this->graphic = graphic;
  this->parent = hb;

}
開發者ID:Emma1718,項目名稱:Literaki,代碼行數:8,代碼來源:HumanChar.cpp

示例14: ERR_FAIL_V

Font::Character Font::get_character(CharType p_char) const {

	if (!char_map.has(p_char)) {
		ERR_FAIL_V(Character());
	};

	return char_map[p_char];
};
開發者ID:ShadowKyogre,項目名稱:godot,代碼行數:8,代碼來源:font.cpp

示例15: uninitialize_environment_internal

static void __cdecl uninitialize_environment_internal(Character**& environment) throw()
{
    if (environment == get_initial_environment(Character()))
    {
        return;
    }

    free_environment(environment);
}
開發者ID:DinrusGroup,項目名稱:DinrusUcrtBased,代碼行數:9,代碼來源:environment_initialization.cpp


注:本文中的Character函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。