/** * Sets a stat of type int32 to the value specified. Does nothing * if the stat is not of the right type. * * @param StatName the stat to change the value of * @param Value the new value to assign to the stat */ void FOnlineStats::SetIntStat(const FName& StatName, int32 Value) { FVariantData* Stat = FindStatByName(StatName); if (Stat != NULL && Stat->GetType() == EOnlineKeyValuePairDataType::Int32) { // Set the value Stat->SetValue(Value); } else { FVariantData NewValue(Value); Properties.Add(StatName, NewValue); } }
/** * Decrements a stat of type int32 by the value specified. Does nothing * if the stat is not of the right type. * * @param StatName the stat to decrement * @param DecBy the value to decrement by */ void FOnlineStats::DecrementIntStat(const FName& StatName, int32 DecBy) { FVariantData* Stat = FindStatByName(StatName); if (Stat != NULL && Stat->GetType() == EOnlineKeyValuePairDataType::Int32) { // Set the value Stat->Decrement<int32, EOnlineKeyValuePairDataType::Int32>(DecBy); } else { FVariantData NewValue(-DecBy); Properties.Add(StatName, NewValue); } }
/** * Increments a stat of type float by the value specified. Does nothing * if the stat is not of the right type. * * @param StatName the stat to increment * @param IncBy the value to increment by */ void FOnlineStats::IncrementFloatStat(const FName& StatName, float IncBy) { FVariantData* Stat = FindStatByName(StatName); if (Stat != NULL && Stat->GetType() == EOnlineKeyValuePairDataType::Float) { // Set the value Stat->Increment<float, EOnlineKeyValuePairDataType::Float>(IncBy); } else { FVariantData NewValue(IncBy); Properties.Add(StatName, NewValue); } }
static void define_variable(pSlip gd, pSlipObject var, pSlipObject val, pSlipEnvironment env) { pSlipValue v; v = ScanForVar(var, env); if (v != NULL) { v->val = val; return; } v = NewValue(); v->var = var; v->val = val; dlist_ins(env->lstVars, v); }
void ArpIntControlMediumMotion::MouseMoved( BPoint pt, uint32 code, const BMessage *msg) { if (mMouseDown) { if (mBaseRect.Contains(pt)) { mControl->NotifyHook(mBaseValue); mControl->SetValue(mBaseValue); } else { float xChange = pt.x - mPrevPt.x, yChange = pt.y - mPrevPt.y, newValue; newValue = float(NewValue(xChange, yChange)); mControl->SafeSetValue(int32(newValue)); } } mPrevPt = pt; }