这篇教程C++ GetUnit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetUnit函数的典型用法代码示例。如果您正苦于以下问题:C++ GetUnit函数的具体用法?C++ GetUnit怎么用?C++ GetUnit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetUnit函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetUnitPSPower* PSProvince::GetOccupant(PSData* pData){ // Returns a pointer to the Power that occupies this province or NULL if it is empty. if (!pData) pData = TG.GetData(); PSUnit* pUnit = GetUnit(pData); if (!pUnit) return NULL; return pUnit->GetOwner();}
开发者ID:twilson-sf,项目名称:diplo,代码行数:12,
示例2: OnCombatStop void OnCombatStop() { RemoveAIUpdateEvent(); // well, we are alive and our opponent ran away or died. // notify twiggy and despawn TwiggyFlatheadAI *twiggy = (TwiggyFlatheadAI *)GetLinkedCreature(); if(twiggy) twiggy->OnBigWillSurvived(); GetUnit()->Despawn(1,0); }
开发者ID:Refuge89,项目名称:arcscripts2,代码行数:12,
示例3: GetFloatValuedouble nsCSSValue::GetAngleValueInRadians() const{ double angle = GetFloatValue(); switch (GetUnit()) { case eCSSUnit_Radian: return angle; case eCSSUnit_Degree: return angle * M_PI / 180.0; case eCSSUnit_Grad: return angle * M_PI / 200.0; default: NS_ABORT_IF_FALSE(false, "unrecognized angular unit"); return 0.0; }}
开发者ID:krellian,项目名称:mozilla-central,代码行数:14,
示例4: GetNextItemvoid CUnitPane::OnRClick(wxListEvent& event){ wxMenu menu; long idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); CUnit * pUnit = GetUnit(idx); int x=0,y; int width, height; int nItems = GetSelectedItemCount(); wxDisplaySize(&width, &height); y = event.GetPoint().y; ClientToScreen(&x, &y); if (height-y < 150) y = height-150; ScreenToClient(&x, &y); if (nItems>1) { // multiple units menu.Append(menu_Popup_IssueOrders , wxT("Issue orders")); menu.Append(menu_Popup_UnitFlags , wxT("Set custom flags") ); menu.Append(menu_Popup_AddToTracking , wxT("Add to a tracking group")); PopupMenu( &menu, event.GetPoint().x, y); } else if (pUnit) { // single unit if (pUnit->IsOurs) { menu.Append(menu_Popup_ShareSilv , wxT("Share SILV") ); menu.Append(menu_Popup_Teach , wxT("Teach") ); menu.Append(menu_Popup_Split , wxT("Split") ); menu.Append(menu_Popup_DiscardJunk , wxT("Discard junk items")); menu.Append(menu_Popup_GiveEverything, wxT("Give everything") ); menu.Append(menu_Popup_DetectSpies , wxT("Detect spies") ); } menu.Append(menu_Popup_UnitFlags , wxT("Set custom flags") ); menu.Append(menu_Popup_AddToTracking , wxT("Add to a tracking group")); PopupMenu( &menu, event.GetPoint().x, y); }}
开发者ID:ennorehling,项目名称:alh,代码行数:49,
示例5: Start // private stuff bool Start() { if(active) return false; // all is fine, lets start the affray active = true; phase = 0; GetUnit()->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "The Affray has begun. Choperation. get ready to fight!"); // after 5 seconds, start RegisterAIUpdateEvent(5000); return true; }
开发者ID:Refuge89,项目名称:arcscripts2,代码行数:16,
示例6: GetUnitbool CAICheats::GetUnitResourceInfo(int unitId, UnitResourceInfo* unitResInf) const{ bool fetchOk = false; const CUnit* unit = GetUnit(unitId); if (unit) { unitResInf->energyMake = unit->resourcesMake.energy; unitResInf->energyUse = unit->resourcesUse.energy; unitResInf->metalMake = unit->resourcesMake.metal; unitResInf->metalUse = unit->resourcesUse.metal; fetchOk = true; } return fetchOk;}
开发者ID:nixtux,项目名称:spring,代码行数:15,
示例7: Allowbool UnitContainer::Allow( const Unit *unit ) const { if ( !Allow( unit->Type() ) ) return false; int i; for ( i = UnitCount() - 1; i >= 0; --i ) if ( GetUnit(i) == unit ) return true; if ( unit->IsTransport() ) { const Transport *t = static_cast<const Transport *>(unit); if ( Crystals() + t->Crystals() > MaxCrystals() ) return false; for ( i = t->UnitCount() - 1; i >= 0; --i ) if ( !Allow( t->GetUnit(i) ) ) return false; } return uc_slots >= uc_slots_full + unit->Weight();}
开发者ID:drodin,项目名称:Crimson,代码行数:18,
示例8: GetAdjacentEnemyDataEnemies GetAdjacentEnemyData(Unit unit) { Enemies enemies; enemies.count = 0; char color = GetUnitColor(unit); Grids adjacentGrids = GetAdjacentGrids(*GetGrid(GetLocation(unit))); for (unsigned int i = 0; i < adjacentGrids.count; i++) { Grid grid = *adjacentGrids.grids[i]; if (isOccupied(grid) && !isOccupiedByAlly(grid, color)) { Unit *enemy = GetUnit(grid); enemies.enemy[enemies.count].unit = enemy; enemies.enemy[enemies.count].canRetaliate = Retaliates(unit, *enemy); ++enemies.count; } } return enemies;}
开发者ID:Septica,项目名称:if2110-battle_for_olympia,代码行数:19,
示例9: COMMAND_INFOvoid COMMAND_INFO() { int x, y; do { printf("Enter the coordinate of the cell: "); scanf("%d %d", &x, &y); } while (!isValidCoordinate(x, y)); Grid *grid = GetGrid(MakePOINT(x, y)); Type type = GetType(*grid); Player *gridOwner = GetOwner(*grid); Unit *unit = GetUnit(*grid); printf("== Cell Info ==/n"); if (type == Normal) { printf("Normal/n"); } else if (type == Tower) { printf("Tower/n"); } else if (type == Castle) { printf("Castle/n"); } else if (type == Village) { printf("Village/n"); } printf("Owned by Player %d/n", GetPlayerIndex(*gridOwner)); if (unit) { Player *unitOwner = GetPlayerFromColor(GetUnitColor(*unit)); char unitClassName[11]; UnitClassName(GetUnitClass(*unit), unitClassName); printf("== Unit Info ==/n"); printf("%s/n", unitClassName); printf("Owned by Player %d/n", GetPlayerIndex(*unitOwner)); printf("Health %d/%d | ATK %d/n", GetHealth(*unit), GetMaximumHealth(*unit), GetAttack(*unit) ); } printf("/n");}
开发者ID:Septica,项目名称:if2110-battle_for_olympia,代码行数:42,
示例10: MapAttributesIntoRulestatic voidMapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData){ if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Position)) { nsCSSValue* width = aData->ValueForWidth(); if (width->GetUnit() == eCSSUnit_Null) { // width: int (html4 attribute == nav4 cols) const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); if (!value || value->Type() != nsAttrValue::eInteger) { // cols: int (nav4 attribute) value = aAttributes->GetAttr(nsGkAtoms::cols); } if (value && value->Type() == nsAttrValue::eInteger) width->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Char); } } if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) { nsCSSValue* whiteSpace = aData->ValueForWhiteSpace(); if (whiteSpace->GetUnit() == eCSSUnit_Null) { // wrap: empty if (aAttributes->GetAttr(nsGkAtoms::wrap)) whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated); // width: int (html4 attribute == nav4 cols) const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width); if (!value || value->Type() != nsAttrValue::eInteger) { // cols: int (nav4 attribute) value = aAttributes->GetAttr(nsGkAtoms::cols); } if (value && value->Type() == nsAttrValue::eInteger) { // Force wrap property on since we want to wrap at a width // boundary not just a newline. whiteSpace->SetIntValue(NS_STYLE_WHITESPACE_PRE_WRAP, eCSSUnit_Enumerated); } } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);}
开发者ID:ehsan,项目名称:mozilla-history,代码行数:42,
示例11: WXUNUSEDvoid CUnitPane::OnPopupMenuDiscardJunk(wxCommandEvent& WXUNUSED(event)){ long idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); CUnit * pUnit = GetUnit(idx); CEditPane * pOrders; if (pUnit) { pOrders = (CEditPane*)gpApp->m_Panes[AH_PANE_UNIT_COMMANDS]; if (pOrders) pOrders->SaveModifications(); if (m_pCurLand) m_pCurLand->guiUnit = pUnit->Id; gpApp->SetOrdersChanged(gpApp->m_pAtlantis->DiscardJunkItems(pUnit, gpApp->GetConfig(SZ_SECT_UNITPROP_GROUPS, PRP_JUNK_ITEMS)) || gpApp->GetOrdersChanged()); Update(m_pCurLand); }}
开发者ID:ennorehling,项目名称:alh,代码行数:20,
示例12: switchbool CAICheats::GetProperty(int id, int property, void *data) const{ bool fetchOk = false; switch (property) { case AIVAL_UNITDEF: { const CUnit* unit = GetUnit(id); if (unit) { (*(const UnitDef**) data) = unit->unitDef; fetchOk = true; } break; } default: { fetchOk = false; } } return fetchOk;}
开发者ID:nixtux,项目名称:spring,代码行数:20,
示例13: UnitData//---------------------------------------------------------------------------// --- Methods :: Unit --- ////---------------------------------------------------------------------------UnitData* UnitDatas::CreateUnit (INT32 nCol, INT32 nRow){ if (nCol >= _nCountCols || nRow >= _nCountRows) { return NULL; } UnitData newData = UnitData(nCol, nRow); if (!IsExistsUnit(nCol, nRow)) { _lstUnit.push_back(newData); return GetUnit(nCol, nRow); } else { return NULL; }}
开发者ID:japgo,项目名称:mygithub,代码行数:23,
示例14: OnReachWP void OnReachWP(uint32 iWaypointId, bool bForwards) { if( iWaypointId == 1 ) { switch( RandomUInt(2) ) { case 0: Emote( "Life from the lifelessness... death for you.", Text_Yell, 13961); break; case 1: Emote( "Nothing is wasted in the process. You will see....", Text_Yell, 13962); break; }; MoonScriptCreatureAI* pAnvil = GetNearestCreature( CN_VOLKHANS_ANVIL ); if( pAnvil ) _unit->CastSpell( pAnvil->GetUnit(), SPELL_TEMPER, true ); else _unit->CastSpell( GetUnit(), SPELL_TEMPER, true ); SetCanEnterCombat( true ); _unit->GetAIInterface()->AttackReaction( GetNearestPlayer() , 1 ); // hackfix }; };
开发者ID:Desch,项目名称:Edge-of-Chaos,代码行数:20,
示例15: sscanf//---------------------------------------------------------------------------void __fastcall TFMain_11011981::lbUnitsDblClick(TObject *Sender){ DWORD adr; String item = lbUnits->Items->Strings[lbUnits->ItemIndex]; sscanf(item.c_str() + 1, "%lX", &adr); PUnitRec recU = GetUnit(adr); if (!CurUnitAdr || adr != CurUnitAdr) { CurUnitAdr = adr; ShowUnitItems(recU, 0, -1); } else { ShowUnitItems(recU, lbUnitItems->TopIndex, lbUnitItems->ItemIndex); } CurUnitAdr = adr;}
开发者ID:GotoHack,项目名称:IDR,代码行数:21,
示例16: dlgvoid CUnitPane::OnPopupMenuIssueOrders(wxCommandEvent& event){ long idx; CUnit * pUnit; CEditPane * pOrders; BOOL Changed = FALSE; CGetTextDlg dlg(this, "Order", "Orders for the selected units"); if (wxID_OK != dlg.ShowModal()) return; dlg.m_Text.TrimRight(TRIM_ALL); if (dlg.m_Text.IsEmpty()) return; pOrders = (CEditPane*)gpApp->m_Panes[AH_PANE_UNIT_COMMANDS]; if (pOrders) pOrders->SaveModifications(); idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); while (idx>=0) { pUnit = GetUnit(idx); if (pUnit->IsOurs) { Changed = TRUE; pUnit->Orders.TrimRight(TRIM_ALL); if (!pUnit->Orders.IsEmpty()) pUnit->Orders << EOL_SCR; pUnit->Orders << dlg.m_Text; } idx = GetNextItem(idx, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } if (Changed) { gpApp->SetOrdersChanged(TRUE); gpApp->m_pAtlantis->RunOrders(m_pCurLand); Update(m_pCurLand); }}
开发者ID:ennorehling,项目名称:alh,代码行数:41,
示例17: switchObject* MapMgr::_GetObject(const uint64 & guid){ switch(GET_TYPE_FROM_GUID(guid)) { case HIGHGUID_TYPE_GAMEOBJECT: return GetGameObject(GET_LOWGUID_PART(guid)); break; case HIGHGUID_TYPE_UNIT: return GetCreature(GET_LOWGUID_PART(guid)); break; case HIGHGUID_TYPE_DYNAMICOBJECT: return GetDynamicObject((uint32)guid); break; case HIGHGUID_TYPE_TRANSPORTER: return objmgr.GetTransporter(GUID_LOPART(guid)); break; default: return GetUnit(guid); break; }}
开发者ID:Chero,项目名称:abcwow,代码行数:21,
示例18: GetUnitint CAICallback::SendUnits(const std::vector<int>& unitIds, int receivingTeamId){ typedef unsigned char ubyte; std::vector<short> sentUnitIDs; if ((team != receivingTeamId) && teamHandler->IsValidTeam(receivingTeamId) && teamHandler->Team(receivingTeamId) && teamHandler->Team(team) && !teamHandler->Team(receivingTeamId)->isDead && !teamHandler->Team(team)->isDead) { // we must iterate over the ID's to check if // all of them really belong to the AI's team std::vector<int>::const_iterator uid; for (uid = unitIds.begin(); uid != unitIds.end(); ++uid) { const int unitId = *uid; const CUnit* unit = GetUnit(unitId); if (unit && unit->team == team) { // we own this unit, save it // (note: safe cast since MAX_UNITS currently fits in a short) sentUnitIDs.push_back(short(unitId)); // stop whatever this unit is doing Command c(CMD_STOP); GiveOrder(unitId, &c); } } if (!sentUnitIDs.empty()) { // we ca not use SendShare() here either, since // AIs do not have a notion of "selected units" net->Send(CBaseNetProtocol::Get().SendAIShare(ubyte(gu->myPlayerNum), skirmishAIHandler.GetCurrentAIID(), ubyte(team), ubyte(receivingTeamId), 0.0f, 0.0f, sentUnitIDs)); } } // return how many units were actually put up for transfer return (sentUnitIDs.size());}
开发者ID:AlexDiede,项目名称:spring,代码行数:40,
示例19: posvoid ClientGame::UpdateCamera(Miliseconds aFrameTime) const{ Ogre::Vector3 pos(Ogre::Vector3::ZERO); Ogre::Quaternion ort(Ogre::Quaternion::ZERO); if (ClientUnit* avatar = GetUnit(mAvatar)) { GetCameraPosAndOrt(avatar->GetPosition(), pos, ort); } if (mFreeCamera) { mAxes->setOrientation(ort); mAxes->setPosition(pos); FreeCameraControl(aFrameTime); } else { ClientApp::GetCamera().setPosition(pos); ClientApp::GetCamera().setOrientation(ort); }}
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:22,
示例20: GetCurPartvoid LIB_EDIT_FRAME::pasteClipboard( const wxPoint& aOffset ){ LIB_PART* part = GetCurPart(); if( !part || m_clipboard.GetCount() == 0 ) return; for( unsigned int i = 0; i < m_clipboard.GetCount(); i++ ) { // Append a copy to the current part, so the clipboard buffer might be pasted multiple times LIB_ITEM* item = (LIB_ITEM*) m_clipboard.GetItem( i )->Clone(); item->SetParent( part ); item->SetSelected(); item->SetUnit( GetUnit() ); part->AddDrawItem( item ); } BlockMoveSelectedItems( aOffset, GetCurPart(), &GetScreen()->m_BlockLocate ); RebuildView(); GetCanvas()->Refresh(); OnModify();}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:22,
示例21: OnLoad void OnLoad() { // we are friendly on spawn until we reach the battle place GetUnit()->SetFaction(35); // Get Twiggy Flathead and store him as linked creature to have nice and easy access to him Creature *twiggy = GetUnit()->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(SPAWNPOINT_TWIGGYFLATHEAD, NPC_TWIGGYFLATHEAD); if(twiggy) SetLinkedCreature(twiggy->GetScript()); // set path to walk along to the affray sEAS.CreateCustomWaypointMap(GetUnit()); sEAS.WaypointCreate(GetUnit(), -1698, -4344.0f, 4.6f, 0.2f, 0, RUN, 0); sEAS.WaypointCreate(GetUnit(), -1684, -4335.0f, 2.9f, 0.7f, 0, RUN, 0); sEAS.WaypointCreate(GetUnit(), -1683, -4329.0f, 2.8f, 0.0f, 0, RUN, 0); sEAS.EnableWaypoints(GetUnit()); // after 3 minutes we will despawn unless something happens RegisterAIUpdateEvent(3*60*1000); }
开发者ID:Refuge89,项目名称:arcscripts2,代码行数:20,
示例22: CUIImageSplitCUIBase* CUIImageSplit::Clone(){ CUIImageSplit* pImg = new CUIImageSplit(*this); pImg->setTexString( getTexString() ); pImg->SetSplitMode( (eSPLIT_TYPE)GetMode() ); pImg->SetUnit( GetUnit() ); CUIRectSurface* pRS = NULL; pRS = GetSurface(); if( pRS != NULL ) { { CUIRectSurface* pCopy = new CUIRectSurface; pCopy->CopyRectSurface(pRS); pImg->SetSurface(pCopy); } } CUIBase::CloneChild(pImg); return pImg;}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:23,
示例23: GetCellbool Field::Kill(std::shared_ptr<Unit> unit, const size_t reason) { auto cell = GetCell(unit->GetX(), unit->GetY()); Application *gui = Application::GetInstance(); if (cell->GetUnit() == unit) { const size_t id = unit->GetId(); *gui << "Unit "<< id << " is dead: " << pimpl_->GetReason(reason) << "/n"; const size_t x = unit->GetX(); const size_t y = unit->GetY(); const double energy = unit->GetDna("normal_weight"); const bool carnivore = unit->IsCarnivore(); cell->RemoveObject(); gui->RemoveObject(unit); unit->alive_ = false; unit->RemoveStatistics(); InsertNmo(std::make_shared<Flesh>(energy, carnivore), x, y); *gui << "Flesh of unit " << id << " inserted at: " << x << ", " << y << "/n"; return true; } else { *gui << "/nERROR: Possible lose of some object. Program will continue./n"; return false; }}
开发者ID:evolvazpr,项目名称:evolva,代码行数:23,
注:本文中的GetUnit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetUnitOwner函数代码示例 C++ GetUniqueItem函数代码示例 |