/////////////////////////////////////////////////////////////////////
| 146 | |
| 147 | ////////////////////////////////////////////////////////////////////////// |
| 148 | void 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 | ////////////////////////////////////////////////////////////////////////// |
| 177 | class CCVarSerializeGameSave : public ICVarDumpSink |
no test coverage detected