本文整理汇总了C++中GetStringParam函数的典型用法代码示例。如果您正苦于以下问题:C++ GetStringParam函数的具体用法?C++ GetStringParam怎么用?C++ GetStringParam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetStringParam函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetStringParam
//设置目标变量GUID的值
double CScript::SetDestGuidVar(const char* cmd, char* retStr)
{
double dbRet = 0;
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_DesShape);
if(!pMoveShape) return dbRet;
char* szValueName= GetStringParam(cmd,0);
if(szValueName)
{
if( strlen(szValueName) >= 2 && szValueName[0]=='@')
{
char* szGuidName = GetStringParam(cmd,1);
if(szGuidName )
{
if(p_SrcShape)
{
const CGUID& guid = GetScriptGuidValue((CMoveShape*)p_SrcShape, szGuidName);
pMoveShape->GetVariableList()->SetGuidValue(szValueName,&guid);
}
M_FREE( szGuidName, sizeof(char)*MAX_VAR_LEN );
}
}
M_FREE( szValueName, sizeof(char)*MAX_VAR_LEN );
}
return dbRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:28,代码来源:MoveShapeFun.cpp
示例2: GetStringParam
// 修改脚本变量
double CScript::UpdateScriptVarValue(const char* CmdStr, char* retStr)
{
//初始为错误
CScript::SCRIPTRETURN retFlag = CScript::SR_ERROR;
char *str=GetStringParam(CmdStr, 0);
if (str)
{
char *szValue = GetStringParam(CmdStr, 1);
if(szValue && p_SrcShape)
{
DelPlayerTalkBoxScript(m_guSrcID, SR_FUNC_UPDATEVARVALUE);
//等待函数, 收到回应消息再运行脚本
SetIsHang(true);
SetHangFunc(SR_FUNC_UPDATEVARVALUE);
// 记录要修改的变量名
SetClientUpdateVarName(szValue);
CMessage msg(MSG_S2C_OTHER_UPDATEVARVALUEOPEN);
msg.Add(GetID());
msg.Add(str);
msg.Add(szValue);
msg.SendToPlayer(p_SrcShape->GetExID());
}
M_FREE( szValue, sizeof(char)*MAX_VAR_LEN );
M_FREE( str, sizeof(char)*MAX_VAR_LEN );
}
return 1.0f;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:31,代码来源:ClientViewFun.cpp
示例3: GetIntParam
double CScript::SetAttrStr(const char* CmdStr, char* retStr)
{
OBJECT_TYPE type;
CGUID id;
if(!GetSrcShape()) return -1.0f;
int param = GetIntParam(CmdStr, 0);
if(param != ERROR_CODE && param != INVILID_VALUE)
{
type = (OBJECT_TYPE)param;
char* pIdName = GetStringParam(CmdStr, 1);
if(!pIdName) return -1.0f;
id = GetScriptGuidValue((CMoveShape*)GetSrcShape(), pIdName);
CMoveShape* shape = NULL;
char* name = GetStringParam(CmdStr, 2);
if(!name)
{
M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
return -1.0f;
}
const char* strValue = GetStringParam(CmdStr, 3);
if(!strValue)
{
M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
M_FREE( name, sizeof(char)*MAX_VAR_LEN );
return -1.0f;
}
if(NULL_GUID == id) // 默认id=0时,直接调用SrcShape的SetAttr接口
{
shape = (CMoveShape*)GetSrcShape();
}
else
{
shape = GetGame()->FindShape(type, id);
}
if(shape)
{
SetScriptVarValue(shape, name, strValue);
}
M_FREE( pIdName, sizeof(char)*MAX_VAR_LEN );
M_FREE( name, sizeof(char)*MAX_VAR_LEN );
M_FREE( strValue, sizeof(char)*MAX_VAR_LEN );
}
else // 参数是字符串
{
AddErrorLogText(CStringReading::LoadString(IDS_GS_FUNCTION, STR_GS_FUNCTION_SETATTRFIRSTVARISSTRING));
}
return -1.0f;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:60,代码来源:MoveShapeFun.cpp
示例4: GetStringParam
double CScript::GetLotteryRe(const char* CmdStr, char* retStr)
{
CPlayer* player= dynamic_cast<CPlayer*>(p_SrcShape);
DWORD LotteryRe = 0;
char *pGuidName = GetStringParam(CmdStr, 0);
if(!pGuidName) return 0;
CGUID guid;
char* szVarName = GetStringParam(CmdStr, 1);
if(!szVarName)
{
M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
return 0;
}
if (pGuidName[0] == '\0')
{
LotteryRe = player->GetLotteryRe();
int ret = SetScriptVarValue((CMoveShape*)p_SrcShape, szVarName, CGoodsFactory::QueryGoodsName(LotteryRe));
M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
M_FREE( szVarName, sizeof(char)*MAX_VAR_LEN );
return ret;
}
return LotteryRe;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:26,代码来源:LotteryFun.cpp
示例5: InterfaceHint
//界面帮助提示
double CScript::InterfaceHint(const char* cmd, char* retStr)
{
int nRet = 0;
char* pszScriptName=GetStringParam(cmd,0);
if( pszScriptName )
{
long lFutureDelTime = static_cast<long>(GetIntParam(cmd, 1));
if( lFutureDelTime != ERROR_CODE && lFutureDelTime != INVILID_VALUE )
{
char* pszInterfaceName=GetStringParam(cmd,2);
if( pszInterfaceName )
{
long lX = static_cast<long>(GetIntParam(cmd, 3));
long lY = static_cast<long>(GetIntParam(cmd, 4));
long lWidth = static_cast<long>(GetIntParam(cmd, 5));
long lHeight = static_cast<long>(GetIntParam(cmd, 6));
if(lX != ERROR_CODE && lX != INVILID_VALUE &&
lY != ERROR_CODE && lY != INVILID_VALUE &&
lWidth != ERROR_CODE && lWidth != INVILID_VALUE &&
lHeight != ERROR_CODE && lHeight != INVILID_VALUE)
{
CPlayer* pPlayer = dynamic_cast<CPlayer*>(p_SrcShape);
if( pPlayer )
{
//添加提示
nRet = pPlayer->AddInterfaceHint(pszScriptName,lFutureDelTime,pszInterfaceName,lX,lY,lWidth,lHeight);
}
}
M_FREE( pszInterfaceName, sizeof(char)*MAX_VAR_LEN );
}
}
M_FREE( pszScriptName, sizeof(char)*MAX_VAR_LEN );
}
return nRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:36,代码来源:ClientViewFun.cpp
示例6: GetStringParam
double CScript::FormatGUID(const char* CmdStr, char* retStr)
{
char * pszGuid = GetStringParam(CmdStr, 0);
char * pszGuidString = GetStringParam(CmdStr, 1);
if(pszGuid && pszGuidString)
{
CGUID temptGUID(pszGuidString);
SetScriptGuidValue((CMoveShape*)p_SrcShape,pszGuid,temptGUID);
}
M_FREE( pszGuid, sizeof(char)*MAX_VAR_LEN );
M_FREE( pszGuidString, sizeof(char)*MAX_VAR_LEN );
return 1;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:14,代码来源:GlobalFun.cpp
示例7: GetIntParam
double CScript::SendExpAction(const char* CmdStr, char* retStr/* =NULL */)
{
double dRet = 0;
DWORD dwActionID = GetIntParam(CmdStr,0);
DWORD dwSrcType = GetIntParam(CmdStr,1);
char* strSrcGuid = GetStringParam(CmdStr,2);
CGUID guidDest;
CGUID guidSrc;
if (strSrcGuid!=NULL)
{
guidSrc = GetScriptGuidValue((CMoveShape*)p_SrcShape, strSrcGuid);
}
else
{
guidSrc = p_SrcShape->GetExID();
}
DWORD dwDestType = GetIntParam(CmdStr,3);
char* strDestGuid = GetStringParam(CmdStr,4);
if (strDestGuid!=NULL)
{
guidDest = GetScriptGuidValue((CMoveShape*)p_SrcShape, strDestGuid);
}
if (dwDestType==ERROR_CODE || dwDestType==INVILID_VALUE)
{
dwDestType = 0;
}
if (guidDest== CGUID::GUID_INVALID)
{
guidDest = NULL_GUID;
}
if(dwActionID!=ERROR_CODE && dwSrcType!=ERROR_CODE && guidSrc!= CGUID::GUID_INVALID && this->m_pRegion != NULL)
{
CMoveShape *pMoveShape = dynamic_cast<CMoveShape*>( m_pRegion->FindChildObject(OBJECT_TYPE(dwSrcType), guidSrc ) );
CMessage msg(MSG_S2C_OTHER_EXPATC);
msg.Add(dwActionID);
msg.Add(dwSrcType);
msg.Add(guidSrc);
msg.Add(dwDestType);
msg.Add(guidDest);
msg.SendToAround(pMoveShape);
dRet = 1.0;
}
M_FREE( strSrcGuid, sizeof(char)*MAX_VAR_LEN );
M_FREE( strDestGuid, sizeof(char)*MAX_VAR_LEN );
return dRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:48,代码来源:ClientViewFun.cpp
示例8: AddGoodToShortCutBar
double CScript::AddGoodToShortCutBar(const char* cmd, char* retStr)
{
int nRet = 0;
char* name=GetStringParam(cmd,0);
if( name )
{
CPlayer* pPlayer = dynamic_cast<CPlayer*>(p_SrcShape);
if(pPlayer)
{
CGoods * pGoods = pPlayer->FindGoodInPack(name);
//如果检测有该物品
if(pGoods)
{
long nBarNo = static_cast<long>(GetIntParam(cmd, 1));
if( nBarNo != ERROR_CODE && nBarNo != INVILID_VALUE)
{
pPlayer->SetHotKey(nBarNo, pGoods->GetBasePropertiesIndex());
CMessage msg(MSG_S2C_SETHOTKEY);
msg.Add((char)HOTKEY_SET_SUCCEED);
msg.Add((BYTE)nBarNo);
msg.Add(pGoods->GetBasePropertiesIndex());
msg.SendToPlayer(pPlayer->GetExID());
nRet = 1;
}
}
}
M_FREE( name, sizeof(char)*MAX_VAR_LEN );
}
return nRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:32,代码来源:ClientViewFun.cpp
示例9: GetStringParam
double CScript::DelCollection(const char* cmd, char* retStr)
{
if(p_SrcShape == NULL) return 0;
double ret = 0;
char *pGuidName = GetStringParam( cmd, 0 );
if (NULL == pGuidName)
{
return ret;
}
CGUID guid = GetVariableList()->GetGuidValue(pGuidName);
if( guid == NULL_GUID )
{
M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
return ret;
}
CServerRegion* pRegion = reinterpret_cast<CServerRegion*>( p_SrcShape -> GetFather() );
CShape* pShape = NULL;
if( pRegion )
pShape = dynamic_cast<CShape*>( pRegion -> FindChildObject( TYPE_COLLECTION, guid) );
if( pRegion && pShape )
{
pRegion->DelShapeToAround(pShape);
pRegion->DeleteChildObject(pShape);
ret = 1;
}
M_FREE( pGuidName, sizeof(char)*MAX_VAR_LEN );
return 1;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:33,代码来源:OtherShape.cpp
示例10: OperaInterface
double CScript::OperaInterface(const char* cmd, char* retStr)
{
int nRet = 0;
//变化方式
long lOperaMode = static_cast<long>(GetIntParam(cmd, 0));
if( lOperaMode != ERROR_CODE && lOperaMode != INVILID_VALUE )
{
char* InterfaceName=GetStringParam(cmd,1);
if( InterfaceName )
{
CPlayer* pPlayer = dynamic_cast<CPlayer*>(p_SrcShape);
if( pPlayer )
{
#ifdef _DEBUG
OutputDebugString("\n================发送关闭界面消息=========================\n");
#endif
CMessage msg(MSG_S2C_OTHER_OPERAINTERFACE);
msg.Add(lOperaMode);
msg.Add(InterfaceName);
msg.SendToPlayer(pPlayer->GetExID());
nRet = 1;
}
M_FREE( InterfaceName, sizeof(char)*MAX_VAR_LEN );
}
}
return nRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:27,代码来源:ClientViewFun.cpp
示例11: RegisterTimer
//为当前对象注册一个定时器
double CScript::RegisterTimer(const char* cmd, char* retStr)
{
int nRet = 0;
long lfuturetime = static_cast<long>(GetIntParam(cmd, 0));
if(lfuturetime != ERROR_CODE && lfuturetime != INVILID_VALUE)
{
long lInterTime = static_cast<long>(GetIntParam(cmd, 1));
if(lInterTime != ERROR_CODE && lInterTime != INVILID_VALUE)
{
char* pszScriptName=GetStringParam(cmd,2);
if( pszScriptName )
{
long lUserData = static_cast<long>(GetIntParam(cmd, 3));
if(lUserData != ERROR_CODE && lUserData != INVILID_VALUE)
{
CMoveShape* pMoveShape = dynamic_cast<CMoveShape*>(p_SrcShape);
if( pMoveShape )
{
//添加提示
nRet = pMoveShape->RegisterScriptTimer(lfuturetime,lInterTime,
pszScriptName,lUserData);
}
}
M_FREE( pszScriptName, sizeof(char)*MAX_VAR_LEN );
}
}
}
return nRet;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:30,代码来源:MoveShapeFun.cpp
示例12: GetIntParam
//! 获取一个字符串的子串
//! 参数1:要提取的子串的开始位置,从1开始(若输入的位置大于字符串长度,返回失败;若为0,则返回字符串最后一个字节, 若为负数-n则返回除去最后n个字节的字符串)
//! 参数2:要提取的子串的结束位置,从1开始(若输入的位置大于字符串长度,转换为最大长度)
//! 参数3:提取的目标字符串
//! 参数4:返回子串的变量名
//! 返回值:1,提取成功,0,提取失败
double CScript::GetSubString(const char* CmdStr, char* retStr)
{
long BeginPos = GetIntParam(CmdStr, 0);
long EndPos = GetIntParam(CmdStr, 1);
char* pSrcStr =GetStringParam(CmdStr, 2);
if (NULL == pSrcStr)
return 0.0f;
DWORD SrcLen = strlen(pSrcStr);
if(0 == BeginPos)
{
BeginPos = SrcLen;
EndPos = SrcLen;
}
else if (0 > BeginPos)
{
EndPos = SrcLen + BeginPos;
BeginPos = 1;
}
else if(EndPos > SrcLen)
EndPos = SrcLen;
if (BeginPos > SrcLen || EndPos < BeginPos)
{
M_FREE( pSrcStr, sizeof(char)*MAX_VAR_LEN );
return 0.0f;
}
char* pDstName =GetStringParam(CmdStr, 3);
if (NULL == pDstName)
{
M_FREE( pSrcStr, sizeof(char)*MAX_VAR_LEN );
return 0.0f;
}
char szRe[MAX_VAR_LEN] = {0};
memcpy(szRe, pSrcStr + (BeginPos - 1), EndPos - BeginPos + 1);
int ret = SetScriptVarValue(dynamic_cast<CMoveShape*>(p_SrcShape), pDstName, szRe);
M_FREE( pSrcStr, sizeof(char)*MAX_VAR_LEN );
M_FREE( pDstName, sizeof(char)*MAX_VAR_LEN );
return ret;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:52,代码来源:BaseFun.cpp
示例13: timeGetTime
//call的扩展版本,和子脚本公用脚本变量列表
enum CScript::SCRIPTRETURN CScript::callEx(const char* CmdStr, char* retStr)
{
//初始为错误
CScript::SCRIPTRETURN retFlag = CScript::SR_ERROR;
char *str=GetStringParam(CmdStr, 0);
if (str)
{
#ifdef _RUNSTACKINFO_
char pszStatckInfo[10240]="";
_snprintf(pszStatckInfo,10240,"callEx(FileName:%s) Start",str);
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),pszStatckInfo);
#endif
#ifdef _SCRIPT_INFO_
DWORD BeginTime = timeGetTime();
m_RunTime = 0;
#endif
CScript* pTempScript = PopFreeScript(str);
InitChildScriptData(pTempScript);
pTempScript->SetVariableList(GetVariableList());
// 加载脚本内容
if( pTempScript->LoadScript(str, (char*)GetGame()->GetScriptFileData(str)) )
{
//记录进入子脚本
EnterChildScript(CST_CALLEX,pTempScript,"","");
retFlag = pTempScript->RunStep();
if(retFlag == CScript::SR_HANG)
{
#ifdef _RUNSTACKINFO_
_snprintf(pszStatckInfo,10240,"callEx(FileName:%s) Hang",str);
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),pszStatckInfo);
#endif
#ifdef _SCRIPT_INFO_
m_RunTime += timeGetTime() - BeginTime;
#endif
M_FREE( str, sizeof(char)*MAX_VAR_LEN );
SetIsHang(true);
SetHangFunc(pTempScript->GetHangFunc());
return retFlag;
}
//只要该脚本不挂起,就记录离开子脚本
LeaveChildScript(pTempScript);
}
#ifdef _RUNSTACKINFO_
_snprintf(pszStatckInfo,10240,"callEx(FileName:%s) End",str);
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),pszStatckInfo);
#endif
#ifdef _SCRIPT_INFO_
GetGame()->AddScriptInfo(str, timeGetTime() - BeginTime);
m_RunTime = 0;
#endif
pTempScript->ResetVariableList();
PushFreeScript(pTempScript);
M_FREE( str, sizeof(char)*MAX_VAR_LEN );
}
return retFlag;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:57,代码来源:BaseFun.cpp
示例14: Goto
double CScript::Goto(const char* CmdStr, char* retStr)
{
char *str=GetStringParam(CmdStr, 0);
if (str)
{
JumpTo( str );
M_FREE( str, sizeof(char)*MAX_VAR_LEN );
}
return 1;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:10,代码来源:BaseFun.cpp
示例15: switch
size_t cmCommandLineInfo::ParseSwitch(char **argv, int arg_index, int argc)
{
wxString param = argv[arg_index];
// we need this for a switch, at least 2
if(param.Len() > 1)
{
// determine switch type
switch (param.GetChar(1))
{
case 'G':
// when it's G<.....> we split else we take the
// other argc
if(param.Len() > 2)
{
m_GeneratorChoiceString = GetStringParam(param.Mid(2));
return 1; // one arg is passed
}
else
{
if((arg_index+1) < argc)
{
m_GeneratorChoiceString = GetStringParam(wxString(argv[arg_index+1]));
return 2; // two args are passed
}
}
// no luck
return 0;
case 'Q':
m_ExitAfterLoad = true;
return 1;
// unknown param
default:
break;
}
}
// error, unrecognised or too small arg
return 0;
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:42,代码来源:CommandLineInfo.cpp
示例16: GetDoor
double CScript::GetDoor(const char* cmd, char* retStr)
{
char *strTemp=GetStringParam(cmd,0);
if (strTemp)
{
long id=GetIntParam(cmd,1);
double dRegion=GetIntParam(cmd,2);
if (id!=ERROR_CODE)
{
CServerRegion* pRegion=NULL;
if (dRegion!=ERROR_CODE)
{
pRegion = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_NORMAL, dRegion);
if(pRegion == NULL)
pRegion = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_PERSONAL, dRegion);
if(pRegion == NULL)
pRegion = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_PERSONAL_HOUSE, dRegion);
if(pRegion == NULL)
pRegion = GameManager::GetInstance()->GetRgnManager()->FindRgnByTemplateID(RGN_TEAM, dRegion);
}
else
{
CPlayer *pPlayer=dynamic_cast<CPlayer*>(p_SrcShape);
if(pPlayer)
pRegion=dynamic_cast<CServerRegion*>(pPlayer->GetFather());
}
if (pRegion)
{
if (strcmp("State",strTemp)==0)
{
M_FREE( strTemp, sizeof(char)*MAX_VAR_LEN );
return pRegion->GetDoorState(id);
}
else if (strcmp("Switch",strTemp)==0)
{
M_FREE( strTemp, sizeof(char)*MAX_VAR_LEN );
return pRegion->GetDoorDestroySwitch(id);
}
else if (strcmp("Hp",strTemp)==0)
{
M_FREE( strTemp, sizeof(char)*MAX_VAR_LEN );
return pRegion->GetDoorHP(id);
}
else if (strcmp("MaxHp",strTemp)==0)
{
M_FREE( strTemp, sizeof(char)*MAX_VAR_LEN );
return pRegion->GetDoorMaxHP(id);
}
}
}
M_FREE( strTemp, sizeof(char)*MAX_VAR_LEN );
}
return 0;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:54,代码来源:OtherShape.cpp
示例17: GetFloatParam
status GetFloatParam(vector<parameters>& v, const string p, float& result, float def){
string tmp = " ";
status St = GetStringParam(v, p, tmp, " ");
if (SUCCESS == St){
result = atof(tmp.c_str());
}
else{
result = def;
}
return St;
}
开发者ID:radiolok,项目名称:node-spice,代码行数:13,代码来源:Strings.cpp
示例18: GetStringParam
double CScript::CheckGuidIsNull(const char* cmd, char* retStr)
{
char* szGuid = GetStringParam(cmd, 0);
if(!szGuid) return 0.0f;
const CGUID &tGuid = GetScriptGuidValue((CMoveShape*)GetSrcShape(), szGuid);
if(tGuid == NULL_GUID)
{
M_FREE( szGuid, sizeof(char)*MAX_VAR_LEN );
return 1.0f;
}
M_FREE( szGuid, sizeof(char)*MAX_VAR_LEN );
return 0.0f;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:13,代码来源:BaseFun.cpp
注:本文中的GetStringParam函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论