本文整理汇总了C++中PlayerInfo::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::Reset方法的具体用法?C++ PlayerInfo::Reset怎么用?C++ PlayerInfo::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Ticker
//.........这里部分代码省略.........
}
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;
}
else if (!m->found)
m = currentcluster->maps[0]; // TODO or give an error?
// cluster change?
if (currentcluster->number != m->cluster)
{
// TODO minor thing: if several players exit maps on the same tick,
// and someone besides the first one causes a cluster change, some
// maps could be loaded in vain...
// cluster change!
currentcluster->Finish(p->requestmap, p->entrypoint);
MapCluster *next = FindCluster(m->cluster);
StartFinale(next);
currentcluster = next;
break; // this is important! no need to check the other players.
}
p->Reset(!currentcluster->keepstuff, true);
// normal individual mapchange
if (!m->Activate(p))
I_Error("Darn!\n");
if (conn)
{
CONS_Printf(" server sending rpc\n");
// nonlocal player enters a new map, notify client
// send the EnterMap rpc only to the owning connection
NetEvent *e = TNL_RPC_CONSTRUCT_NETEVENT(p, s2cEnterMap, (m->mapnumber));
conn->postNetEvent(e);
}
}
}
}