MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / apply

Method apply

battlecode-engine/src/world.rs:2212–2236  ·  view source on GitHub ↗

Applies a single delta to this GameWorld.

(&mut self, delta: &Delta)

Source from the content-addressed store, hash-verified

2210
2211 /// Applies a single delta to this GameWorld.
2212 pub(crate) fn apply(&mut self, delta: &Delta) -> Result<(), GameError> {
2213 match *delta {
2214 Delta::Attack {robot_id, target_unit_id} => self.attack(robot_id, target_unit_id),
2215 Delta::BeginSnipe {ranger_id, location} => self.begin_snipe(ranger_id, location),
2216 Delta::Blueprint {worker_id, structure_type, direction} => self.blueprint(worker_id, structure_type, direction),
2217 Delta::Blink {mage_id, location} => self.blink(mage_id, location),
2218 Delta::Build {worker_id, blueprint_id} => self.build(worker_id, blueprint_id),
2219 Delta::Disintegrate {unit_id} => self.disintegrate_unit(unit_id),
2220 Delta::Harvest {worker_id, direction} => self.harvest(worker_id, direction),
2221 Delta::Heal {healer_id, target_robot_id} => self.heal(healer_id, target_robot_id),
2222 Delta::Javelin {knight_id, target_unit_id} => self.javelin(knight_id, target_unit_id),
2223 Delta::LaunchRocket {rocket_id, location} => self.launch_rocket(rocket_id, location),
2224 Delta::Load {structure_id, robot_id} => self.load(structure_id, robot_id),
2225 Delta::Move {robot_id, direction} => self.move_robot(robot_id, direction),
2226 Delta::Overcharge {healer_id, target_robot_id} => self.overcharge(healer_id, target_robot_id),
2227 Delta::ProduceRobot {factory_id, robot_type} => self.produce_robot(factory_id, robot_type),
2228 Delta::QueueResearch {branch} => { self.queue_research(branch); Ok(()) },
2229 Delta::Repair {worker_id, structure_id} => self.repair(worker_id, structure_id),
2230 Delta::Replicate {worker_id, direction} => self.replicate(worker_id, direction),
2231 Delta::ResetResearchQueue => { self.reset_research(); Ok(()) },
2232 Delta::Unload {structure_id, direction} => self.unload(structure_id, direction),
2233 Delta::WriteTeamArray {index, value} => self.write_team_array(index, value),
2234 Delta::Nothing => Ok(()),
2235 }
2236 }
2237
2238 /// Applies a turn message to this GameWorld, and ends the current turn.
2239 /// Returns the message to send to the next player.

Callers 15

apply_turnMethod · 0.80
write_team_arrayMethod · 0.80
disintegrate_unitMethod · 0.80
move_robotMethod · 0.80
attackMethod · 0.80
harvestMethod · 0.80
blueprintMethod · 0.80
buildMethod · 0.80
repairMethod · 0.80
replicateMethod · 0.80
javelinMethod · 0.80
begin_snipeMethod · 0.80

Calls 15

attackMethod · 0.45
begin_snipeMethod · 0.45
blueprintMethod · 0.45
blinkMethod · 0.45
buildMethod · 0.45
disintegrate_unitMethod · 0.45
harvestMethod · 0.45
healMethod · 0.45
javelinMethod · 0.45
launch_rocketMethod · 0.45
loadMethod · 0.45
move_robotMethod · 0.45

Tested by

no test coverage detected