本文整理汇总了C++中PlayerInfo::GetStellarObject方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::GetStellarObject方法的具体用法?C++ PlayerInfo::GetStellarObject怎么用?C++ PlayerInfo::GetStellarObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::GetStellarObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}