| 594 | } |
| 595 | |
| 596 | void Game_Variables::SwapArray(int first_id_a, int last_id_a, int first_id_b) { |
| 597 | PrepareArray(first_id_a, last_id_a, first_id_b, "Invalid write var[{},{}] <-> var[{},{}]!"); |
| 598 | auto& vv = _variables; |
| 599 | const int steps = std::max(0, last_id_a - first_id_a + 1); |
| 600 | int out_b = std::max(0, first_id_b + steps - 2); |
| 601 | int out_a = std::max(0, last_id_a - 1); |
| 602 | for (int i = 0; i < steps; ++i) { |
| 603 | std::swap(vv[out_a--], vv[out_b--]); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | std::string_view Game_Variables::GetName(int _id) const { |
| 608 | const auto* var = lcf::ReaderUtil::GetElement(lcf::Data::variables, _id); |
no test coverage detected