MCPcopy Create free account
hub / github.com/arx/ArxLibertatis / SETVarValueText

Function SETVarValueText

Sources/DANAE/ARX_Script.cpp:2275–2306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2273//*************************************************************************************
2274//*************************************************************************************
2275SCRIPT_VAR * SETVarValueText(SCRIPT_VAR ** svf, long * nb, char * name, char * val)
2276{
2277 SCRIPT_VAR * tsv;
2278 tsv = GetVarAddress(*svf, nb, name);
2279
2280 if (!tsv)
2281 {
2282 tsv = GetFreeVarSlot(svf, nb);
2283
2284 if (!tsv)
2285 return NULL;
2286
2287 tsv->text = NULL;
2288 strcpy(tsv->name, name);
2289 }
2290
2291 if (tsv->text)
2292 {
2293 free((void *)tsv->text);
2294 tsv->text = NULL;
2295 }
2296
2297 tsv->ival = strlen(val) + 1;
2298
2299 if (tsv->ival)
2300 tsv->text = strdup(val);
2301 else
2302 tsv->text = NULL;
2303
2304
2305 return tsv;
2306}
2307
2308SCRIPT_EVENT AS_EVENT[] =
2309{

Callers 2

SendScriptEventFunction · 0.85
ARX_SCRIPT_SetVarFunction · 0.85

Calls 2

GetVarAddressFunction · 0.85
GetFreeVarSlotFunction · 0.85

Tested by

no test coverage detected