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

Method startFireInZone

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:1759–1792  ·  view source on GitHub ↗

* Start a fire in a zone. * @param Xloc X coordinate in map coordinate. * @param Yloc Y coordinate in map coordinate. * @param ch Map character at (\a Xloc, \a Yloc). */

Source from the content-addressed store, hash-verified

1757 * @param ch Map character at (\a Xloc, \a Yloc).
1758 */
1759void Micropolis::startFireInZone(int Xloc, int Yloc, int ch)
1760{
1761 short Xtem, Ytem;
1762 short x, y, XYmax;
1763
1764 int value = rateOfGrowthMap.worldGet(Xloc, Yloc);
1765 value = clamp(value - 20, -200, 200);
1766 rateOfGrowthMap.worldSet(Xloc, Yloc, value);
1767
1768 ch &= LOMASK;
1769
1770 if (ch < PORTBASE) {
1771 XYmax = 2;
1772 } else {
1773 if (ch == AIRPORT) {
1774 XYmax = 5;
1775 } else {
1776 XYmax = 4;
1777 }
1778 }
1779
1780 for (x = -1; x < XYmax; x++) {
1781 for (y = -1; y < XYmax; y++) {
1782
1783 Xtem = Xloc + x;
1784 Ytem = Yloc + y;
1785
1786 if (testBounds(Xtem, Ytem) && (map[Xtem][Ytem] & LOMASK) >= ROADBASE) {
1787 map[Xtem][Ytem] |= BULLBIT;
1788 }
1789
1790 }
1791 }
1792}
1793
1794
1795/**

Callers

nothing calls this directly

Calls 4

clampFunction · 0.85
testBoundsFunction · 0.85
worldGetMethod · 0.80
worldSetMethod · 0.80

Tested by

no test coverage detected