MCPcopy Create free account
hub / github.com/ZDoom/gzdoom / SetValue

Method SetValue

src/playsim/fragglescript/t_variable.cpp:239–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237//==========================================================================
238
239void DFsVariable::SetValue(FLevelLocals *Level, const svalue_t &newvalue)
240{
241 if(type == svt_const)
242 {
243 // const adapts to the value it is set to
244 type = newvalue.type;
245 }
246
247 switch (type)
248 {
249 case svt_int:
250 value.i = intvalue(newvalue);
251 break;
252
253 case svt_string:
254 if (newvalue.type == svt_string)
255 {
256 string = newvalue.string;
257 }
258 else
259 {
260 string = stringvalue(newvalue);
261 }
262 break;
263
264 case svt_fixed:
265 value.fixed = fixedvalue(newvalue);
266 break;
267
268 case svt_mobj:
269 actor = actorvalue(Level, newvalue);
270 break;
271
272 case svt_pInt:
273 *value.pI = intvalue(newvalue);
274 break;
275
276 case svt_pMobj:
277 *value.pMobj = actorvalue(Level, newvalue);
278 break;
279
280 case svt_function:
281 script_error("attempt to set function to a value\n");
282 break;
283
284 default:
285 script_error("invalid variable type\n");
286 break;
287 }
288}
289
290//==========================================================================
291//

Callers 5

DEFINE_ACTION_FUNCTIONFunction · 0.45
SetUserVariableMethod · 0.45
OPequalsMethod · 0.45
OPincrementMethod · 0.45
OPdecrementMethod · 0.45

Calls 5

intvalueFunction · 0.85
stringvalueFunction · 0.85
fixedvalueFunction · 0.85
actorvalueFunction · 0.85
script_errorFunction · 0.85

Tested by

no test coverage detected