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

Function LoadProperties

CryGame/GameLoading.cpp:148–174  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

146
147//////////////////////////////////////////////////////////////////////////
148void LoadProperties(IScriptObject *table, CStream &stm, IScriptSystem *ss, char *parent)
149{
150 ASSERT(table);
151 ASSERT(ss); // martin made me do it
152 for(;;)
153 {
154 char what;
155 stm.Read(what);
156 if(what==TABLE_END) return;
157
158 char iskey;
159 stm.Read(iskey);
160 int idx = 0;
161 string key;
162 iskey ? stm.Read(key) : stm.Read(idx);
163
164 switch(what)
165 {
166 case svtNull: { iskey ? table->SetToNull(key.c_str()) : table->SetNullAt(idx); break; };
167 case svtString: { string s; stm.Read(s); iskey ? table->SetValue(key.c_str(), s.c_str()) : table->SetAt(idx, s.c_str()); break; };
168 case svtNumber: { float f = 0; stm.Read(f); iskey ? table->SetValue(key.c_str(), f) : table->SetAt(idx, f); break; };
169 case svtObject: { _SmartScriptObject t(ss); iskey ? table->SetValue(key.c_str(), *t) : table->SetAt(idx, *t); LoadProperties(t, stm, ss, (char *)key.c_str()); break; };
170 case svtUserData:
171 case svtFunction: TRACE("WARNING: can't restore userdata or function in properties table (%s.%s)", parent, key.c_str());
172 };
173 };
174};
175
176//////////////////////////////////////////////////////////////////////////
177class CCVarSerializeGameSave : public ICVarDumpSink

Callers 3

LoadFromStreamMethod · 0.85

Calls 6

SetToNullMethod · 0.80
SetNullAtMethod · 0.80
SetAtMethod · 0.80
ReadMethod · 0.45
c_strMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected