本文整理汇总了C++中Shot::IsDrone方法的典型用法代码示例。如果您正苦于以下问题:C++ Shot::IsDrone方法的具体用法?C++ Shot::IsDrone怎么用?C++ Shot::IsDrone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shot
的用法示例。
在下文中一共展示了Shot::IsDrone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
NetGameClient::DoWepRelease(NetMsg* msg)
{
if (!msg) return;
NetWepRelease release;
release.Unpack(msg->Data());
NetPlayer* player = FindPlayerByObjID(release.GetObjID());
if (player) {
player->DoWepRelease(&release);
}
else {
Ship* shooter = FindShipByObjID(release.GetObjID());
if (shooter) {
int index = release.GetIndex();
DWORD tgtid = release.GetTgtID();
DWORD wepid = release.GetWepID();
int subid = release.GetSubtarget();
bool decoy = release.GetDecoy();
bool probe = release.GetProbe();
Weapon* w = 0;
if (decoy) w = shooter->GetDecoy();
else if (probe) w = shooter->GetProbeLauncher();
else w = shooter->GetWeaponByIndex(index);
if (w && !w->IsPrimary()) {
SimObject* target = FindShipByObjID(tgtid);
System* subtgt = 0;
if (target) {
if (subid >= 0) {
Ship* tgt_ship = (Ship*) target;
subtgt = tgt_ship->Systems().at(subid);
}
}
else {
target = FindShotByObjID(tgtid);
}
Shot* shot = w->NetFireSecondary(target, subtgt, wepid);
if (shot && shot->IsDrone()) {
if (probe)
shooter->SetProbe((Drone*) shot);
else if (decoy)
shooter->AddActiveDecoy((Drone*) shot);
}
}
}
}
}
示例2: if
bool
NetPlayer::DoWepRelease(NetWepRelease* release)
{
if (ship && release) {
int index = release->GetIndex();
DWORD tgtid = release->GetTgtID();
DWORD wepid = release->GetWepID();
int subid = release->GetSubtarget();
bool decoy = release->GetDecoy();
bool probe = release->GetProbe();
Weapon* w = 0;
if (decoy) w = ship->GetDecoy();
else if (probe) w = ship->GetProbeLauncher();
else w = ship->GetWeaponByIndex(index);
if (w && !w->IsPrimary()) {
SimObject* target = 0;
System* subtgt = 0;
NetGame* net_game = NetGame::GetInstance();
if (net_game) {
target = net_game->FindShipByObjID(tgtid);
if (target) {
if (subid >= 0) {
Ship* tgt_ship = (Ship*) target;
subtgt = tgt_ship->Systems().at(subid);
}
}
else {
target = net_game->FindShotByObjID(tgtid);
}
}
Shot* shot = w->NetFireSecondary(target, subtgt, wepid);
if (shot && shot->IsDrone()) {
if (probe)
ship->SetProbe((Drone*) shot);
else if (decoy)
ship->AddActiveDecoy((Drone*) shot);
}
return true;
}
}
return false;
}