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

Method GetInt

Source/Scripting/scriptparams.cpp:414–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414int ScriptParam::GetInt() const {
415 switch (type_) {
416 case FLOAT:
417 return (int)f_val_;
418 case INT:
419 return i_val_;
420 case STRING:
421 if (str_val_ == "true") {
422 return 1;
423 } else if (str_val_ == "false") {
424 return 0;
425 }
426 return atoi(str_val_.c_str());
427 default:
428 DisplayError("Error", "Calling GetInt() on parameter of invalid type.");
429 return -1;
430 }
431}
432
433void ScriptParam::SetInt(int val) {
434 type_ = INT;

Callers 5

SavePrefabMethod · 0.45
SaveToXMLMethod · 0.45
DrawScriptParamsEditorFunction · 0.45
ASGetIntMethod · 0.45

Calls 2

DisplayErrorFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected