int CGlobalSettings::SetGlobalValue(const char *product, const char *key, const char *value, int ival) { char tmp[32]; snprintf(tmp,sizeof(tmp),"%d",ival); return SetGlobalValue(product,key,value,tmp); }
//------------------------------------------------------------------------ void CSynchedStorage::SerializeValue(TSerialize ser, TSynchedKey &key, TSynchedValue &value, int type) { ser.Value("key", key, 'ssk'); switch (type) { case eSVT_Bool: { bool b; if (ser.IsWriting()) b=*value.GetPtr<bool>(); ser.Value("value", b, 'bool'); if (ser.IsReading()) SetGlobalValue(key, b); } break; case eSVT_Float: { float f; if (ser.IsWriting()) f=*value.GetPtr<float>(); ser.Value("value", f, 'ssfl'); if (ser.IsReading()) SetGlobalValue(key, f); } break; case eSVT_Int: { int i; if (ser.IsWriting()) i=*value.GetPtr<int>(); ser.Value("value", i, 'ssi'); if (ser.IsReading()) SetGlobalValue(key, i); } break; case eSVT_EntityId: { EntityId e; if (ser.IsWriting()) e=*value.GetPtr<EntityId>(); ser.Value("value", e, 'eid'); if (ser.IsReading()) SetGlobalValue(key, e); } case eSVT_String: { static string s; s.resize(0); if (ser.IsWriting()) s=*value.GetPtr<string>(); ser.Value("value", s); if (ser.IsReading()) SetGlobalValue(key, s); } break; default: assert(0); break; } }
int CGlobalSettings::SetGlobalValue(const char *product, const char *key, const char *value, LONGINT lival) { char tmp[128]; sprintf(tmp,"%I64d",lival); return SetGlobalValue(product,key,value,tmp); }