本文整理汇总了C++中PlayerInfo::IsLoaded方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::IsLoaded方法的具体用法?C++ PlayerInfo::IsLoaded怎么用?C++ PlayerInfo::IsLoaded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::IsLoaded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: player
Engine::Engine(PlayerInfo &player)
: player(player),
calcTickTock(false), drawTickTock(false), terminate(false), step(0),
flash(0.), doFlash(false), wasLeavingHyperspace(false),
load(0.), loadCount(0), loadSum(0.)
{
// Start the thread for doing calculations.
calcThread = thread(&Engine::ThreadEntryPoint, this);
if(!player.IsLoaded() || !player.GetSystem())
return;
// Preload any landscapes for this system.
for(const StellarObject &object : player.GetSystem()->Objects())
if(object.GetPlanet())
GameData::Preload(object.GetPlanet()->Landscape());
// Now we know the player's current position. Draw the planets.
Point center;
if(player.GetPlanet())
{
for(const StellarObject &object : player.GetSystem()->Objects())
if(object.GetPlanet() == player.GetPlanet())
center = object.Position();
}
for(const StellarObject &object : player.GetSystem()->Objects())
if(!object.GetSprite().IsEmpty())
{
Point position = object.Position();
Point unit = object.Unit();
position -= center;
int type = object.IsStar() ? Radar::SPECIAL :
!object.GetPlanet() ? Radar::INACTIVE :
object.GetPlanet()->IsWormhole() ? Radar::ANOMALOUS :
GameData::GetPolitics().HasDominated(object.GetPlanet()) ? Radar::PLAYER :
object.GetPlanet()->CanLand() ? Radar::FRIENDLY : Radar::HOSTILE;
double r = max(2., object.Radius() * .03 + .5);
draw[calcTickTock].Add(object.GetSprite(), position, unit);
radar[calcTickTock].Add(type, position, r, r - 1.);
}
// Add all neighboring systems to the radar.
const Ship *flagship = player.Flagship();
const System *targetSystem = flagship ? flagship->GetTargetSystem() : nullptr;
const vector<const System *> &links = (flagship && flagship->Attributes().Get("jump drive")) ?
player.GetSystem()->Neighbors() : player.GetSystem()->Links();
for(const System *system : links)
radar[calcTickTock].AddPointer(
(system == targetSystem) ? Radar::SPECIAL : Radar::INACTIVE,
system->Position() - player.GetSystem()->Position());
}
示例2: player
Engine::Engine(PlayerInfo &player)
: player(player)
{
// Start the thread for doing calculations.
calcThread = thread(&Engine::ThreadEntryPoint, this);
if(!player.IsLoaded() || !player.GetSystem())
return;
// Preload any landscapes for this system.
for(const StellarObject &object : player.GetSystem()->Objects())
if(object.GetPlanet())
GameData::Preload(object.GetPlanet()->Landscape());
// Figure out what planet the player is landed on, if any.
const StellarObject *object = player.GetStellarObject();
if(object)
center = object->Position();
// Now we know the player's current position. Draw the planets.
draw[calcTickTock].SetCenter(center);
radar[calcTickTock].SetCenter(center);
for(const StellarObject &object : player.GetSystem()->Objects())
if(object.HasSprite())
{
draw[calcTickTock].Add(object);
double r = max(2., object.Radius() * .03 + .5);
radar[calcTickTock].Add(RadarType(object), object.Position(), r, r - 1.);
}
// Add all neighboring systems to the radar.
const Ship *flagship = player.Flagship();
const System *targetSystem = flagship ? flagship->GetTargetSystem() : nullptr;
const vector<const System *> &links = (flagship && flagship->Attributes().Get("jump drive")) ?
player.GetSystem()->Neighbors() : player.GetSystem()->Links();
for(const System *system : links)
radar[calcTickTock].AddPointer(
(system == targetSystem) ? Radar::SPECIAL : Radar::INACTIVE,
system->Position() - player.GetSystem()->Position());
}