MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / OnServerMsgRequestScriptHash

Method OnServerMsgRequestScriptHash

CryGame/XClient.cpp:2274–2386  ·  view source on GitHub ↗

////////////////////////////////////////// XSERVERMSG_REQUESTSCRIPTHASH

Source from the content-addressed store, hash-verified

2272///////////////////////////////////////////////
2273// XSERVERMSG_REQUESTSCRIPTHASH
2274bool CXClient::OnServerMsgRequestScriptHash(CStream &stm)
2275{
2276 IBitStream *pBitStream = m_pGame->GetIBitStream();
2277
2278 char szPath[256];
2279 char szKey[256];
2280
2281 u32 dwHash;
2282 EntityId entity=INVALID_WID;
2283
2284 if(!pBitStream->ReadBitStream(stm,entity,eEntityId)) // e.g. INVALID_WID for globals, otherwise it's and entity
2285 return false;
2286 if(!pBitStream->ReadBitStream(stm,szPath,255,eASCIIText)) // e.g. "cnt.myTable"
2287 return false;
2288 if(!pBitStream->ReadBitStream(stm,szKey,255,eASCIIText)) // e.g. "luaFunc1" or ""
2289 return false;
2290 if(!pBitStream->ReadBitStream(stm,dwHash,eDoNotCompress)) // start hash
2291 return false;
2292
2293 // debug
2294// m_pLog->Log("OnServerMsgRequestScriptHash '%s' '%s'",szPath,szKey);
2295
2296 // find the specified root -------------------
2297/*
2298 IScriptSystem *pScriptSystem=m_pGame->GetScriptSystem();
2299 IScriptObject *pRoot;
2300
2301 if(entity==INVALID_WID)
2302 {
2303 // global
2304 pRoot=pScriptSystem->GetGlobalObject();
2305 }
2306 else
2307 {
2308 // relative to a entity
2309 IEntity *pEntity=m_pISystem->GetEntity(entity);
2310
2311 pRoot=pEntity->GetScriptObject();
2312 }
2313
2314 if(!pRoot)
2315 return false;
2316
2317 // apply the path -----------------------------
2318
2319 IScriptObject *pPath=m_pScriptSystem->CreateEmptyObject();
2320
2321 if(!pRoot->GetValueRecursive(szPath,pPath)) // is modifying the given Hash
2322 {
2323 pRoot->Release();
2324 return false;
2325 }
2326
2327 // --------------------------------------------
2328
2329 if(*szKey)
2330 {
2331 unsigned int *pCode;

Callers

nothing calls this directly

Calls 2

GetIBitStreamMethod · 0.80
ReadBitStreamMethod · 0.45

Tested by

no test coverage detected