MCPcopy Create free account
hub / github.com/anjo76/angelscript / SetArgFloat

Method SetArgFloat

sdk/angelscript/source/as_context.cpp:1213–1254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211}
1212
1213int asCContext::SetArgFloat(asUINT arg, float value)
1214{
1215 if( m_status != asEXECUTION_PREPARED )
1216 return asCONTEXT_NOT_PREPARED;
1217
1218 if( arg >= (unsigned)m_initialFunction->parameterTypes.GetLength() )
1219 {
1220 m_status = asEXECUTION_ERROR;
1221 return asINVALID_ARG;
1222 }
1223
1224 // Verify the type of the argument
1225 asCDataType *dt = &m_initialFunction->parameterTypes[arg];
1226 if( dt->IsObject() || dt->IsFuncdef() || dt->IsReference() )
1227 {
1228 m_status = asEXECUTION_ERROR;
1229 return asINVALID_TYPE;
1230 }
1231
1232 if( dt->GetSizeOnStackDWords() != 1 )
1233 {
1234 m_status = asEXECUTION_ERROR;
1235 return asINVALID_TYPE;
1236 }
1237
1238 // Determine the position of the argument
1239 int offset = 0;
1240 if( m_initialFunction->objectType )
1241 offset += AS_PTR_SIZE;
1242
1243 // If function returns object by value an extra pointer is pushed on the stack
1244 if( m_returnValueSize )
1245 offset += AS_PTR_SIZE;
1246
1247 for( asUINT n = 0; n < arg; n++ )
1248 offset += m_initialFunction->parameterTypes[n].GetSizeOnStackDWords();
1249
1250 // Set the value
1251 *(float*)(&m_regs.stackFramePointer[offset]) = value;
1252
1253 return 0;
1254}
1255
1256int asCContext::SetArgDouble(asUINT arg, double value)
1257{

Callers 2

RunApplicationFunction · 0.80
UpdateMethod · 0.80

Calls 5

IsObjectMethod · 0.80
IsFuncdefMethod · 0.80
GetSizeOnStackDWordsMethod · 0.80
GetLengthMethod · 0.45
IsReferenceMethod · 0.45

Tested by 1

UpdateMethod · 0.64