本文整理汇总了C++中PlayerInfo::Ticker方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::Ticker方法的具体用法?C++ PlayerInfo::Ticker怎么用?C++ PlayerInfo::Ticker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::Ticker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ticker
// ticks the game forward in time
void GameInfo::Ticker()
{
tic++;
// TODO read/write demo ticcmd's here
// do main actions
switch (state)
{
case GS_INTRO:
if (--pagetic <= 0)
AdvanceIntro();
break;
case GS_LEVEL:
if (!paused && currentcluster)
currentcluster->Ticker();
if (!dedicated)
{
hud.Ticker();
automap.Ticker();
}
break;
case GS_INTERMISSION:
wi.Ticker();
break;
case GS_FINALE:
F_Ticker();
break;
case GS_NULL:
default:
// do nothing
break;
}
MapInfo *m;
PlayerInfo *p;
if (state != GS_LEVEL)
return;
// manage players
for (player_iter_t t = Players.begin(); t != Players.end(); )
{
p = t->second;
t++; // because "old t" may be invalidated
if (p->playerstate == PST_REMOVE)
{
// the player is removed from the game (invalidates "old t")
if (!p->mp)
RemovePlayer(p->number); // first the maps throw out the removed player, then the game proper.
// TODO purge the removed players from the frag maps of other players?
}
else
p->Ticker();
}
if (!server)
return;
//
for (player_iter_t t = Players.begin(); t != Players.end(); t++)
{
p = t->second;
if (p->playerstate == PST_NEEDMAP)
{
LConnection *conn = p->connection;
if (conn && !conn->isGhostAvailable(p))
{
// remote player, is it already being ghosted? if not, wait.
CONS_Printf(" server waiting for client ghost\n");
continue;
}
// assign the player to a map
CONS_Printf("Map request..");
if (p->requestmap == 0)
{
m = initial_map; // first map in game
p->entrypoint = initial_ep;
}
else
m = FindMapInfo(p->requestmap);
if (!m)
{
// game ends
currentcluster->Finish(p->requestmap, p->entrypoint);
StartFinale(NULL);
break;
//.........这里部分代码省略.........