MCPcopy Create free account
hub / github.com/bwapi/bwapi / execute

Method execute

bwapi/BWScriptEmulator/Race_Jump.cpp:8–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6IMPLEMENT(Race_Jump);
7
8bool Race_Jump::execute(aithread &thread) const
9{
10 // Retrieve parameters
11 WORD t_jmp, z_jmp, p_jmp;
12 thread.readTuple( std::tie(t_jmp, z_jmp, p_jmp) );
13
14 // should be AI_getClosestEnemyRace; gets closest enemy unit to region
15 // @TODO: BWAPI: Filters: IsEnemy, IsAlly, IsNeutral?
16
17 // Get enemy race
18 Race race = Races::None;
19 if ( Broodwar->enemy() )
20 race = Broodwar->enemy()->getRace();
21
22 /// Set the new script offset
23 switch ( race )
24 {
25 case Races::Enum::Protoss:
26 thread.setScriptOffset( p_jmp );
27 break;
28 case Races::Enum::Zerg:
29 thread.setScriptOffset( z_jmp );
30 break;
31 default:
32 thread.setScriptOffset( t_jmp );
33 break;
34 }
35
36 // Save debug info and return
37 thread.saveDebug(Text::Green, this->getOpcode(), "p_%04X p_%04X p_%04X", t_jmp, z_jmp, p_jmp);
38 return true;
39}

Callers

nothing calls this directly

Calls 6

setScriptOffsetMethod · 0.80
saveDebugMethod · 0.80
getOpcodeMethod · 0.80
readTupleMethod · 0.45
enemyMethod · 0.45
getRaceMethod · 0.45

Tested by

no test coverage detected