本文整理汇总了C++中CONSTLIT函数的典型用法代码示例。如果您正苦于以下问题:C++ CONSTLIT函数的具体用法?C++ CONSTLIT怎么用?C++ CONSTLIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CONSTLIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strPatternSubst
ALERROR CEventHandler::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// InitFromXML
//
// Load all handlers
{
int i;
for (i = 0; i < pDesc->GetContentElementCount(); i++)
{
CXMLElement *pHandler = pDesc->GetContentElement(i);
ICCItem *pCode = g_pUniverse->GetCC().Link(pHandler->GetContentText(0), 0, NULL);
if (pCode->IsError())
{
Ctx.sError = strPatternSubst("<%s> event: %s", pHandler->GetTag(), pCode->GetStringValue());
return ERR_FAIL;
}
// If this is an old extension, then make sure the code is not using the
// gStation variable, because we no longer support it
if (Ctx.pExtension && Ctx.pExtension->dwVersion < 2)
{
if (g_pUniverse->GetCC().HasIdentifier(pCode, CONSTLIT("gStation")))
{
Ctx.sError = CONSTLIT("gStation variable has been deprecated--use gSource instead.");
return ERR_FAIL;
}
}
// Done
m_Handlers.Insert(pHandler->GetTag(), pCode);
}
return NOERROR;
}
示例2: if
CString CDamageSource::GetDamageCauseNounPhrase (DWORD dwFlags)
// GetDamageCauseNounPhrase
//
// Returns the name of the damage source
{
if (m_pSource)
return m_pSource->GetDamageCauseNounPhrase(dwFlags);
else if (!m_sSourceName.IsBlank())
return ::ComposeNounPhrase(m_sSourceName, 1, NULL_STR, m_dwSourceNameFlags, dwFlags);
else
return CONSTLIT("damage");
}
示例3: CONSTLIT
ALERROR CTransmuterController::OnBoot (char *pszCommandLine, SHIOptions *retOptions, CString *retsError)
// OnBoot
//
// Controller must initialize all option values
{
CString sError;
// Set our basic application settings
retOptions->sAppName = CONSTLIT("Transmuter");
retOptions->sClassName = CONSTLIT("transmuter_class");
retOptions->sAppData = CONSTLIT("Kronosaur\\Transmuter");
retOptions->hIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_TRANSMUTER));
// Set our default directory
CString sCurDir = pathGetExecutablePath(NULL);
::SetCurrentDirectory(sCurDir.GetASCIIZPointer());
return NOERROR;
}
示例4: LoadDamageAdj
ALERROR CEnhancerClass::CreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, CItemType *pType, CDeviceClass **retpDevice)
// CreateFromXML
//
// Load device data from XML
{
ALERROR error;
CEnhancerClass *pDevice;
pDevice = new CEnhancerClass;
if (pDevice == NULL)
return ERR_MEMORY;
if (error = pDevice->InitDeviceFromXML(Ctx, pDesc, pType))
return error;
// The old style is to have an array of damage adj; the new way is to just
// have a single damage adj and a criteria
int iDamageAdjCount;
LoadDamageAdj(pDesc, DAMAGE_ADJ_ATTRIB, pDevice->m_iDamageAdjArray, &iDamageAdjCount);
if (iDamageAdjCount)
pDevice->m_bUseArray = true;
else
{
pDevice->m_iDamageAdj = pDesc->GetAttributeInteger(HP_BONUS_ATTRIB);
pDevice->m_bUseArray = false;
}
pDevice->m_iPowerUse = pDesc->GetAttributeInteger(POWER_USE_ATTRIB);
pDevice->m_sEnhancementType = pDesc->GetAttribute(ENHANCEMENT_TYPE_ATTRIB);
pDevice->m_iActivateAdj = pDesc->GetAttributeIntegerBounded(ACTIVATE_ADJ_ATTRIB, 1, -1, 100);
pDevice->m_iMinActivateDelay = pDesc->GetAttributeIntegerBounded(MIN_ACTIVATE_DELAY_ATTRIB, 0, -1, 0);
pDevice->m_iMaxActivateDelay = pDesc->GetAttributeIntegerBounded(MAX_ACTIVATE_DELAY_ATTRIB, 0, -1, 0);
// Load the item criteria
CString sCriteria;
if (!pDesc->FindAttribute(CRITERIA_ATTRIB, &sCriteria))
sCriteria = CONSTLIT("w");
CItem::ParseCriteria(sCriteria, &pDevice->m_Criteria);
// Done
*retpDevice = pDevice;
return NOERROR;
}
示例5: AppendReferenceString
CString CDeviceClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)
// GetReference
//
// Returns reference string
{
CString sReference;
// For a device we always add power and other properties.
// (If iVariant != -1 then it means that we're looking for reference on a
// missile or someting).
if (iVariant == -1)
{
CInstalledDevice *pDevice = Ctx.GetDevice();
// Start with power requirements
AppendReferenceString(&sReference, GetReferencePower(Ctx));
// Non-standard slots
if (GetSlotsRequired() != 1)
AppendReferenceString(&sReference, strPatternSubst(CONSTLIT("%d Slots"), GetSlotsRequired()));
// External devices
if (IsExternal() || (pDevice && pDevice->IsExternal()))
AppendReferenceString(&sReference, CONSTLIT("External"));
}
// Combine with our subclass
AppendReferenceString(&sReference, OnGetReference(Ctx, iVariant, dwFlags));
return sReference;
}
示例6: catch
void CHumanInterface::HardCrash (const CString &sProgramState)
// HardCrash
//
// Report an error
{
CString sSessionMessage;
try
{
if (m_pCurSession)
m_pCurSession->HIReportHardCrash(&sSessionMessage);
}
catch (...)
{
sSessionMessage = CONSTLIT("Unable to obtain crash report from session.");
}
CString sMessage = strPatternSubst(CONSTLIT(
"Unable to continue due to program error.\r\n\r\n"
"program state: %s\r\n"
"%s"
"\r\n\r\nPlease contact transce[email protected] with a copy of Debug.log and your save file. "
"We are sorry for the inconvenience.\r\n"),
sProgramState,
sSessionMessage
);
kernelDebugLogMessage(sMessage);
ShowHardCrashSession(CONSTLIT("Transcendence System Crash"), sMessage);
// Ask the controller to post a crash report
CString *pCrashReport = new CString(::kernelGetSessionDebugLog());
if (HICommand(CONSTLIT("cmdPostCrashReport"), pCrashReport) == ERR_NOTFOUND)
delete pCrashReport;
}
示例7: if
ALERROR ITopologyProcessor::CreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, const CString &sUNID, ITopologyProcessor **retpProc)
// CreateFromXML
//
// Creates a new processor based on the XML tag
{
ALERROR error;
ITopologyProcessor *pProc;
// Create the approprate class
if (strEquals(pDesc->GetTag(), ATTRIBUTES_TAG))
pProc = new CApplySystemProc;
else if (strEquals(pDesc->GetTag(), CONQUER_NODES_TAG))
pProc = new CConquerNodesProc;
else if (strEquals(pDesc->GetTag(), DISTRIBUTE_NODES_TAG))
pProc = new CDistributeNodesProc;
else if (strEquals(pDesc->GetTag(), FILL_NODES_TAG))
pProc = new CFillNodesProc;
else if (strEquals(pDesc->GetTag(), GROUP_TAG))
pProc = new CGroupTopologyProc;
else if (strEquals(pDesc->GetTag(), LOCATE_NODES_TAG))
pProc = new CLocateNodesProc;
else if (strEquals(pDesc->GetTag(), PARTITION_NODES_TAG))
pProc = new CPartitionNodesProc;
else if (strEquals(pDesc->GetTag(), RANDOM_POINTS_TAG))
pProc = new CRandomPointsProc;
else if (strEquals(pDesc->GetTag(), SYSTEM_TAG))
pProc = new CApplySystemProc;
else if (strEquals(pDesc->GetTag(), TABLE_TAG))
pProc = new CTableTopologyProc;
else
{
Ctx.sError = strPatternSubst(CONSTLIT("Unknown topology processor element: <%s>"), pDesc->GetTag());
return ERR_FAIL;
}
// Load it
if (error = pProc->InitFromXML(Ctx, pDesc, sUNID))
return error;
// Done
*retpProc = pProc;
return NOERROR;
}
示例8: HideCommsTargetMenu
void CTranscendenceWnd::PlayerDestroyed (const CString &sText, bool bResurrectionPending)
// PlayerDestroyed
//
// This method gets called when the player is destroyed
{
// Clean up
HideCommsTargetMenu();
m_CurrentPicker = pickNone;
m_CurrentMenu = menuNone;
m_bAutopilot = false;
m_bShowingMap = false;
if (m_State == gsDocked)
GetPlayer()->Undock();
// Update display
CString sMsg = sText;
if (strEquals(strWord(sMsg, 0), CONSTLIT("was")))
sMsg = strSubString(sMsg, 4, -1);
sMsg.Capitalize(CString::capFirstLetter);
DisplayMessage(sMsg);
UpdateArmorDisplay();
// If we are insured, then set our state so that we come back to life
if (bResurrectionPending)
{
// Prepare resurrect
m_State = gsDestroyed;
m_iCountdown = TICKS_AFTER_DESTROYED;
}
// Otherwise, proceed with destruction
else
{
// Done with ship screens
CleanUpPlayerShip();
// Player destroyed
m_State = gsDestroyed;
m_iCountdown = TICKS_AFTER_DESTROYED;
}
}
示例9: strPatternSubst
ALERROR CObjectImage::Exists (SDesignLoadCtx &Ctx)
// Exists
//
// Returns TRUE if the appropriate resources exist
{
if (m_pBitmap)
return NOERROR;
if (!m_sBitmap.IsBlank() && !Ctx.pResDb->ImageExists(NULL_STR, m_sBitmap))
{
Ctx.sError = strPatternSubst(CONSTLIT("Unable to find image: '%s'"), m_sBitmap);
return ERR_FAIL;
}
if (!m_sBitmask.IsBlank() && !Ctx.pResDb->ImageExists(NULL_STR, m_sBitmask))
{
Ctx.sError = strPatternSubst(CONSTLIT("Unable to find image: '%s'"), m_sBitmask);
return ERR_FAIL;
}
return NOERROR;
}
示例10: Helper
void CLoginSession::CmdSignIn (void)
// CmdSignIn
//
// Sign in the user
{
CUIHelper Helper(m_HI);
// Get the fields
CString sUsername = GetPropertyString(ID_CTRL_USERNAME, PROP_TEXT);
CString sPassword = GetPropertyString(ID_CTRL_PASSWORD, PROP_TEXT);
bool bAutoSignIn = GetPropertyBool(ID_CTRL_AUTO_SIGN_IN, PROP_CHECKED);
// Get the text for the username. If blank, then we have an error.
if (sUsername.IsBlank())
{
Helper.CreateInputErrorMessage(this, m_rcInputError, CONSTLIT("Username Missing"), CONSTLIT("You must have a username to sign in."));
return;
}
// Register the name
m_HI.AddBackgroundTask(new CSignInUserTask(m_HI, m_Service, sUsername, sPassword, bAutoSignIn), this, CMD_SIGN_IN_COMPLETE);
// Disable controls
SetPropertyBool(ID_CTRL_USERNAME, PROP_ENABLED, false);
SetPropertyBool(ID_CTRL_PASSWORD, PROP_ENABLED, false);
SetPropertyBool(ID_CTRL_MAIN_ACTION, PROP_ENABLED, false);
SetPropertyBool(ID_CTRL_AUTO_SIGN_IN, PROP_ENABLED, false);
SetPropertyBool(ID_CTRL_REGISTER, PROP_ENABLED, false);
SetPropertyBool(ID_CTRL_PASSWORD_RESET, PROP_ENABLED, false);
}
示例11: FindDataField
bool CEnergyFieldType::FindDataField (const CString &sField, CString *retsValue)
// FindDataField
//
// Returns meta-data
{
int i;
if (strEquals(sField, FIELD_WEAPON_SUPPRESS))
{
if (m_WeaponSuppress.IsEmpty())
*retsValue = NULL_STR;
else
{
*retsValue = CONSTLIT("=(");
bool bNeedSeparator = false;
for (i = 0; i < damageCount; i++)
if (m_WeaponSuppress.InSet(i))
{
if (bNeedSeparator)
retsValue->Append(CONSTLIT(" "));
retsValue->Append(::GetDamageType((DamageTypes)i));
bNeedSeparator = true;
}
retsValue->Append(CONSTLIT(")"));
}
}
else
return CDesignType::FindDataField(sField, retsValue);
return true;
}
示例12: strPatternSubst
ALERROR CRandomItems::LoadFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc)
// LoadFromXML
//
// Load from XML
{
ALERROR error;
CString sCriteria = pDesc->GetAttribute(CRITERIA_ATTRIB);
if (sCriteria.IsBlank())
{
CString sAttributes = pDesc->GetAttribute(ATTRIBUTES_ATTRIB);
if (sAttributes.IsBlank())
sAttributes = pDesc->GetAttribute(MODIFIERS_ATTRIB);
sCriteria = strPatternSubst(CONSTLIT("%s %s"), pDesc->GetAttribute(CATEGORIES_ATTRIB), sAttributes);
}
CItem::ParseCriteria(sCriteria, &m_Criteria);
m_sLevelFrequency = pDesc->GetAttribute(LEVEL_FREQUENCY_ATTRIB);
m_bDynamicLevelFrequency = (strFind(m_sLevelFrequency, CONSTLIT(":")) != -1);
m_iDynamicLevel = 0;
m_iLevel = pDesc->GetAttributeInteger(LEVEL_ATTRIB);
m_iLevelCurve = pDesc->GetAttributeInteger(LEVEL_CURVE_ATTRIB);
m_iDamaged = pDesc->GetAttributeInteger(DAMAGED_ATTRIB);
if (error = m_Enhanced.InitFromXML(Ctx, pDesc))
return error;
m_Table = NULL;
m_iCount = 0;
return NOERROR;
}
示例13: ComputeRotationOffsets
ALERROR CObjectImageArray::InitFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, bool bResolveNow)
// InitFromXML
//
// Create from XML description
{
// Initialize basic info
m_rcImage.left = pDesc->GetAttributeInteger(CONSTLIT(g_ImageXAttrib));
m_rcImage.top = pDesc->GetAttributeInteger(CONSTLIT(g_ImageYAttrib));
m_rcImage.right = m_rcImage.left + pDesc->GetAttributeInteger(CONSTLIT(g_ImageWidthAttrib));
m_rcImage.bottom = m_rcImage.top + pDesc->GetAttributeInteger(CONSTLIT(g_ImageHeightAttrib));
m_iFrameCount = pDesc->GetAttributeInteger(CONSTLIT(g_ImageFrameCountAttrib));
m_iRotationCount = pDesc->GetAttributeInteger(ROTATION_COUNT_ATTRIB);
if (m_iRotationCount <= 0)
m_iRotationCount = 1;
m_iTicksPerFrame = pDesc->GetAttributeInteger(CONSTLIT(g_ImageTicksPerFrameAttrib));
if (m_iTicksPerFrame <= 0 && m_iFrameCount > 1)
m_iTicksPerFrame = 1;
m_iFlashTicks = pDesc->GetAttributeInteger(FLASH_TICKS_ATTRIB);
CString sBlending = pDesc->GetAttribute(BLENDING_ATTRIB);
if (strEquals(sBlending, LIGHTEN_BLENDING))
m_iBlending = blendLighten;
else
m_iBlending = blendNormal;
// Compute rotation offsets
m_iRotationOffset = pDesc->GetAttributeInteger(ROTATE_OFFSET_ATTRIB);
if (m_iRotationOffset)
ComputeRotationOffsets();
else
{
int xOffset = pDesc->GetAttributeInteger(X_OFFSET_ATTRIB);
int yOffset = pDesc->GetAttributeInteger(Y_OFFSET_ATTRIB);
if (xOffset != 0 || yOffset != 0)
ComputeRotationOffsets(xOffset, yOffset);
}
// Get the image from the universe
m_dwBitmapUNID = LoadUNID(Ctx, pDesc->GetAttribute(CONSTLIT(g_ImageIDAttrib)));
if (bResolveNow)
m_pImage = g_pUniverse->FindLibraryImage(m_dwBitmapUNID);
else
m_pImage = NULL;
return NOERROR;
}
示例14: if
ALERROR CSingleParticleEffectCreator::OnEffectCreateFromXML (SDesignLoadCtx &Ctx, CXMLElement *pDesc, const CString &sUNID)
// OnEffectCreateFromXML
//
// Initializes from XML
{
ALERROR error;
CString sStyle = pDesc->GetAttribute(STYLE_ATTRIB);
if (sStyle.IsBlank() || strEquals(sStyle, STYLE_PLAIN))
m_iStyle = paintPlain;
else if (strEquals(sStyle, STYLE_FLAME))
m_iStyle = paintFlame;
else if (strEquals(sStyle, STYLE_SMOKE))
m_iStyle = paintSmoke;
else if (strEquals(sStyle, STYLE_LINE))
m_iStyle = paintLine;
else
{
Ctx.sError = CONSTLIT("Invalid SingleParticle style");
return ERR_FAIL;
}
CString sRange;
if (pDesc->FindAttribute(MAX_WIDTH_ATTRIB, &sRange))
{
if (error = m_MaxWidth.LoadFromXML(sRange))
return error;
}
else
m_MaxWidth = DiceRange(0, 0, DEFAULT_MAX_WIDTH);
if (pDesc->FindAttribute(MIN_WIDTH_ATTRIB, &sRange))
{
if (error = m_MinWidth.LoadFromXML(sRange))
return error;
}
else
m_MinWidth = DiceRange(0, 0, DEFAULT_MIN_WIDTH);
// Colors
m_wPrimaryColor = ::LoadRGBColor(pDesc->GetAttribute(PRIMARY_COLOR_ATTRIB));
m_wSecondaryColor = ::LoadRGBColor(pDesc->GetAttribute(SECONDARY_COLOR_ATTRIB));
return NOERROR;
}
示例15: m_bEnabled
CSoundtrackManager::CSoundtrackManager (void) :
m_bEnabled(false),
m_iGameState(stateNone),
m_pNowPlaying(NULL),
m_LastPlayed(10),
m_bSystemTrackPlayed(false),
m_bStartCombatWhenUndocked(false)
// CSoundtrackManager constructor
{
// Hardcoded intro soundtrack
m_pIntroTrack = new CSoundType;
m_pIntroTrack->Init(0xFFFFFFFF, CONSTLIT("TranscendenceIntro.mp3"));
}