MCPcopy Create free account
hub / github.com/SimHacker/micropolis / BuildingTool

Class BuildingTool

micropolis-java/src/micropolisj/engine/BuildingTool.java:13–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11import static micropolisj.engine.TileConstants.*;
12
13class BuildingTool extends ToolStroke
14{
15 public BuildingTool(Micropolis engine, MicropolisTool tool, int xpos, int ypos)
16 {
17 super(engine, tool, xpos, ypos);
18 }
19
20 @Override
21 public void dragTo(int xdest, int ydest)
22 {
23 this.xpos = xdest;
24 this.ypos = ydest;
25 this.xdest = xdest;
26 this.ydest = ydest;
27 }
28
29 @Override
30 boolean apply1(ToolEffectIfc eff)
31 {
32 switch (tool)
33 {
34 case FIRE:
35 return applyZone(eff, FIRESTATION);
36
37 case POLICE:
38 return applyZone(eff, POLICESTATION);
39
40 case POWERPLANT:
41 return applyZone(eff, POWERPLANT);
42
43 case STADIUM:
44 return applyZone(eff, STADIUM);
45
46 case SEAPORT:
47 return applyZone(eff, PORT);
48
49 case NUCLEAR:
50 return applyZone(eff, NUCLEAR);
51
52 case AIRPORT:
53 return applyZone(eff, AIRPORT);
54
55 default:
56 // not expected
57 throw new Error("unexpected tool: "+tool);
58 }
59 }
60}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected