MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / GetFloat

Method GetFloat

Source/Scripting/scriptparams.cpp:400–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400float ScriptParam::GetFloat() const {
401 switch (type_) {
402 case FLOAT:
403 return f_val_;
404 case INT:
405 return (float)i_val_;
406 case STRING:
407 return (float)atof(str_val_.c_str());
408 default:
409 DisplayError("Error", "Calling GetFloat() on parameter of invalid type.");
410 return -1.0f;
411 }
412}
413
414int ScriptParam::GetInt() const {
415 switch (type_) {

Callers 4

ApplyScriptParamsMethod · 0.45
DrawScriptParamsEditorFunction · 0.45
ASGetFloatMethod · 0.45

Calls 2

DisplayErrorFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected