| 22 | } |
| 23 | |
| 24 | bool Opcode::readOpcode (aithread &thread) |
| 25 | { |
| 26 | // Read the opcode |
| 27 | BYTE bOpcode = thread.read<BYTE>(); |
| 28 | |
| 29 | // Check if opcode is valid |
| 30 | if ( bOpcode >= AISCRIPT::Enum::LAST || !Opcode::opcodeList[bOpcode] ) |
| 31 | { |
| 32 | Broodwar << Text::Red << "Invalid Script Opcode: " << bOpcode << std::endl; |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | // Call the opcode |
| 37 | bool success = Opcode::opcodeList[bOpcode]->execute(thread); |
| 38 | |
| 39 | // If the opcode execution succeeded, then we don't want to retry the opcode |
| 40 | if ( success ) |
| 41 | thread.noretry(); |
| 42 | return success; |
| 43 | } |