void CPropAPC2::Materialize( void ) { //trace_t tr; //UTIL_TraceHull( m_vOriginalSpawnOrigin, m_vOriginalSpawnOrigin, Vector(-38,-38,-38),Vector(38,38,38), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr ); //if ( (tr.startsolid || tr.allsolid) && m_iSpawnTry<3 ) //{ // //Try again in a second. // SetContextThink(&QUA_Strider::Materialize, gpGlobals->curtime + 1.0f, "RESPAWNING" ); // SetNextThink( gpGlobals->curtime + 1.0f ); // m_iSpawnTry++; // return; //} SetAbsOrigin( InicialSpawn ); SetAbsAngles( InicialAngle ); KeyValue( "model", "models/combine_apc.mdl" ); KeyValue( "solid", "6" ); KeyValue( "targetname", "elapc" ); KeyValue( "vehiclescript", "scripts/vehicles/apc.txt" ); Teleport( &InicialSpawn, &InicialAngle, NULL ); Spawn(); Activate(); SetThink( &CPropAPC2::Think ); SetNextThink( gpGlobals->curtime); }
void CEnvDeferredSpotLight::Spawn() { BaseClass::Spawn(); KeyValue( "light_type", "1" ); KeyValue( "spot_cone_inner", m_fSpotFOV ); KeyValue( "spot_cone_outer", m_fSpotFOV ); KeyValue( "radius", m_fSpotLightDistance ); }
void WhoParser::AnimationCompleted(const char * inStr, int & inOutPos, AnimationCompletedCallback & outCompleted, std::string & outArgs) { std::string completedStr; if( KeyValue("completed", inStr, inOutPos, completedStr) ) { outCompleted = (AnimationCompletedCallback)gGame.animationVars[completedStr]; KeyValue("args", inStr, inOutPos, outArgs); } }
void ClientNetMessage::add_dict(char *key, Dictionary &d) { char t[4096]; if(d.make_body(t, 4096)) { KeyValue dat = KeyValue(NMString(key), NMString(t)); add(dat); } }
void ClientNetMessage::add_list(char *key, PipedStringList &list) { char t[4096]; if(list.make_body(t, 4096)) { KeyValue dat = KeyValue(NMString(key), NMString(t)); add(dat); } }
static int luaFuncRegisterExternalPBXFileReferenceExternal(lua_State* l) { g_externalFileReference.push_back(KeyValue()); mbLuaToStringExpandMacros(&g_externalFileReference.back().key, NULL, l, 1); //filename mbLuaToStringExpandMacros(&g_externalFileReference.back().value, NULL, l, 2); //id return 0; }
static int luaFuncRegisterExternalPBXNativeTargetExternal(lua_State* l) { g_externalNativeTarget.push_back(KeyValue()); mbLuaToStringExpandMacros(&g_externalNativeTarget.back().key, NULL, l, 1); //target mbLuaToStringExpandMacros(&g_externalNativeTarget.back().value, NULL, l, 2); //id return 0; }
int Dictionary::parse(char *data, int size) { int i = 0, tl, il, pos = 0; bool first = true; char *key, *value; while(pos < size) { tl = strcspn(data + pos, "\x1c"); if(first && tl == 0) { first = false; pos += 1; } else { if(pos + tl < size) { *(data + pos + tl) = 0; il = strcspn(data + pos, "="); *(data + pos + il) = 0; key = unescape_inplace(data + pos); value = unescape_inplace(data + pos + il + 1); KeyValue kv = KeyValue(NMString(key), NMString(value)); add(kv); } pos += tl + 1; } } return i; }
static int luaFuncRegisterProjectID(lua_State* l) { g_externalProjectReference.push_back(KeyValue()); mbLuaToStringExpandMacros(&g_externalProjectReference.back().key, NULL, l, 1); // target; mbLuaToStringExpandMacros(&g_externalProjectReference.back().value, NULL, l, 2); // id; return 0; }
TypeData *TypeData::at (const Key &key) const { dl_assert (structured(), "bug in TypeData"); if (key == Key::any_key()) { return any_next_; } lookup_iterator it = lower_bound (next_.begin(), next_.end(), KeyValue (key, NULL)); if (it != next_.end() && it->first == key) { return it->second; } return NULL; }
void ReferencedData::setReferencedData(const QString &id, const QString &data) { if (id.isEmpty()) { return; } KeyValueVector::iterator findIt = d->mVector.binaryFind(id); if (findIt != d->mVector.end()) { if (data != findIt->value) { findIt->value = data; emit dataChanged(findIt - d->mVector.begin()); } } else { findIt = qLowerBound(d->mVector.begin(), d->mVector.end(), KeyValue(id), KeyValue::lessThan); const int row = findIt - d->mVector.begin(); emit rowsAboutToBeInserted(row, row); d->mVector.insert(findIt, KeyValue(id, data)); emit rowsInserted(); } }
void CEnvDeferredLight::Spawn() { BaseClass::Spawn(); // Always on! AddSpawnFlags( DEFLIGHT_ENABLED|DEFLIGHT_SHADOW_ENABLED ); KeyValue( "light_type", "0" ); KeyValue( "diffuse", UTIL_VarArgs( "%f %f %f %f", m_vLightColor.x, m_vLightColor.y, m_vLightColor.z, 255.0f * m_fIntensity ) ); KeyValue( "ambient", "10 10 10 255" ); KeyValue( "power", UTIL_VarArgs( "%f", m_fStartFalloff ) ); KeyValue( "vis_dist", UTIL_VarArgs( "%d", 1024 ) ); KeyValue( "vis_range", UTIL_VarArgs( "%d", 512 ) ); KeyValue( "shadow_dist", UTIL_VarArgs( "%d", 1024 ) ); KeyValue( "shadow_range", UTIL_VarArgs( "%d", 512 ) ); KeyValue( "spot_cone_inner", UTIL_VarArgs( "%f", 35.0 ) ); KeyValue( "spot_cone_outer", UTIL_VarArgs( "%f", 45.0 ) ); }
JSONVariant MakeTestVariant(HandleT* handle) { // In JS syntax: // // return [ // undefined, null, true, 1.25, "test string", // handle, // [ 1, 2, 3 ], // { "undefined" : undefined, // "null" : null, // "true" : true, // "1.25" : 1.25, // "string" : "string" // "handle" : handle, // "array" : [ 1, 2, 3 ] // } // ] // InfallibleTArray<JSONVariant> outer; outer.AppendElement(void_t()); outer.AppendElement(null_t()); outer.AppendElement(true); outer.AppendElement(1.25); outer.AppendElement(String("test string")); outer.AppendElement(handle); InfallibleTArray<JSONVariant> tmp; Array123(tmp); outer.AppendElement(tmp); InfallibleTArray<KeyValue> obj; obj.AppendElement(KeyValue(String("undefined"), void_t())); obj.AppendElement(KeyValue(String("null"), null_t())); obj.AppendElement(KeyValue(String("true"), true)); obj.AppendElement(KeyValue(String("1.25"), 1.25)); obj.AppendElement(KeyValue(String("string"), String("value"))); obj.AppendElement(KeyValue(String("handle"), handle)); InfallibleTArray<JSONVariant> tmp2; Array123(tmp2); obj.AppendElement(KeyValue(String("array"), tmp2)); outer.AppendElement(obj); test_assert(outer == outer, "operator== is broken"); return JSONVariant(outer); }
void CPropGladosCore::Spawn( void ) { SetupVOList(); Precache(); KeyValue( "model", GLADOS_CORE_MODEL_NAME ); BaseClass::Spawn(); //Default to 'dropped' animation ResetSequence(LookupSequence("drop")); SetCycle( 1.0f ); DisableAutoFade(); m_iEyeballAttachment = LookupAttachment( "eyeball" ); SetContextThink( &CPropGladosCore::AnimateThink, gpGlobals->curtime + 0.1f, s_pAnimateThinkContext ); }
bool ClientNetMessage::add_data(char *key, char *data, int size) { int len = Netlib_GetBase64EncodedBufferSize(size); char *buff = new char[len]; NETLIBBASE64 nbd = {0}; nbd.pszEncoded = buff; nbd.cchEncoded = len; nbd.pbDecoded = (BYTE *)data; nbd.cbDecoded = size; if(CallService(MS_NETLIB_BASE64ENCODE, 0, (LPARAM)&nbd)) { KeyValue dat = KeyValue(NMString(key), NMString(buff)); add(dat); delete[] buff; return true; } delete[] buff; return false; }
void ReferencedData::addMap(const QMap<QString, QString> &idDataMap) { QMap<QString, QString>::const_iterator it = idDataMap.constBegin(); const QMap<QString, QString>::const_iterator end = idDataMap.constEnd(); if (d->mVector.isEmpty()) { d->mVector.reserve(idDataMap.count()); // The vector is currently empty -> fast path // The map is already sorted, we can just copy right away // and emit the signals only once, which is the whole point of this method. emit rowsAboutToBeInserted(0, idDataMap.count() - 1); for ( ; it != end ; ++it) { d->mVector.append(KeyValue(it.key(), it.value())); } emit rowsInserted(); } else { // Append to existing data -> slower code path for ( ; it != end ; ++it) { setReferencedData(it.key(), it.value()); } } }
TypeData *TypeData::at_force (const Key &key) { dl_assert (structured(), "bug in TypeData"); TypeData *res = at (key); if (res != NULL) { return res; } TypeData *value = get_type (tp_Unknown)->clone(); value->parent_ = this; value->on_changed(); if (key == Key::any_key()) { any_next_ = value; return value; } KeyValue to_add (key, value); NextT::iterator insert_pos = lower_bound (next_.begin(), next_.end(), KeyValue (key, NULL)); next_.insert (insert_pos, to_add); return value; }
void CHTTPPostSocket::ParseOutput() { tstring sReturn = RecvAll(); bool bHTTPOver = false; tvector<tstring> vTokens; strtok(sReturn, vTokens, "\n"); for (unsigned int i = 1; i < vTokens.size(); i++) { tstring sToken = vTokens[i]; if (!trim(sToken).length()) { bHTTPOver = true; continue; } if (!bHTTPOver) continue; tstring::size_type iColon = sToken.find(":"); KeyValue(sToken.substr(0, iColon).c_str(), sToken.substr(iColon+2).c_str()); } }
inline iterator binaryFind(const QString& key) { return qBinaryFind(begin(), end(), KeyValue(key, QString())); }
JValue::KeyValue JValue::ObjectIterator::operator*() const { return KeyValue(jvalue_copy(_key_value.key), jvalue_copy(_key_value.value)); }
const KeyValue KeyValue::from( const bool& firstElement ) { return KeyValue( firstElement ? trueString : falseString ); }
const KeyValue KeyValue::from( const std::wstring& firstElement ) { return KeyValue( QString::fromStdWString( firstElement ) ); }
const KeyValue KeyValue::from( const float& firstElement ) { return KeyValue( elemFromFloatingPoint( firstElement ) ); }
const KeyValue KeyValue::from( const int& firstElement ) { return KeyValue( QString( "%1" ).arg( firstElement ) ); }
void StaticHashTableBuilder::add (const std::string & key, const std::string & value) { sf::HashValue h = sf::hash ((unsigned char*) key.c_str()); mHashes.push_back (HashPair (KeyValue (key, value), h)); }
inline const_iterator constBinaryFind(const QString& key) const { return qBinaryFind(constBegin(), constEnd(), KeyValue(key, QString())); }
void ClientNetMessage::add_string(char *key, char *buff) { char *temp = escape(buff); KeyValue dat = KeyValue(NMString(key), NMString(temp)); delete[] temp; add(dat); }
//--------------------------------------------------------------------------- // For unit testing // void sgStagingSchema::addInitialContext(std::string key, std::string value) { sgStagingKeyValue KeyValue(key, value); glistInitialContext.push_back(KeyValue); }
void Dictionary::add_string(char *key, char *buff) { KeyValue dat = KeyValue(NMString(key), NMString(buff)); add(dat); }