本文整理汇总了C++中GetUnit函数的典型用法代码示例。如果您正苦于以下问题:C++ GetUnit函数的具体用法?C++ GetUnit怎么用?C++ GetUnit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetUnit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetUnit
PSPower* 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,代码来源:Province.cpp
示例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,代码来源:Quest_Warrior.cpp
示例3: GetFloatValue
double 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,代码来源:nsCSSValue.cpp
示例4: GetNextItem
void 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,代码来源:unitpane.cpp
示例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,代码来源:Quest_Warrior.cpp
示例6: GetUnit
bool 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,代码来源:AICheats.cpp
示例7: Allow
bool 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,代码来源:container.cpp
示例8: GetAdjacentEnemyData
Enemies 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,代码来源:attack.c
示例9: COMMAND_INFO
void 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,代码来源:printinfo.c
示例10: MapAttributesIntoRule
static void
MapAttributesIntoRule(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,代码来源:nsHTMLPreElement.cpp
示例11: WXUNUSED
void 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,代码来源:unitpane.cpp
示例12: switch
bool 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,代码来源:AICheats.cpp
示例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,代码来源:unitdatas.cpp
示例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,代码来源:Instance_HallsOfLightning.cpp
示例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,代码来源:TabUnits.cpp
示例16: dlg
void 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,代码来源:unitpane.cpp
示例17: switch
Object* 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,代码来源:MapMgr.cpp
示例18: GetUnit
int 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,代码来源:AICallback.cpp
示例19: pos
void 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,代码来源:ClientGame.cpp
示例20: GetCurPart
void 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,代码来源:block_libedit.cpp
注:本文中的GetUnit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论