doSpecialZone: use annotations to control which special zone processing is done

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@836 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-09-03 01:07:35 +00:00
parent 18f00153a3
commit db6f3fb59c
2 changed files with 39 additions and 56 deletions

View file

@ -717,7 +717,7 @@
695 seaport@32,0 (conducts)
696 seaport@48,0 (conducts)
697 seaport@0,16 (conducts)
698 seaport@16,16 (zone)(conducts)(building=4x4)(behavior=SPECIAL)(description=#13)
698 seaport@16,16 (zone)(conducts)(building=4x4)(behavior=SEAPORT)(description=#13)
699 seaport@32,16 (conducts)
700 seaport@48,16 (conducts)
701 seaport@0,32 (conducts)
@ -736,7 +736,7 @@
713 airport@64,0 (conducts)
714 airport@80,0 (conducts)
715 airport@0,16 (conducts)
716 airport@16,16 (zone)(conducts)(building=6x6)(behavior=SPECIAL)(description=#14)
716 airport@16,16 (zone)(conducts)(building=6x6)(behavior=AIRPORT)(description=#14)
717 airport@32,16 (conducts)
718 airport@48,16 (conducts)
719 airport@64,16 (conducts)
@ -771,7 +771,7 @@
747 coal@32,0 (conducts) (onpower=916)
748 coal@48,0 (conducts) (onpower=920)
749 coal@0,16 (conducts)
750 coal@16,16 (zone)(conducts)(building=4x4)(behavior=SPECIAL)(description=#15)
750 coal@16,16 (zone)(conducts)(building=4x4)(behavior=COAL)(description=#15)
751 coal@32,16 (conducts) (onpower=924)
752 coal@48,16 (conducts) (onpower=928)
753 coal@0,32 (conducts)
@ -787,7 +787,7 @@
762 firestation@16,0 (conducts)
763 firestation@32,0 (conducts)
764 firestation@0,16 (conducts)
765 firestation@16,16 (zone)(conducts)(building=3x3)(behavior=SPECIAL)(description=#16)
765 firestation@16,16 (zone)(conducts)(building=3x3)(behavior=FIRESTATION)(description=#16)
766 firestation@32,16 (conducts)
767 firestation@0,32 (conducts)
768 firestation@16,32 (conducts)
@ -797,7 +797,7 @@
771 police@16,0 (conducts)
772 police@32,0 (conducts)
773 police@0,16 (conducts)
774 police@16,16 (zone)(conducts)(building=3x3)(behavior=SPECIAL)(description=#17)
774 police@16,16 (zone)(conducts)(building=3x3)(behavior=POLICESTATION)(description=#17)
775 police@32,16 (conducts)
776 police@0,32 (conducts)
777 police@16,32 (conducts)
@ -808,7 +808,7 @@
781 stadium@32,0 (conducts)
782 stadium@48,0 (conducts)
783 stadium@0,16 (conducts)
784 stadium@16,16 (zone)(conducts)(building=4x4)(behavior=SPECIAL)(description=#18)
784 stadium@16,16 (zone)(conducts)(building=4x4)(behavior=STADIUM_EMPTY)(description=#18)
785 stadium@32,16 (conducts)
786 stadium@48,16 (conducts)
787 stadium@0,32 (conducts)
@ -825,7 +825,7 @@
797 stadium2@32,0 (conducts)
798 stadium2@48,0 (conducts)
799 stadium2@0,16 (conducts)
800 stadium2@16,16 (zone)(conducts)(building=4x4)(behavior=SPECIAL)(description=#18)
800 stadium2@16,16 (zone)(conducts)(building=4x4)(behavior=STADIUM_FULL)(description=#18)
801 stadium2@32,16 (conducts)
802 stadium2@48,16 (conducts)
803 stadium2@0,32 (conducts)
@ -842,7 +842,7 @@
813 nuclear@32,0 (conducts)
814 nuclear@48,0 (conducts)
815 nuclear@0,16 (conducts)
816 nuclear@16,16 (zone)(conducts)(building=4x4)(behavior=SPECIAL)(description=#19)
816 nuclear@16,16 (zone)(conducts)(building=4x4)(behavior=NUCLEAR)(description=#19)
817 nuclear@32,16 (conducts)
818 nuclear@48,16 (conducts)
819 nuclear@0,32 (conducts)

View file

@ -45,7 +45,14 @@ class MapScanner
HOSPITAL_CHURCH,
COMMERCIAL,
INDUSTRIAL,
SPECIAL;
COAL,
NUCLEAR,
FIRESTATION,
POLICESTATION,
STADIUM_EMPTY,
STADIUM_FULL,
AIRPORT,
SEAPORT;
}
/**
@ -92,8 +99,29 @@ class MapScanner
case INDUSTRIAL:
doIndustrial();
return;
case SPECIAL:
doSpecialZone();
case COAL:
doCoalPower();
return;
case NUCLEAR:
doNuclearPower();
return;
case FIRESTATION:
doFireStation();
return;
case POLICESTATION:
doPoliceStation();
return;
case STADIUM_EMPTY:
doStadiumEmpty();
return;
case STADIUM_FULL:
doStadiumFull();
return;
case AIRPORT:
doAirport();
return;
case SEAPORT:
doSeaport();
return;
default:
throw new Error("Unknown behavior: "+behaviorStr);
@ -639,51 +667,6 @@ class MapScanner
}
}
/**
* Called when the current tile is the key tile of a "special" zone.
*/
void doSpecialZone()
{
switch (cchr9)
{
case POWERPLANT:
doCoalPower();
return;
case NUCLEAR:
doNuclearPower();
return;
case FIRESTATION:
doFireStation();
return;
case POLICESTATION:
doPoliceStation();
return;
case STADIUM:
doStadiumEmpty();
return;
case FULLSTADIUM:
doStadiumFull();
return;
case AIRPORT:
doAirport();
return;
case PORT:
doSeaport();
return;
default:
// should not happen
assert false;
}
}
/**
* Place hospital or church if needed.
*/