| 3466 | } |
| 3467 | |
| 3468 | bool Game_Interpreter::CommandConditionalBranch(lcf::rpg::EventCommand const& com) { // Code 12010 |
| 3469 | const auto& frame = GetFrame(); |
| 3470 | |
| 3471 | bool result = false; |
| 3472 | int value1, value2; |
| 3473 | int actor_id; |
| 3474 | Game_Actor* actor; |
| 3475 | Game_Character* character; |
| 3476 | |
| 3477 | switch (com.parameters[0]) { |
| 3478 | case 0: |
| 3479 | // Switch |
| 3480 | result = Main_Data::game_switches->Get(com.parameters[1]) == (com.parameters[2] == 0); |
| 3481 | break; |
| 3482 | case 1: |
| 3483 | // Variable |
| 3484 | value1 = Main_Data::game_variables->Get(com.parameters[1]); |
| 3485 | value2 = ValueOrVariable(com.parameters[2], com.parameters[3]); |
| 3486 | result = CheckOperator(value1, value2, com.parameters[4]); |
| 3487 | break; |
| 3488 | case 2: |
| 3489 | value1 = Main_Data::game_party->GetTimerSeconds(Main_Data::game_party->Timer1); |
| 3490 | value2 = com.parameters[1]; |
| 3491 | switch (com.parameters[2]) { |
| 3492 | case 0: |
| 3493 | result = (value1 >= value2); |
| 3494 | break; |
| 3495 | case 1: |
| 3496 | result = (value1 <= value2); |
| 3497 | break; |
| 3498 | } |
| 3499 | break; |
| 3500 | case 3: |
| 3501 | // Gold |
| 3502 | if (com.parameters[2] == 0) { |
| 3503 | // Greater than or equal |
| 3504 | result = (Main_Data::game_party->GetGold() >= com.parameters[1]); |
| 3505 | } else { |
| 3506 | // Less than or equal |
| 3507 | result = (Main_Data::game_party->GetGold() <= com.parameters[1]); |
| 3508 | } |
| 3509 | break; |
| 3510 | case 4: { |
| 3511 | // Item |
| 3512 | int item_id = com.parameters[1]; |
| 3513 | |
| 3514 | if (Player::IsPatchManiac()) { |
| 3515 | item_id = ValueOrVariable(com.parameters[3], item_id); |
| 3516 | } |
| 3517 | |
| 3518 | if (com.parameters[2] == 0) { |
| 3519 | // Having |
| 3520 | result = Main_Data::game_party->GetItemCount(item_id) |
| 3521 | + Main_Data::game_party->GetEquippedItemCount(item_id) > 0; |
| 3522 | } else { |
| 3523 | // Not having |
| 3524 | result = Main_Data::game_party->GetItemCount(item_id) |
| 3525 | + Main_Data::game_party->GetEquippedItemCount(item_id) == 0; |
nothing calls this directly
no test coverage detected