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

Method destroyTile

micropolis-java/src/micropolisj/engine/Sprite.java:176–204  ·  view source on GitHub ↗

Destroys whatever is at the specified location, replacing it with fire, rubble, or water as appropriate.

(int xpos, int ypos)

Source from the content-addressed store, hash-verified

174 * replacing it with fire, rubble, or water as appropriate.
175 */
176 final void destroyTile(int xpos, int ypos)
177 {
178 if (!city.testBounds(xpos, ypos))
179 return;
180
181 int t = city.getTile(xpos, ypos);
182
183 if (t >= TREEBASE) {
184 if (isBridge(t)) {
185 city.setTile(xpos, ypos, RIVER);
186 return;
187 }
188 if (!isCombustible(t)) {
189 return; //cannot destroy it
190 }
191 if (isZoneCenter(t)) {
192 city.killZone(xpos, ypos, t);
193 if (t > RZB) {
194 city.makeExplosion(xpos, ypos);
195 }
196 }
197 if (checkWet(t)) {
198 city.setTile(xpos, ypos, RIVER);
199 }
200 else {
201 city.setTile(xpos, ypos, TINYEXP);
202 }
203 }
204 }
205
206 /**
207 * Helper function for rotating a sprite.

Callers 3

moveImplMethod · 0.80
moveImplMethod · 0.80
moveImplMethod · 0.80

Calls 9

isBridgeMethod · 0.80
isCombustibleMethod · 0.80
isZoneCenterMethod · 0.80
killZoneMethod · 0.80
getTileMethod · 0.65
setTileMethod · 0.65
testBoundsMethod · 0.45
makeExplosionMethod · 0.45
checkWetMethod · 0.45

Tested by

no test coverage detected