| 412 | } |
| 413 | |
| 414 | int 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 | |
| 433 | void ScriptParam::SetInt(int val) { |
| 434 | type_ = INT; |
no test coverage detected