本文整理汇总了C++中CDesignType类的典型用法代码示例。如果您正苦于以下问题:C++ CDesignType类的具体用法?C++ CDesignType怎么用?C++ CDesignType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDesignType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntry
void CDesignCollection::Reinit (void)
// Reinit
//
// Reinitialize all types
{
int i;
// Reinitialize some global classes
CStationType::Reinit();
// For reinit that requires two passes
for (i = 0; i < GetCount(); i++)
{
CDesignType *pType = GetEntry(i);
pType->PrepareReinit();
}
// Reinit design
for (i = 0; i < GetCount(); i++)
{
CDesignType *pType = GetEntry(i);
pType->Reinit();
}
}
示例2: AddMatchingKeyEvents
bool CPlayerGameStats::AddMatchingKeyEvents (const CString &sNodeID, const CDesignTypeCriteria &Crit, TArray<SKeyEventStats> *pEventList, TArray<SKeyEventStatsResult> *retList) const
// AddMatchingKeyEvents
//
// Adds all of the matching events from pEventList to the result
{
int i;
for (i = 0; i < pEventList->GetCount(); i++)
{
SKeyEventStats *pStats = &pEventList->GetAt(i);
CDesignType *pType = g_pUniverse->FindDesignType(pStats->dwObjUNID);
if (pType == NULL)
continue;
if (pType->MatchesCriteria(Crit))
{
SKeyEventStatsResult *pResult = retList->Insert();
pResult->sNodeID = sNodeID;
pResult->pStats = pStats;
pResult->bMarked = false;
}
}
return true;
}
示例3: GetTradeDescOverride
bool CSpaceObject::GetDeviceRemovePrice (const CItem &Item, DWORD dwFlags, int *retiPrice, DWORD *retdwPriceFlags)
// GetDeviceRemovePrice
//
// Returns the price to install the given device
{
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetDeviceRemovePrice(this, Item, dwFlags, retiPrice, retdwPriceFlags))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetDeviceRemovePrice(this, Item, dwFlags, retiPrice, retdwPriceFlags))
return true;
// Otherwise, we do not remove
return false;
}
示例4: GetEconomyUNIDOrDefault
ALERROR GetEconomyUNIDOrDefault (CCodeChain &CC, ICCItem *pItem, DWORD *retdwUNID)
{
if (pItem == NULL || pItem->IsNil())
{
if (retdwUNID)
*retdwUNID = 0;
}
else if (pItem->IsInteger())
{
CDesignType *pType = g_pUniverse->FindDesignType(pItem->GetIntegerValue());
if (pType == NULL)
return ERR_FAIL;
if (retdwUNID)
*retdwUNID = pType->GetUNID();
}
else
{
CEconomyType *pEconomy = g_pUniverse->FindEconomyType(pItem->GetStringValue());
if (pEconomy == NULL)
return ERR_FAIL;
if (retdwUNID)
*retdwUNID = pEconomy->GetUNID();
}
return NOERROR;
}
示例5: Merge
ALERROR CDesignTable::Merge (const CDynamicDesignTable &Source, CDesignList *ioOverride)
// Merge
//
// Merge the given table into ours.
{
DEBUG_TRY
int i;
for (i = 0; i < Source.GetCount(); i++)
{
CDesignType *pNewType = Source.GetType(i);
// If this is an override then we put it on a different table and
// leave the type alone.
if (pNewType->IsModification())
{
if (ioOverride)
ioOverride->AddEntry(pNewType);
}
// Otherwise, add or replace
else
AddOrReplaceEntry(pNewType);
}
return NOERROR;
DEBUG_CATCH
}
示例6: FireOnGlobalPaneInit
void CDesignCollection::FireOnGlobalPaneInit (void *pScreen, CDesignType *pRoot, const CString &sScreen, const CString &sPane)
// FireOnGlobalPaneInit
//
// Give other design types a way to override screens
{
int i;
CString sError;
// Generate a screen UNID that contains both the screen UNID and a local screen
CString sScreenUNID = CDockScreenType::GetStringUNID(pRoot, sScreen);
DWORD dwRootUNID = (pRoot ? pRoot->GetUNID() : 0);
// Fire all events
for (i = 0; i < m_EventsCache[evtOnGlobalDockPaneInit]->GetCount(); i++)
{
SEventHandlerDesc Event;
CDesignType *pType = m_EventsCache[evtOnGlobalDockPaneInit]->GetEntry(i, &Event);
if (pType->FireOnGlobalDockPaneInit(Event,
pScreen,
dwRootUNID,
sScreenUNID,
sPane,
&sError) != NOERROR)
kernelDebugLogMessage("%s", sError.GetASCIIZPointer());
}
}
示例7: CleanUpXML
void CExtension::CleanUpXML (void)
// CleanUpXML
//
// Deletes XML representation.
{
int i;
if (m_pRootXML)
{
delete m_pRootXML;
m_pRootXML = NULL;
}
for (i = 0; i < m_ModuleXML.GetCount(); i++)
delete m_ModuleXML[i];
m_ModuleXML.DeleteAll();
// Remove references to XML
for (i = 0; i < m_DesignTypes.GetCount(); i++)
{
CDesignType *pType = m_DesignTypes.GetEntry(i);
pType->SetXMLElement(NULL);
}
}
示例8: strParseInt
CEffectCreator *CEffectCreator::FindEffectCreator (const CString &sUNID)
// FindEffectCreator
//
// Finds the effect creator from a complex UNID (or NULL if not found)
{
// A complex UNID looks like this:
//
// For effects:
//
// {unid}
//
// "12345" = Effect UNID 12345
// "12345/0" = Effect UNID 12345; variant 0
// "12345/d:h" = Effect UNID 12345; damage; hit effect
//
// For overlays:
//
// {unid}:e
// {unid}:h
//
// For shields:
//
// {unid}:h
// "12345:h" = Shield UNID 12345; Hit effect
//
// For system maps:
//
// {unid}/{nodeID}
// {unid}/{nodeID}[/{nodeID}]
//
// For weapons:
//
// {unid}/{var}[/f{frag}]:(e | h | f)
//
// "12345/0:e" = Weapon UNID 12345; variant 0; Bullet effect
// "12345/0/f0:h" = Weapon UNID 12345; variant 0; fragment 0; Hit Effect
//
// First we parse the UNID
char *pPos = sUNID.GetASCIIZPointer();
DWORD dwUNID = strParseInt(pPos, 0, &pPos);
// Look for the design type
CDesignType *pDesign = g_pUniverse->FindDesignType(dwUNID);
if (pDesign == NULL)
return NULL;
// Allow the design type to parse the remainder of the UNID
return pDesign->FindEffectCreatorInType(CString(pPos));
}
示例9: ASSERT
void CPlayerGameStats::OnKeyEvent (EEventTypes iType, CSpaceObject *pObj, DWORD dwCauseUNID)
// OnKeyEvent
//
// Adds a key event involving an object
{
ASSERT(pObj);
CSystem *pSystem = pObj->GetSystem();
if (pSystem == NULL)
return;
// Get the NodeID where the event happened
CTopologyNode *pNode = pSystem->GetTopology();
if (pNode == NULL)
return;
const CString &sNodeID = pNode->GetID();
// Get the object's type
CDesignType *pType = pObj->GetType();
if (pType == NULL)
return;
// Get the object's name
DWORD dwNameFlags;
CString sName = pObj->GetName(&dwNameFlags);
// If the object name is the same as the type name then we don't bother
// storing it in the event (to save memory)
if (strEquals(sName, pType->GetTypeName()))
{
sName = NULL_STR;
dwNameFlags = 0;
}
// Look for the list of events for this NodeID
TArray<SKeyEventStats> *pEventList = m_KeyEventStats.Set(sNodeID);
SKeyEventStats *pStats = pEventList->Insert();
pStats->iType = iType;
pStats->dwTime = g_pUniverse->GetTicks();
pStats->dwObjUNID = pObj->GetType()->GetUNID();
pStats->sObjName = sName;
pStats->dwObjNameFlags = dwNameFlags;
pStats->dwCauseUNID = dwCauseUNID;
}
示例10: NotifyTopologyInit
void CDesignCollection::NotifyTopologyInit (void)
// NotifyTopologyInit
//
// Notify all types that the topology has been initialized.
{
int i;
for (i = 0; i < m_AllTypes.GetCount(); i++)
{
CDesignType *pType = m_AllTypes.GetEntry(i);
pType->TopologyInitialized();
}
}
示例11: FireGetGlobalAchievements
void CDesignCollection::FireGetGlobalAchievements (CGameStats &Stats)
// FireGetGlobalAchievements
//
// Fire event to fill achievements
{
int i;
for (i = 0; i < m_EventsCache[evtGetGlobalAchievements]->GetCount(); i++)
{
CDesignType *pType = m_EventsCache[evtGetGlobalAchievements]->GetEntry(i);
pType->FireGetGlobalAchievements(Stats);
}
}
示例12: FireOnGlobalUniverseSave
void CDesignCollection::FireOnGlobalUniverseSave (void)
// FireOnGlobalUniverseSave
//
// Notify all types that the universe is about to be saved to disk
{
int i;
CString sError;
for (i = 0; i < m_EventsCache[evtOnGlobalUniverseSave]->GetCount(); i++)
{
SEventHandlerDesc Event;
CDesignType *pType = m_EventsCache[evtOnGlobalUniverseSave]->GetEntry(i, &Event);
pType->FireOnGlobalUniverseSave(Event);
}
}
示例13: FireOnGlobalUniverseCreated
void CDesignCollection::FireOnGlobalUniverseCreated (void)
// FireOnGlobalUniverseCreated
//
// Notify all types that the universe has been created
{
int i;
CString sError;
for (i = 0; i < m_EventsCache[evtOnGlobalUniverseCreated]->GetCount(); i++)
{
SEventHandlerDesc Event;
CDesignType *pType = m_EventsCache[evtOnGlobalUniverseCreated]->GetEntry(i, &Event);
pType->FireOnGlobalUniverseCreated(Event);
}
}
示例14: FireOnGlobalTypesInit
ALERROR CDesignCollection::FireOnGlobalTypesInit (SDesignLoadCtx &Ctx)
// FireOnGlobalTypesInit
//
// Give each type a chance to create dynamic types before we bind.
{
ALERROR error;
int i;
for (i = 0; i < m_AllTypes.GetCount(); i++)
{
CDesignType *pType = m_AllTypes.GetEntry(i);
if (error = pType->FireOnGlobalTypesInit(Ctx))
return error;
}
return NOERROR;
}
示例15: FireOnGlobalObjDestroyed
void CDesignCollection::FireOnGlobalObjDestroyed (SDestroyCtx &Ctx)
// FireOnGlobalObjDestroyed
//
// Gives other types a notification when an object is destroyed
{
int i;
// Fire all events
for (i = 0; i < m_EventsCache[evtOnGlobalObjDestroyed]->GetCount(); i++)
{
SEventHandlerDesc Event;
CDesignType *pType = m_EventsCache[evtOnGlobalObjDestroyed]->GetEntry(i, &Event);
pType->FireOnGlobalObjDestroyed(Event, Ctx);
}
}