cleanup: move tile value comparisons into TileConstants class
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@688 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
f5e1793592
commit
873caa361b
2 changed files with 38 additions and 4 deletions
|
@ -428,30 +428,31 @@ class MapScanner
|
||||||
city.unpoweredZoneCount++;
|
city.unpoweredZoneCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cchr9 > PORTBASE)
|
if (isSpecialZone(cchr))
|
||||||
{
|
{
|
||||||
doSpecialZone(zonePwrFlag);
|
doSpecialZone(zonePwrFlag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cchr9 < HOSPITAL)
|
if (isResidentialZone(cchr))
|
||||||
{
|
{
|
||||||
doResidential(zonePwrFlag);
|
doResidential(zonePwrFlag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cchr9 < COMBASE)
|
if (isHospitalOrChurch(cchr))
|
||||||
{
|
{
|
||||||
doHospitalChurch(zonePwrFlag);
|
doHospitalChurch(zonePwrFlag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cchr9 < INDBASE)
|
if (isCommercialZone(cchr))
|
||||||
{
|
{
|
||||||
doCommercial(zonePwrFlag);
|
doCommercial(zonePwrFlag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert isIndustrialZone(cchr);
|
||||||
doIndustrial(zonePwrFlag);
|
doIndustrial(zonePwrFlag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,6 +428,39 @@ public class TileConstants
|
||||||
return (tmp >= RAILBASE && tmp < RESBASE);
|
return (tmp >= RAILBASE && tmp < RESBASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCommercialZone(int tile)
|
||||||
|
{
|
||||||
|
assert isZoneCenter(tile);
|
||||||
|
return (tile & LOMASK) >= COMBASE &&
|
||||||
|
(tile & LOMASK) < INDBASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isHospitalOrChurch(int tile)
|
||||||
|
{
|
||||||
|
assert isZoneCenter(tile);
|
||||||
|
return (tile & LOMASK) >= HOSPITAL &&
|
||||||
|
(tile & LOMASK) < COMBASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isIndustrialZone(int tile)
|
||||||
|
{
|
||||||
|
assert isZoneCenter(tile);
|
||||||
|
return (tile & LOMASK) >= INDBASE &&
|
||||||
|
(tile & LOMASK) < PORTBASE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isResidentialZone(int tile)
|
||||||
|
{
|
||||||
|
assert isZoneCenter(tile);
|
||||||
|
return (tile & LOMASK) < HOSPITAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSpecialZone(int tile)
|
||||||
|
{
|
||||||
|
assert isZoneCenter(tile);
|
||||||
|
return (tile & LOMASK) >= PORTBASE;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isZoneCenter(int tile)
|
public static boolean isZoneCenter(int tile)
|
||||||
{
|
{
|
||||||
return tile >= 0 && (tile & ZONEBIT) != 0;
|
return tile >= 0 && (tile & ZONEBIT) != 0;
|
||||||
|
|
Reference in a new issue