| 417 | } |
| 418 | |
| 419 | bool setVector3(void * obj, std::string const & name, Vector3 const & value, bool raw, bool throwError) const |
| 420 | { |
| 421 | auto prop = Properties.find(name); |
| 422 | if (prop == Properties.end()) { |
| 423 | if (Parent != nullptr) { |
| 424 | return Parent->setVector3(toParent(obj), name, value, raw, throwError); |
| 425 | } else { |
| 426 | if (throwError) { |
| 427 | OsiError("Failed to set vector '" << name << "': Property does not exist"); |
| 428 | } |
| 429 | return false; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | if (!raw && prop->second.SetVector3) { |
| 434 | return prop->second.SetVector3(obj, value); |
| 435 | } |
| 436 | |
| 437 | if (!raw && !(prop->second.Flags & kPropWrite)) { |
| 438 | OsiError("Failed to set vector '" << name << "': Property not writeable"); |
| 439 | return false; |
| 440 | } |
| 441 | |
| 442 | auto ptr = reinterpret_cast<std::uintptr_t>(obj) + prop->second.Offset; |
| 443 | if (prop->second.Type == PropertyType::kVector3) { |
| 444 | *reinterpret_cast<Vector3 *>(ptr) = value; |
| 445 | return true; |
| 446 | } else { |
| 447 | OsiError("Failed to get property '" << name << "': Property is not a vector"); |
| 448 | return false; |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | std::optional<bool> getFlag(void * obj, std::string const & name, bool raw, bool throwError) const |
| 453 | { |
no outgoing calls
no test coverage detected