本文整理汇总了C++中GetStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ GetStatus函数的具体用法?C++ GetStatus怎么用?C++ GetStatus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostUpdateImpl
void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!doorsClosed)
{
if (closeFortressDoorsTimer <= diff)
{
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR01)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR01)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR02)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR02)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR03)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR03)->RemoveFromWorld();
GetBGObject(BG_IC_GO_ALLIANCE_GATE_1)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_1)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_ALLIANCE_GATE_2)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_2)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_ALLIANCE_GATE_3)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_3)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
doorsClosed = true;
} else closeFortressDoorsTimer -= diff;
}
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
{
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (nodePoint[i].timer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
if (Creature* catapult = GetBGCreature(type))
if (!catapult->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
catapult->Respawn(true);
respawnMap.erase(itr);
}
}
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
if (Creature* glaiveThrower = GetBGCreature(type))
if (!glaiveThrower->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
glaiveThrower->Respawn(true);
respawnMap.erase(itr);
}
}
docksTimer = DOCKS_UPDATE_TIME;
}
else
nodePoint[i].timer -= diff;
}
}
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (siegeEngineWorkshopTimer <= diff)
{
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
if (!siege->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
siege->Respawn(true);
respawnMap.erase(itr);
}
//.........这里部分代码省略.........
示例2: Update
void BattleGroundAB::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer)
{
if (m_BannerTimers[node].timer > diff)
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_NodeTimers[node])
{
if (m_NodeTimers[node] > diff)
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node] - 1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node, (teamIndex == 0) ? ALLIANCE : HORDE);
// Message to chatlog
if (teamIndex == 0)
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_honorScoreTicks[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
if (m_honorScoreTicks[team] >= m_honorTicks)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_honorScoreTicks[team] -= m_honorTicks;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if (team == BG_TEAM_ALLIANCE)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
if (team == BG_TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
// update achievement flags
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
//.........这里部分代码省略.........
示例3: main
int main(int argc, char* argv[])
#endif
{
int retval;
int ii;
int jj;
#ifdef SYNA_TOOL_BOX
int this_arg = 0;
#else
int this_arg = 1;
#endif
int found = 0;
int readings = 1;
int reading;;
int cartesian = 0;
int patience = PATIENCE;
int report_type;
int report_size;
int rx_num;
int tx_num;
char *report_data_8;
short *report_data_16;
int *report_data_32;
unsigned int *report_data_u32;
struct stat st;
#ifndef SYNA_TOOL_BOX
if (argc == 1) {
usage(argv[0]);
error_exit(EINVAL);
}
#endif
for (ii = 0; ii < NUMBER_OF_INPUTS_TO_SCAN; ii++) {
memset(input_detect, 0x00, MAX_STRING_LEN);
snprintf(input_detect, MAX_STRING_LEN, "%s%d/%s", INPUT_PATH,
(unsigned int)ii, DETECT_FILENAME);
retval = stat(input_detect, &st);
if (retval == 0) {
snprintf(mySensor, MAX_STRING_LEN, "%s%d", INPUT_PATH,
(unsigned int)ii);
found = 1;
break;
}
}
if (!found) {
printf("ERROR: input driver not found\n");
error_exit(ENODEV);
}
while (this_arg < argc) {
if (!strcmp((const char *)argv[this_arg], "-n")) {
this_arg++;
readings = (unsigned int)strtoul(argv[this_arg], NULL, 0);
} else if (!strcmp((const char *)argv[this_arg], "-c")) {
cartesian = 1;
} else {
report_type = strtoul(argv[this_arg], NULL, 0);
}
this_arg++;
}
if (cartesian) {
rx_num = GetRxElectrodes();
tx_num = GetTxElectrodes();
}
switch (report_type) {
case F54_16BIT_IMAGE:
case F54_RAW_16BIT_IMAGE:
case F54_SENSOR_SPEED:
case F54_ADC_RANGE:
case F54_ABS_CAP:
case F54_ABS_DELTA:
break;
default:
DoPreparation(1);
break;
}
for (reading = 0; reading < readings; reading++) {
patience = PATIENCE;
SetReportType(report_type);
GetReport(1);
do {
if (GetStatus() != STATUS_BUSY)
break;
usleep(1000);
} while (--patience > 0);
report_size = ReadReportSize();
if (report_size == 0) {
printf("ERROR: unable to read report\n");
DoReset(1);
error_exit(EINVAL);
}
if (!data_buffer) {
data_buffer = malloc(report_size);
//.........这里部分代码省略.........
示例4: EventPlayerDroppedFlag
void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
{
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
// just take off the aura
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedUp())
return;
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
{
ClearHordeFlagCarrier();
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
}
}
else
{
if (!IsAllianceFlagPickedUp())
return;
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
{
ClearAllianceFlagCarrier();
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
}
}
return;
}
bool set = false;
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedUp())
return;
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
{
ClearHordeFlagCarrier();
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
m_FlagState[TEAM_INDEX_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
set = true;
}
}
else
{
if (!IsAllianceFlagPickedUp())
return;
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
{
ClearAllianceFlagCarrier();
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
m_FlagState[TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
set = true;
}
}
if (set)
{
UpdateFlagState(source->GetTeam(), 1);
if (source->GetTeam() == ALLIANCE)
{
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
}
else
{
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
}
m_FlagsDropTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_DROP_TIME;
}
}
示例5: EventTeamCapturedPoint
void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 Team = Source->GetTeam();
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY);
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY);
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 2, RESPAWN_ONE_DAY);
if (Team == ALLIANCE)
{
m_TeamPointsCount[BG_TEAM_ALLIANCE]++;
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY);
}
else
{
m_TeamPointsCount[BG_TEAM_HORDE]++;
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY);
}
//buff isn't respawned
m_PointOwnedByTeam[Point] = Team;
m_PointState[Point] = EY_POINT_UNDER_CONTROL;
if (Team == ALLIANCE)
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source);
if (m_BgCreatures[Point])
DelCreature(Point);
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
sLog->outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
// SpawnBGCreature(Point, RESPAWN_IMMEDIATELY);
UpdatePointsIcons(Team, Point);
UpdatePointsCount(Team);
if (Point >= EY_POINTS_MAX)
return;
Creature* trigger = GetBGCreature(Point + 6);//0-5 spirit guides
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, Point+6, Team, BG_EY_TriggerPositions[Point][0], BG_EY_TriggerPositions[Point][1], BG_EY_TriggerPositions[Point][2], BG_EY_TriggerPositions[Point][3]);
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
//aura should only apply to players who have accupied the node, set correct faction for trigger
if (trigger)
{
trigger->setFaction(Team == ALLIANCE ? 84 : 83);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
示例6: PostUpdateImpl
void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (!doorsClosed)
{
if (closeFortressDoorsTimer <= diff)
{
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR01)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR01)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR02)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR02)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_HUMAN_GATE_CLOSEDFX_DOOR03)->RemoveFromWorld();
GetBGObject(BG_IC_GO_DOODAD_ND_WINTERORC_WALL_GATEFX_DOOR03)->RemoveFromWorld();
GetBGObject(BG_IC_GO_ALLIANCE_GATE_1)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_1)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_ALLIANCE_GATE_2)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_2)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_ALLIANCE_GATE_3)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
GetBGObject(BG_IC_GO_HORDE_GATE_3)->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
doorsClosed = true;
} else closeFortressDoorsTimer -= diff;
}
for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
{
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (docksTimer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); ++u)
{
if (Creature* catapult = GetBGCreature(u))
{
if (!catapult->IsAlive())
catapult->Respawn(true);
}
}
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); ++u)
{
if (Creature* glaiveThrower = GetBGCreature(u))
{
if (!glaiveThrower->IsAlive())
glaiveThrower->Respawn(true);
}
}
docksTimer = DOCKS_UPDATE_TIME;
} else docksTimer -= diff;
}
}
if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
{
if (siegeEngineWorkshopTimer <= diff)
{
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
{
if (siege->IsAlive())
{
if (siege->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC))
// following sniffs the vehicle always has UNIT_FLAG_UNK_14
siege->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC);
else
siege->SetHealth(siege->GetMaxHealth());
}
else
siege->Respawn(true);
}
// we need to confirm if it is every 3 minutes
for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); ++u)
{
if (Creature* demolisher = GetBGCreature(u))
{
if (!demolisher->IsAlive())
demolisher->Respawn(true);
}
}
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
} else siegeEngineWorkshopTimer -= diff;
}
}
// the point is waiting for a change on its banner
if (nodePoint[i].needChange)
//.........这里部分代码省略.........
示例7: EventPlayerClickedOnFlag
/* Invoked if a player used a banner as a gameobject */
void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 node = BG_AB_NODE_STABLES;
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[node*8+7]);
while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10))))
{
++node;
obj = GetBgMap()->GetGameObject(BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
}
if (node == BG_AB_DYNAMIC_NODES_COUNT)
{
// this means our player isn't close to any of banners - maybe cheater ??
return;
}
BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
// Check if player really could use this banner, not cheated
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
return;
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
uint32 sound = 0;
// If node is neutral, change to contested
if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] = teamIndex + 1;
// burn current neutral banner
_DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0);
// create new contested banner
_CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
_SendNodeUpdate(node);
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: team and node names not localized
if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY);
else
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
sound = BG_AB_SOUND_NODE_CLAIMED;
}
// If node is contested
else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
{
// If last state is NOT occupied, change node to enemy-contested
if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new contested banner
_CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
_SendNodeUpdate(node);
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: node names not localized
if (teamIndex == BG_TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
// If contested, change back to occupied
else
{
UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1);
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
m_NodeTimers[node] = 0;
_NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE);
// FIXME: node names not localized
if (teamIndex == BG_TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
// If node is occupied, change to enemy-contested
else
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
// burn current occupied banner
//.........这里部分代码省略.........
示例8: strcpy
void EVA::clbkPreStep (double simt, double SimDT, double mjd)
{
char EVAName[256]="";
char CSMName[256]="";
char MSName[256]="";
strcpy(EVAName,GetName());
double VessCount;
int i=0;
VessCount=oapiGetVesselCount();
hMaster=oapiGetVesselByIndex(i);
while (i<VessCount)i++;{
oapiGetObjectName(hMaster,MSName,256);
strcpy(CSMName,MSName);strcat(CSMName,"-EVA");
if (strcmp(CSMName,EVAName)==0)
{
i=int(VessCount);
}
}
sprintf(oapiDebugString(), "EVA Cable Attached to %s", MSName);
VESSELSTATUS csmV;
VESSELSTATUS evaV;
VESSEL *csmvessel;
VECTOR3 rdist = {0,0,0};
VECTOR3 posr = {0,0,0};
VECTOR3 rvel = {0,0,0};
VECTOR3 RelRot = {0,0,0};
double dist = 0.0;
double Vel = 0.0;
if (hMaster)
{
csmvessel = oapiGetVesselInterface(hMaster);
oapiGetRelativePos (GetHandle() ,hMaster, &posr);
oapiGetRelativeVel (GetHandle() ,hMaster , &rvel);
GetStatus(evaV);
csmvessel->GetStatus(csmV);
GlobalRot (posr, RelRot);
dist = sqrt(posr.x * posr.x + posr.y * posr.y + posr.z * posr.z);
Vel = sqrt(rvel.x * rvel.x + rvel.y * rvel.y + rvel.z * rvel.z);
if (dist >= 25)
{
rvel = evaV.rvel-csmV.rvel;
rvel.x = -rvel.x;
rvel.y = -rvel.y;
rvel.z = -rvel.z;
GetStatus(evaV);
csmvessel->GetStatus(csmV);
evaV.rvel = csmV.rvel + rvel;
DefSetState(&evaV);
}
if (GoDock1){
sprintf(oapiDebugString(), "EVA Back CSM Mode Relative Distance M/s %f", dist);
if (dist <= 0.55 && dist>=0.50 ){
GoDock1 =false;
oapiSetFocusObject(hMaster);
oapiDeleteVessel(GetHandle());
}
}
}
}
示例9: PostUpdateImpl
void BattlegroundBFG::PostUpdateImpl(uint32 diff)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < GILNEAS_BG_DYNAMIC_NODES_COUNT; ++node)
{
// 3 sec delay to spawn new a banner.
if (m_BannerTimers[node].timer)
{
if (m_BannerTimers[node].timer > diff)
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute cap timer on each node from a contested state.
if (m_NodeTimers[node])
{
if (m_NodeTimers[node] > diff)
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node] - 1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// burn current contested banner
_DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex);
// create new occupied banner
_CreateBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node, (teamIndex == 0) ? ALLIANCE : HORDE);
// Message to chatlog
if (teamIndex == 0)
{
// FIXME: need to fix Locales for team and nodes names.
SendMessage2ToAll(LANG_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_BG_ALLY, _GetNodeNameId(node));
PlaySoundToAll(GILNEAS_BG_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
// FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_BG_HORDE, _GetNodeNameId(node));
PlaySoundToAll(GILNEAS_BG_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + GILNEAS_BG_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > GILNEAS_BG_TickIntervals[points])
{
m_lastTick[team] -= GILNEAS_BG_TickIntervals[points];
m_TeamScores[team] += GILNEAS_BG_TickPoints[points];
m_HonorScoreTicks[team] += GILNEAS_BG_TickPoints[points];
m_ReputationScoreTicks[team] += GILNEAS_BG_TickPoints[points];
if (m_ReputationScoreTicks[team] >= m_ReputationTicks)
{
//(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTicks[team] -= m_ReputationTicks;
}
if (m_HonorScoreTicks[team] >= m_HonorTicks)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE); //BG=BFG
m_HonorScoreTicks[team] -= m_HonorTicks;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > GILNEAS_BG_WARNING_NEAR_VICTORY_SCORE) //BG=BFG
{
if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(GILNEAS_BG_SOUND_NEAR_VICTORY);
//.........这里部分代码省略.........
示例10: statusChanged
void GlooxCLEntry::SetAuthRequested (bool auth)
{
AuthRequested_ = auth;
emit statusChanged (GetStatus (QString ()), QString ());
emit groupsChanged (Groups ());
}
示例11: sc_ioctl
//.........这里部分代码省略.........
kfree(dn);
return 0;
}
else {
pr_debug("%s: SCIOCSETDN: command failed (status = %d)\n",
sc_adapter[card]->devicename, status);
kfree(rcvmsg);
kfree(dn);
return status;
}
}
case SCIOCTRACE:
pr_debug("%s: SCIOTRACE: ioctl received\n",
sc_adapter[card]->devicename);
/* sc_adapter[card]->trace = !sc_adapter[card]->trace;
pr_debug("%s: SCIOCTRACE: tracing turned %s\n",
sc_adapter[card]->devicename,
sc_adapter[card]->trace ? "ON" : "OFF"); */
break;
case SCIOCSTAT:
{
boardInfo *bi;
pr_debug("%s: SCIOSTAT: ioctl received\n",
sc_adapter[card]->devicename);
bi = kmalloc (sizeof(boardInfo), GFP_KERNEL);
if (!bi) {
kfree(rcvmsg);
return -ENOMEM;
}
kfree(rcvmsg);
GetStatus(card, bi);
if (copy_to_user(data->dataptr, bi, sizeof(boardInfo))) {
kfree(bi);
return -EFAULT;
}
kfree(bi);
return 0;
}
case SCIOCGETSPEED:
{
pr_debug("%s: SCIOGETSPEED: ioctl received\n",
sc_adapter[card]->devicename);
/*
* Get the speed from the board
*/
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
ceReqCallGetCallType, data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT);
if (!status && !(rcvmsg->rsp_status)) {
pr_debug("%s: SCIOCGETSPEED: command successful\n",
sc_adapter[card]->devicename);
}
else {
pr_debug("%s: SCIOCGETSPEED: command failed (status = %d)\n",
sc_adapter[card]->devicename, status);
kfree(rcvmsg);
return status;
}
speed = rcvmsg->msg_data.byte_array[0];
kfree(rcvmsg);
/*
* Package the switch type and send to user space
*/
if (copy_to_user(data->dataptr, &speed, sizeof(char)))
return -EFAULT;
return 0;
}
case SCIOCSETSPEED:
pr_debug("%s: SCIOCSETSPEED: ioctl received\n",
sc_adapter[card]->devicename);
break;
case SCIOCLOOPTST:
pr_debug("%s: SCIOCLOOPTST: ioctl received\n",
sc_adapter[card]->devicename);
break;
default:
kfree(rcvmsg);
return -1;
}
kfree(rcvmsg);
return 0;
}
示例12: GetRuntimeStatus
DWORD GetRuntimeStatus ( LPCWSTR subscriptionName)
{
DWORD dwEventSourceCount, dwRetVal = ERROR_SUCCESS;
std::vector<BYTE> buffer;
std::vector<BYTE> eventSourceBuffer;
PEC_VARIANT vStatus, vProperty, vEventSource;
EC_OBJECT_ARRAY_PROPERTY_HANDLE hArray =NULL;
EC_HANDLE hSubscription;
RUNTIME_STATUS runtimeStatus;
//Open the subscription for query
hSubscription = EcOpenSubscription(subscriptionName, EC_READ_ACCESS, EC_OPEN_EXISTING);
if (!hSubscription)
{
return GetLastError();
}
dwRetVal = GetProperty(hSubscription, EcSubscriptionEventSources, 0,buffer, vProperty);
if ( ERROR_SUCCESS != dwRetVal )
goto Cleanup;
//Ensure that we have obtained handle to the Array Property
if ( vProperty->Type != EcVarTypeNull && vProperty->Type!= EcVarObjectArrayPropertyHandle)
{
dwRetVal = ERROR_INVALID_DATA;
goto Cleanup;
}
hArray = (vProperty->Type == EcVarTypeNull) ? NULL: vProperty->PropertyHandleVal ;
if( !hArray)
{
dwRetVal = ERROR_INVALID_DATA;
goto Cleanup;
}
// Get the EventSources array size (number of elements)
if ( !EcGetObjectArraySize(hArray,
&dwEventSourceCount ) )
{
dwRetVal = GetLastError();
goto Cleanup;
}
for ( DWORD i = 0; i < dwEventSourceCount ; i++)
{
dwRetVal = GetArrayProperty( hArray,
EcSubscriptionEventSourceAddress,
i,
0,
eventSourceBuffer,
vEventSource);
if (ERROR_SUCCESS != dwRetVal)
{
goto Cleanup;
}
if (vEventSource->Type != EcVarTypeNull && vEventSource->Type != EcVarTypeString)
{
dwRetVal = ERROR_INVALID_DATA;
goto Cleanup;
}
LPCWSTR eventSource = (vEventSource->Type == EcVarTypeNull) ? NULL: vEventSource->StringVal;
if (!eventSource)
continue;
dwRetVal = GetStatus( subscriptionName,
eventSource,
EcSubscriptionRunTimeStatusActive,
0,
buffer,
vStatus);
if( ERROR_SUCCESS != dwRetVal )
goto Cleanup;
if( vStatus->Type != EcVarTypeUInt32 )
{
dwRetVal = ERROR_INVALID_DATA;
goto Cleanup;
}
switch (vStatus->UInt32Val)
{
case EcRuntimeStatusActiveStatusActive:
runtimeStatus.ActiveStatus = L"Active";
break;
case EcRuntimeStatusActiveStatusDisabled:
runtimeStatus.ActiveStatus = L"Disabled";
//.........这里部分代码省略.........
示例13: body
inline int body() {
if( NT_SUCCESS( status ) ) {
ExAcquireFastMutex();
SetFlags();
ExReleaseFastMutex();
WarmPollPeriod = HtRegGetDword();
if( WarmPollPeriod < 5 ) {
WarmPollPeriod = 5;
} else {
if( WarmPollPeriod > 20 ) {
WarmPollPeriod = 20;
}
}
{
if (nondet()) {
// We've got it. Now get a pointer to it.
polling = 1;
if(nondet()) {
//---------------------------------------------
{
LARGE_INTEGER timeOut1;
NTSTATUS status;
UCHAR deviceStatus;
PCHAR devId;
BOOLEAN requestRescan;
const ULONG pollingFailureThreshold = 10; //pick an arbitrary but reasonable number
do {
if( PowerStateIsAC ) {
} else {
}
status = KeWaitForSingleObject();
if( nondet() ) {
break;
}
if( !PowerStateIsAC ) {
goto loc_continue;
}
if( STATUS_TIMEOUT == status ) {
if( nondet() ) {
// try to acquire port
if( HtTryAllocatePort() ) {
requestRescan = FALSE;
// check for something connected
deviceStatus = GetStatus();
if( nondet()) {
} else {
// we might have something connected
// try a device ID to confirm
devId = P4ReadRawIeee1284DeviceId();
if( devId ) {
PCHAR mfg, mdl, cls, des, aid, cid;
// RawIeee1284 string includes 2 bytes of length data at beginning
HTPnpFindDeviceIdKeys();
if( mfg && mdl ) {
requestRescan = TRUE;
}
} else {
}
if( requestRescan ) {
} else {
if(nondet() ) {
}
}
}
HtFreePort( );
if( requestRescan ) {
IoInvalidateDeviceRelations();
}
} else {
}
} else {
}
}
loc_continue: { int ddd; ddd = ddd; }
} while( TRUE );
}
//---------------------------------------------
polling = 0;
} else {
polling = 0;
// error
}
//.........这里部分代码省略.........
示例14: GetStatus
UserStatus::RankContainer User::GetRank()
{
return GetStatus().rank;
}
示例15: autolock
//
// Remove the unit device ID from the list
//
BOOL
CNdasLogicalDevice::RemoveUnitDevice(CNdasUnitDevice& unitDevice)
{
ximeta::CAutoLock autolock(this);
DWORD ldSequence = unitDevice.GetLDSequence();
_ASSERTE(ldSequence < m_logicalDeviceGroup.nUnitDevices);
if (ldSequence >= m_logicalDeviceGroup.nUnitDevices) {
DBGPRT_ERR(_FT("Invalid sequence (%d) of the unit device.\n"), ldSequence);
return FALSE;
}
_ASSERTE(&unitDevice == m_pUnitDevices[ldSequence]);
if (&unitDevice != m_pUnitDevices[ldSequence]) {
DBGPRT_ERR(_FT("Unit device in sequence (%d) is not occupied.\n"), ldSequence);
return FALSE;
}
m_pUnitDevices[ldSequence]->Release();
m_pUnitDevices[ldSequence] = NULL;
//
// Workaround for Fault-tolerant Mode
// -> Even if the logical device is incomplete,
// Mounted Logical Device Location should be intact
// if it is mounted
//
if (NDAS_LOGICALDEVICE_STATUS_MOUNT_PENDING == GetStatus() ||
NDAS_LOGICALDEVICE_STATUS_MOUNTED == GetStatus() ||
NDAS_LOGICALDEVICE_STATUS_UNMOUNT_PENDING == GetStatus())
{
--m_nUnitDeviceInstances;
return TRUE;
}
if (IsComplete()) {
CNdasLogicalDeviceManager* pLdm = pGetNdasLogicalDeviceManager();
pLdm->UnregisterNdasScsiLocation(m_NdasScsiLocation);
}
--m_nUnitDeviceInstances;
//
// Deallocation NDAS SCSI Location when the fist unit device is removed
//
if (0 == ldSequence) {
cpDeallocateNdasScsiLocation();
}
//
// Publish Event
//
CNdasEventPublisher* pEventPublisher = pGetNdasEventPublisher();
(VOID) pEventPublisher->LogicalDeviceRelationChanged(m_logicalDeviceId);
//
// Set Device Error
//
SetLastDeviceError(NDAS_LOGICALDEVICE_ERROR_MISSING_MEMBER);
return TRUE;
}