本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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());
}
示例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());
}
}
示例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();
}
示例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;
}
示例10: main
int main() {
Character character = Character();
character.prompt();
return 0;
}
示例11: scanner
Lexer::Lexer(char* filename)
:
scanner(),
token(Character(NULL, NULL, NULL, NULL, NULL), &scanner, NULL)
{
scanner.OpenFile(filename);
}
示例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);
}
示例13: Character
HumanChar::HumanChar(Gtk * graphic, HumanBox* hb)
{
this->letter = Character();
this->clicked = false;
this->graphic = graphic;
this->parent = hb;
}
示例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];
};
示例15: uninitialize_environment_internal
static void __cdecl uninitialize_environment_internal(Character**& environment) throw()
{
if (environment == get_initial_environment(Character()))
{
return;
}
free_environment(environment);
}