本文整理汇总了C++中SAFE_STRCPY函数的典型用法代码示例。如果您正苦于以下问题:C++ SAFE_STRCPY函数的具体用法?C++ SAFE_STRCPY怎么用?C++ SAFE_STRCPY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SAFE_STRCPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetControl
LTBOOL CFolderIntel::UpdateSelection()
{
LTBOOL bChanged = CBaseSelectionFolder::UpdateSelection();
if (bChanged)
{
CLTGUICtrl *pCtrl = GetControl(m_nLastListItem);
if (!pCtrl) return LTFALSE;
int nIndex = pCtrl->GetParam1();
if (!nIndex) return LTFALSE;
IntelItem *pItem = m_intelArray[nIndex-1];
HSTRING hStr = g_pLTClient->FormatString(pItem->nID);
m_pDescription->SetString(hStr);
g_pLTClient->FreeString(hStr);
CScaleFX* pScaleFX = g_pFXButeMgr->GetScaleFX(pItem->nType);
SAFE_STRCPY(m_szModel, pScaleFX->szFile);
SAFE_STRCPY(m_szSkin, pScaleFX->szSkin);
m_vScale = pScaleFX->vInitialScale;
m_bChromakey = pScaleFX->bChromakey;
if (pScaleFX->fDirOffset > 0.0f)
{
LTFLOAT fScaleMult = (100.0f/pScaleFX->fDirOffset);
VEC_MULSCALAR(m_vScale, m_vScale, fScaleMult);
}
CreateModelSFX();
}
return bChanged;
}
示例2: CommandName
char* CommandName(int nCommand)
{
static char buffer[128];
uint32 nStringID = 0;
for (int i=0; i < g_kNumCommands; i++)
{
if (g_CommandArray[i].nCommandID == nCommand)
{
nStringID = g_CommandArray[i].nActionStringID;
break;
}
}
if (nStringID)
{
HSTRING hStr = g_pLTClient->FormatString(nStringID);
SAFE_STRCPY(buffer, g_pLTClient->GetStringData(hStr));
g_pLTClient->FreeString(hStr);
}
else
{
SAFE_STRCPY(buffer, "Error in CommandName()!");
}
return buffer;
}
示例3: INIT_OBJECTCREATESTRUCT
HLOCALOBJ CGibFX::CreateGib(GibType eType)
{
// TODO: REIMPLEMENT GIB LOOKUP IN MODELBUTEMGR
char* pFilename = LTNULL;//GetGibModel(m_eModel, m_eModelStyle, eType);
char* pSkin = LTNULL;//GetGibSkin(m_eModel, m_eModelStyle, eType);
if (!pFilename) return LTNULL;
ObjectCreateStruct createStruct;
INIT_OBJECTCREATESTRUCT(createStruct);
createStruct.m_ObjectType = OT_MODEL;
SAFE_STRCPY(createStruct.m_Filename, pFilename);
if (pSkin) SAFE_STRCPY(createStruct.m_SkinName, pSkin);
createStruct.m_Flags = FLAG_VISIBLE; // | FLAG_NOLIGHT;
VEC_COPY(createStruct.m_Pos, m_vPos);
HLOCALOBJ hObj = m_pClientDE->CreateObject(&createStruct);
if (hObj)
{
m_pClientDE->SetModelAnimation(hObj, m_pClientDE->GetAnimIndex(hObj, "DEAD1"));
}
return hObj;
}
示例4: DeleteAndClearArray
void CEditProjectMgr::LoadTemplateClasses()
{
// Clear the currently loaded templates
DeleteAndClearArray(m_TemplateClasses);
// Load the template objects
CObjectImporter *pImporter=GetTemplateObjectImporter();
if (!pImporter)
{
return;
}
if (!pImporter->LoadObjectFile("lithtech.cls"))
{
return;
}
// Create each class
int i;
for (i=0; i < pImporter->GetNumObjects(); i++)
{
// Allocate the class
TemplateClass *pClass=new TemplateClass;
// Get the class name and parent type
CString sName=pImporter->GetObjectName(i);
CString sParentType=pImporter->GetObjectType(i);
SAFE_STRCPY(pClass->m_ClassName, sName);
SAFE_STRCPY(pClass->m_ParentClassName, sParentType);
m_TemplateClasses.Append(pClass);
}
}
示例5: GetSelectedControl
void CFolderWeaponControls::UpdateSelection()
{
CLTGUICtrl *pCtrl = GetSelectedControl();
if (!pCtrl) return;
int nComm = pCtrl->GetParam1();
if (!nComm) return;
uint8 nWeaponId = g_pWeaponMgr->GetWeaponId(m_nActions[nComm-1]);
if (nWeaponId != nLastId)
{
WEAPON* pWeapon = g_pWeaponMgr->GetWeapon(nWeaponId);
if (pWeapon)
{
SAFE_STRCPY(m_szModel, pWeapon->szInterfaceModel);
SAFE_STRCPY(m_szSkin, pWeapon->szInterfaceSkin);
VEC_COPY(m_vOffset, pWeapon->vInterfaceOffset);
m_fScale = pWeapon->fInterfaceScale;
CreateModelSFX();
}
nLastId = nWeaponId;
}
}
示例6: NEW_LIST
VIEW_CELL_LIB_REF *decideInstance_Ref(char *viewref_id,char *cellref_id, char *libref_id){
NEW_LIST(VIEW_CELL_LIB_REF,p1);
SAFE_STRCPY(p1->viewref_id,viewref_id,MAX_PRIM_ID_LENGTH);
SAFE_STRCPY(p1->cellref_id,cellref_id,MAX_PRIM_ID_LENGTH);
SAFE_STRCPY(p1->libref_id, libref_id,MAX_USER_ID_LENGTH);
return p1;
}
示例7: SAFE_STRCPY
void GearItem::PostPropRead(ObjectCreateStruct *pStruct)
{
GEAR* pGear = g_pWeaponMgr->GetGear(m_nGearId);
if (!pGear) return;
if (pStruct)
{
SAFE_STRCPY(pStruct->m_Filename, pGear->szModel);
SAFE_STRCPY(pStruct->m_SkinName, pGear->szSkin);
// Set up the appropriate sounds...
if (pGear->szPickUpSound[0])
{
FREE_HSTRING(m_hstrSoundFile);
m_hstrSoundFile = g_pLTServer->CreateString(pGear->szPickUpSound);
}
if (pGear->szRespawnSound[0])
{
FREE_HSTRING(m_hstrRespawnSoundFile);
m_hstrRespawnSoundFile = g_pLTServer->CreateString(pGear->szRespawnSound);
}
m_bRotate = LTFALSE;
}
}
示例8: GetFloatVar
void CGameSettings::ImplementMouseSensitivity()
{
if (!m_pClientDE) return;
float nMouseSensitivity = GetFloatVar("MouseSensitivity");
// get the mouse device name
char strDevice[128];
memset (strDevice, 0, 128);
LTRESULT result = m_pClientDE->GetDeviceName (DEVICETYPE_MOUSE, strDevice, 127);
if (result == LT_OK)
{
// get mouse x- and y- axis names
char strXAxis[32];
memset (strXAxis, 0, 32);
char strYAxis[32];
memset (strYAxis, 0, 32);
LTBOOL bFoundXAxis = LTFALSE;
LTBOOL bFoundYAxis = LTFALSE;
DeviceObject* pList = m_pClientDE->GetDeviceObjects (DEVICETYPE_MOUSE);
DeviceObject* ptr = pList;
while (ptr)
{
if (ptr->m_ObjectType == CONTROLTYPE_XAXIS)
{
SAFE_STRCPY(strXAxis, "##x-axis");
bFoundXAxis = LTTRUE;
}
if (ptr->m_ObjectType == CONTROLTYPE_YAXIS)
{
SAFE_STRCPY(strYAxis, "##y-axis");
bFoundYAxis = LTTRUE;
}
ptr = ptr->m_pNext;
}
if (pList) m_pClientDE->FreeDeviceObjects (pList);
if (bFoundXAxis && bFoundYAxis)
{
// run the console string
char strConsole[64];
float fBaseScale = g_vtMouseScaleBase.GetFloat();
float fScaleIncrement = g_vtMouseScaleInc.GetFloat();
sprintf (strConsole, "scale \"%s\" \"%s\" %f", strDevice, strXAxis, fBaseScale + ((float)nMouseSensitivity * fScaleIncrement));
m_pClientDE->RunConsoleString (strConsole);
sprintf (strConsole, "scale \"%s\" \"%s\" %f", strDevice, strYAxis, fBaseScale + ((float)nMouseSensitivity * fScaleIncrement));
m_pClientDE->RunConsoleString (strConsole);
}
}
}
示例9: GetSound
char* GetSound(CCharacter* pCharacter, EnumAISoundType eSound)
{
/*
if (g_pVersionMgr->IsLowViolence())
{
if ( (eSound == kAIS_Death) || (eSound == kAIS_DeathQuiet) || (eSound == kAIS_Pain) )
{
return BUILD_NOPAIN_WAV;
}
}
*/
if (!pCharacter || !g_pServerSoundMgr) return LTNULL;
ModelId eModelId = pCharacter->GetModelId();
char szSoundTemplate[128] = "";
SAFE_STRCPY(szSoundTemplate,g_pModelButeMgr->GetModelSoundTemplate(eModelId));
if (!strlen(szSoundTemplate)) return LTNULL;
// Look for sounds in a heirarchical manner: First look for the sound in the sound
// template, if it isn't found there look in the parent sound template, and so on...
char szStr[128] = "";
g_pServerSoundMgr->GetRandomSoundFilename(szSoundTemplate, s_aszAISoundTypes[eSound], szStr, sizeof(szStr));
// guard against loops...
uint32 nRemainingAttempts = 10;
while (!strlen(szStr) && nRemainingAttempts)
{
// Look in the parent template...
char szParentTemplate[128] = "";
g_pServerSoundMgr->GetParentSoundTemplate(szParentTemplate,
sizeof(szParentTemplate), szSoundTemplate);
SAFE_STRCPY(szSoundTemplate,szParentTemplate);
if (!strlen(szSoundTemplate)) return LTNULL;
g_pServerSoundMgr->GetRandomSoundFilename(szSoundTemplate, s_aszAISoundTypes[eSound], szStr, sizeof(szStr));
--nRemainingAttempts;
}
if (!nRemainingAttempts)
ASSERT(!"Potential Loop in AI sound template hierarchy");
if (strlen(szStr))
{
SAFE_STRCPY(s_FileBuffer, szStr);
return s_FileBuffer;
}
return LTNULL;
}
示例10: INIT_OBJECTCREATESTRUCT
void GameBase::CreateBoundingBox()
{
if (m_hDimsBox) return;
if (!g_vtDimsAlpha.IsInitted())
{
g_vtDimsAlpha.Init(g_pLTServer, "DimsAlpha", LTNULL, 1.0f);
}
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
LTVector vPos;
g_pLTServer->GetObjectPos(m_hObject, &vPos);
theStruct.m_Pos = vPos;
SAFE_STRCPY(theStruct.m_Filename, "Models\\1x1_square.abc");
SAFE_STRCPY(theStruct.m_SkinName, "Models\\1x1_square.dtx");
theStruct.m_Flags = FLAG_VISIBLE | FLAG_NOLIGHT | FLAG_GOTHRUWORLD;
theStruct.m_ObjectType = OT_MODEL;
HCLASS hClass = g_pLTServer->GetClass("BaseClass");
LPBASECLASS pModel = g_pLTServer->CreateObject(hClass, &theStruct);
if (pModel)
{
m_hDimsBox = pModel->m_hObject;
LTVector vDims;
g_pLTServer->GetObjectDims(m_hObject, &vDims);
LTVector vScale;
VEC_DIVSCALAR(vScale, vDims, 0.5f);
g_pLTServer->ScaleObject(m_hDimsBox, &vScale);
}
LTVector vOffset;
LTRotation rOffset;
vOffset.Init();
rOffset.Init();
HATTACHMENT hAttachment;
LTRESULT dRes = g_pLTServer->CreateAttachment(m_hObject, m_hDimsBox, LTNULL,
&vOffset, &rOffset, &hAttachment);
if (dRes != LT_OK)
{
g_pLTServer->RemoveObject(m_hDimsBox);
m_hDimsBox = LTNULL;
}
LTVector vColor = GetBoundingBoxColor();
g_pLTServer->SetObjectColor(m_hDimsBox, vColor.x, vColor.y, vColor.z, g_vtDimsAlpha.GetFloat());
}
示例11: switch
LTBOOL CHUDChatInput::HandleKeyDown(int key, int rep)
{
switch (key)
{
case VK_ESCAPE:
{
Show(false,false);
return LTTRUE;
} break;
case VK_RETURN:
{
Send();
return LTTRUE;
} break;
case VK_UP:
{
int nTest = m_nHistory+1;
if (nTest >= 0 && nTest < kMaxChatHistory && strlen(m_szChatHistory[nTest]))
{
m_nHistory = nTest;
SAFE_STRCPY(m_szChatStr,m_szChatHistory[nTest]);
m_EditCtrl.UpdateData(LTFALSE);
}
return LTTRUE;
} break;
case VK_DOWN:
{
int nTest = m_nHistory-1;
if (nTest >= 0 && nTest < kMaxChatHistory && strlen(m_szChatHistory[nTest]))
{
m_nHistory = nTest;
SAFE_STRCPY(m_szChatStr,m_szChatHistory[nTest]);
m_EditCtrl.UpdateData(LTFALSE);
}
return LTTRUE;
} break;
case VK_PRIOR:
{
g_pChatMsgs->IncHistoryOffset();
return LTTRUE;
} break;
case VK_NEXT:
{
g_pChatMsgs->DecHistoryOffset();
return LTTRUE;
} break;
default:
return m_EditCtrl.HandleKeyDown(key,rep);
}
}
示例12: sprintf
void CLoadingScreen::CreateInterfaceSFX()
{
if( m_pRenderScreen )
return;
HOBJECT hCamera = g_pInterfaceMgr->GetInterfaceCamera();
if (!hCamera) return;
g_pLTClient->GetObjectPos(hCamera, &m_vPos);
g_pLTClient->GetObjectRotation(hCamera, &m_rRot);
m_vU = m_rRot.Up();
m_vR = m_rRot.Right();
m_vF = m_rRot.Forward();
int n = 0;
char szTagName[30];
char szAttName[30];
char szFXName[128];
sprintf(szAttName,"Light%d",n);
SAFE_STRCPY(szTagName,m_layout.c_str());
if (!g_pLayoutMgr->Exist(szTagName))
SAFE_STRCPY(szTagName,"LoadScreenDefault");
while (g_pLayoutMgr->HasValue(szTagName,szAttName))
{
g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128);
if (strlen(szFXName))
{
CreateLightFX(szFXName);
}
n++;
sprintf(szAttName,"Light%d",n);
}
n = 0;
sprintf(szAttName,"LoadScale%d",n);
while (g_pLayoutMgr->HasValue(szTagName,szAttName))
{
g_pLayoutMgr->GetString(szTagName,szAttName,szFXName,128);
if (strlen(szFXName))
{
CreateScaleFX(szFXName);
}
n++;
sprintf(szAttName,"LoadScale%d",n);
}
}
示例13: SAFE_STRCPY
void Speaker::InitialUpdate()
{
if (!g_pLTServer || !m_hObject) return;
ObjectCreateStruct createstruct;
createstruct.Clear();
SAFE_STRCPY(createstruct.m_Filename, "Models\\1x1_square.abc");
SAFE_STRCPY(createstruct.m_SkinNames[0], "Models\\1x1_square.dtx");
g_pLTServer->Common()->SetObjectFilenames(m_hObject, &createstruct);
}
示例14: SAFE_STRCPY
top_EDIF *createEdif(char *edif_name,REF_LIBRARY *reflib_list,CELL *work_cells,char *design_name){
top_EDIF *p1;
p1=(top_EDIF *)malloc(sizeof(top_EDIF));
SAFE_STRCPY(p1->edif_name,edif_name,20);
p1->reflib_cnt =reflib_list->list_cnt;
p1->reflib_list =reflib_list;
p1->work_cells_cnt =work_cells->list_cnt;
p1->work_cells =work_cells;
SAFE_STRCPY(p1->design_name,design_name,20);
return p1;
}
示例15: if
// ----------------------------------------------------------------------- //
//
// ROUTINE: CCommandObjectPlugin::PreHook_PropChanged
//
// PURPOSE: Constructor
//
// ----------------------------------------------------------------------- //
LTRESULT CCommandObjectPlugin::PreHook_PropChanged( const char *szObjName,
const char *szPropName,
const int nPropType,
const GenericProp &gpPropValue,
ILTPreInterface *pInterface,
const char *szModifiers )
{
if( !_stricmp( szPropName, "FinishedCommand" ))
{
if( LT_OK == m_CmdMgrPlugin.PreHook_PropChanged( szObjName,
szPropName,
nPropType,
gpPropValue,
pInterface,
szModifiers ))
{
return LT_OK;
}
}
else if( nPropType == LT_PT_STRING && gpPropValue.m_String[0] )
{
char strPropVal[256];
SAFE_STRCPY( strPropVal, gpPropValue.m_String );
char *pTime = strtok( strPropVal, "|" );
char *pCmd = strtok( LTNULL, "\0" );
GenericProp gp;
if(pCmd)
{
SAFE_STRCPY( gp.m_String, pCmd );
}
else
{
gp.m_String[0] = '\0';
}
if( LT_OK == m_CmdMgrPlugin.PreHook_PropChanged( szObjName,
szPropName,
nPropType,
gp,
pInterface,
szModifiers ))
{
return LT_OK;
}
}
return LT_UNSUPPORTED;
}