[comp.sources.games] v04i044: conquer3 - middle earth multi-player game

games@tekred.TEK.COM (06/17/88)

Submitted by: ihnp4!homxc!smile
Comp.sources.games: Volume 4, Issue 44
Archive-name: conquer3/Part03



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 8)."
# Contents:  FILESIZES help.txt misc.c
# Wrapped by billr@saab on Thu Jun 16 09:39:57 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f FILESIZES -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"FILESIZES\"
else
echo shar: Extracting \"FILESIZES\" \(917 characters\)
sed "s/^X//" >FILESIZES <<'END_OF_FILESIZES'
X lines   words chars   FILENAME
X     58    538   2960 nations
X    211    966   6885 Makefile
X    550   4266  26815 help.txt
X    337   2438  15481 README
X     74    259   1789 run
X    193    849   4886 man.page
X    132    988   6342 header.h
X    452   1655  13697 data.h
X     67    326   1745 newlogin.h
X    822   2105  24900 combat.c
X    202    518   5059 cexecute.c
X    290    715   6460 io.c
X    175    644   4919 admin.c
X    852   2170  22776 makeworld.c
X    996   2446  28406 newlogin.c
X    797   1968  21402 update.c
X    847   1689  20241 magic.c
X   1059   2439  28401 npc.c
X   1120   3662  26322 misc.c
X    781   2509  22037 randevent.c
X    218    917   5939 data.c
X   1027   2227  23192 commands.c
X    558   1196  14869 forms.c
X    846   1906  19741 main.c
X    622   1261  15082 move.c
X    519   1206  13951 reports.c
X    357    762   9939 display.c
X    197    485   3954 extcmds.c
X  14359  43110 398190 total
END_OF_FILESIZES
if test 917 -ne `wc -c <FILESIZES`; then
    echo shar: \"FILESIZES\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f help.txt -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"help.txt\"
else
echo shar: Extracting \"help.txt\" \(26815 characters\)
sed "s/^X//" >help.txt <<'END_OF_help.txt'
X	               CONQUER COMMAND HELP SCREEN
X
X    MOVEMENT                 COMMANDS                    ADMINISTRATION
X'h': move west           'a': army report            'p': pick item
X'y': move north-west     'r': redesignate            'd': change display
X'k': move north          'ctrl-L': redraw screen     'c': administration
X'u': move north-east     'm': move selected unit     '?': help screen
X'l': move east           'A': adjust army            's': score
X'n': move south-east     'f': fleet report           'B': budget status
X'j': move south          'Z': move people 2 Sectors  'P': production stats
X'b': move south west     'S': diplomacy status       'N': read newspaper
X'J': scroll south        'Q': quit (saves changes)   'W': write message
X'K': scroll north        'M': magic                  'R': read messages
X'L': scroll east         'C': construct
X'H': scroll west         'D': draft              'ESC [1-5]': chg status
X	                 'G': go to next army    'ESC +': combine 2 armies
X	                 'F': go to next fleet   'ESC -': split army
X	                 'g': group army report  'ESC /': split army in 2
XEND
X                    Welcome to Conquer XVERSION
X
XCONQUER is a multi player computer game designed to run under the UNIX
Xoperating system.  In CONQUER,  each player is the leader of a nation,
Xcomposed of people (humans, orcs, elves, dwarves), resources, and land.
XRulers customize their nation at creation by chosing their race and by giving
Xtheir nation special powers (magic, combat factor, location, speed...)
Xand resources (civilians, troops, iron, gold...).  Play involves building,
Xmoving, and controlling armies and navies, diplomacy with other players,
Xand adjusting economic activity, which is primarily geared to the production
Xof gold for your treasury.  Iron is needed, however to build ships & armies,
Xand food is needed to prevent revolts and keep people alive.
X
XCommand line format: conquer [-maxhps -nNAT -dDIR]
X	-h       print this help text 		-n NTN   run as nation NTN
X	-d DIR   run on data in directory DIR	-s       print out scores
XCommand line format: admin [-maxdp]
X	-a       add new player		-m       make a world
X	-p       print a map		-x       execute program
X	-d DIR   run on data in directory DIR
XIt is suggested that each player set up a shell alias for their game & nation
XEND
X	                         THE WORLD
X
XThe Conquer world is very bloody, and a player needs skills at war gaming,
Xdiplomacy, and building an economy to succeed.  Rival races are constantly
Xat war, and the world starts filled with player nations, random peoples
X(lizard men in their cities of gold, barbarians, nomads, pirates, brigands),
Xand both hostile and friendly computer controlled non player countries.
XConquer can be played solitaire.  The computer uses an highly intelligent
Xmovement algorithm to run the armies and navies of these non player
Xcountries (NPC), and has intelligent algorithms built in that control these
Xnations diplomacy, construction, and economies.  You can find NPCs allied with
Xyou against a common enemy,  but can also suddenly be stabbed in the
Xback and find hostile NPC armies at your doorstep.
XEND
X	                   CURSOR MOVEMENT
X
X	                       NORTH
X
X	                        (K)
X	                  y,7   k,8   u,9
X	                     \   |   /
X	                       \ | /
X	  WEST      (H) h,4 ---- 0 ---- l,6 (L)       EAST
X	                       / | \
X	                     /   |   \
X	                  b,1   j,2   n,3
X	                        (J)
X
X	                       SOUTH
X
X	       Figures in parenthesis indicate scrolling
X	    Note the numeric keypad OR vi keys can be used
X
X		<cntrl>-L will redraw the screen
XEND
X	              WHAT IS WHAT IN THE WORLD
X
XThe world is composed of a 2 dimensional map of sectors, created by the
Xcomputer at the beginning of the game.  Each sector has about 10 unique
Xcharacteristics (altitude, gold, vegetation...).
X
XSECTOR ELEVATIONS include:
X	ZMOUNTAIN	ZHILL	ZCLEAR
X	ZWATER	ZPEAK
XSECTOR VEGETATION
XUninhabitable Areas (do not produce food and people simply do not like)
X	ZVOLCANO	ZDESERT	ZJUNGLE
X	ZTUNDRA	ZICE		ZSWAMP
XInhabitable (people like, number is relative value of food production)
X	ZGOOD...9	ZFOREST...3 (4 ELF)	ZLIGHT...6
X	ZWOOD...7 	ZBARREN...4 (3 ELF)
X
XCONQUER is designed so each race likes their appropriate terrain.  Elves like
Xwoods & forests,  Humans like good & light vegetation, and Orcs and Dwarves
Xlike hills and mountains.  You can only redesignate inhabitable sector types.
XEND
X	         	CONQUER COMMANDS -- lower case commands
X
X'a': army report:    Gives an army's details & permits changing army status,
X	              merging 2 armies, splitting armies, and disbanding armies
X'c': administration: Report on nation status and then change name, password,
X	              add to combat bonus, or (if god) destroy a nation.
X'd': change display: Change display mode.  Numbers in gold screens... are
X	              relative values of the materials.
X'f': fleet report:   Report on the status of your fleets.
X'g': group report:   As army report, but display will only show those armies
X	              in the current sector.
X'm': move unit:      move selected unit. The unit will stop when it runs out
X	              of move points or runs into an army larger than it.
X'p': pick item:      allows you to select the next army or navy in the
X	              sector.  Other commands will operate on that unit.
X'r': redesignate:    you can change habitable sectors you own to other
X	              designations.  Towns require 500+ people & Capitols
X	              require Towns.  God can redesignate anything.
X's': score:          print out a screen showing the scores
X'?': help screen:    print out this help text
XEND
X	         	CONQUER COMMANDS -- upper case commands pg. 1.
X
X'A': adjust army:  The quick way to adjust the status of your armies.
X'B': budget :      ESTIMATE your nations budget statistics
X'C': construct:    If you have cash, you can build fortifications and
X	            ships in your Towns.  Ships can only be built in Towns
X	            located on the water.
X'D': draft:        You may draft a quarter of the starting population from a
X		   sector if it was a Town, and if you have the gold & iron.
X'F': next fleet:   Move cursor to your next fleet
X'G': next army:    Move cursor to your next army
X'M': magic:        Prints your magic powers & offers you the option to
X	            purchase more (cost doubles each power). Monster Power
X	            gives you the chance to take over NPC nations.
XEND
X	         	CONQUER COMMANDS -- upper case commands pg. 2.
X
X'N': newspaper:    Briefs you on world happenings.  Note: News has 4 pages.
X'P': production:   ESTIMATE your nations production statistics
X'S': diplomacy:    Allow you to see and alter your diplomatic status.
X'Q': quit:         Save your move and quit the game.  Note there is no
X	            means supported to quit without saving your moves.
X'R': read mail:    Read mail messages
X'W': write mail:   Write mail messages
X'Z': move people:  Civilians can move between two of your sectors at a cost
X	            of 50 per civilian.  Civilians naturally move in the update.
XEND
X	                      RACES OF THE WORLD
X
XORC       'O'   Poor at combat but they reproduce like mad (they can go over
X	         10% reproduction ceiling). Orcs are lousy fighters and are
X	         led by minor monsters (they start with MINOR MONSTER power).
XELF       'E'   Great at defense and quick, but few in numbers.  They start
X	         with VOID power, which is perhaps the most potent power in the
X	         game, but which costs them an extra distribution point.
XDWARF     'D'   Dwarves are good at combat, but slow and few in numbers.  They
X	         start with MINER power, which allows them to quickly mine
X	         iron/jewels, and thus build up their combat skills and powers.
XHUMAN     'H'   Humans start average at everything -- with reasonable numbers,
X	         of people, and WARRIOR power, which gives them +10% in combat.
X	         They have OK reproduction and good movement.
XLIZARD    'L'   (NPC only)  An ancient race bound to their cities of gold
XPIRATE    'P'   (NPC only)  Wandering pirates/brigands intent on plunder
XNOMAD     'N'   (NPC only)  Will the wandering nomads tribes leave you alone?
XBARBARIAN 'B'   (NPC only)  Indigenous natives
XEND
X	                 POSSIBLE SECTOR DESIGNATIONS
X
XZMINE   Produces 100*Iron*People Talons + Produces Iron Ores
XZFARM   Produces 100*Vegetation*People Talons + Produces Food
XZGOLD   Produces 100*Gold*People Talons + Produces Jewels
XZCASTLE   Fortified Cities of the Lizards (only)
XZDEVASTATED   devastated sector
XZTOWN   Towns and Capitols are the bases of your power and are
XZCAPITOL   the only places you can draft soldiers or construct ships.
X	Drafting only works if the sectors population is greater than your
X	total civilians divided by the quantity 16+(number of sectors)/2.
X	Towns give 750 talons per person and Capitols give 1000 talons per
X	person.  Towns and Capitols cost more to redesignate.  To capture a
X	Town or Capitol, you must be the only occupant when the world is
X	updated.
X
XThe minimum permissible vegetation to redesignate a sector is XDESFOOD.
XEND
X	                   	IRON, FOOD, AND GOLD
X
XFOOD:      You MUST have enough food to feed your people... One civilian eats
X	 one unit of food, and one soldier eats two units.  If you run out of
X	 food, half the difference of people in Towns die.  Your Granary
X	 will store 3x your civilian population in food.  The remainder
X	 is converted to gold talons at a rate of 1 per food point.
XIRON:      You need to have iron to draft new military, as per the unit types
X	section.  One person produces one iron per point of mineral in
X	 the sector per turn.  An amount of Iron (based on the number of troops
X	 you have) can be used to buy +1% in your nations attack or defense.
XJEWELS:    You can have a maximum of 10 talons debt for every jewel
X	 point that you mined.  After that point, you undergo a TAX REVOLT,
X	 which has not yet been implemented. Thus gold can be negative to
X	 a certain level.  Jewels are also used in magic, and 100000 Jewels
X	 will buy you one random new power (command M) (it doubles for each
X	 power though).  You can have 10 talons in the treasury for each jewel
X	 (gold based economy).  After that, your gold talons will be converted
X	 to jewels at a 10:1 ratio.
XEND
X				UNIT TYPES
X
X		costs		combat				power
X		enlist maintain	attack defend move	iron	prerequisites
X
XMILITIA		$40	$10    -25	-25	0	0
XGOBLIN		$70	$20    -15	-15    x1	80    MI_MONST
XORC		$90	$40	+0	 +0    x1	80    MI_MONST
XINFANTRY	$90	$40	+0	 +0    x1	100
XSAILOR		$90	$40	+0	 +0	0	100
XMARINES		$90	$40    +25	+25     0	100   SAILOR
XARCHER		$90	$40	+0	+10    x1	100   ARCHER
XURUK-HAI	$120	$40	+5	 +5    x1	150   AV_MONST
XNINJA		$130	$80    +20	 +0    x1	150   NINJA
XPHALANX		$150	$60    +10	+10    x1	150   CAPTAIN
XOLOG-HAI  	$200	$80    +15	+15    x1	150   BREEDER+AV_MONST
XLEGION		$200	$80    +20	+20    x1	150   WARLORD
XDRAGOON		$250   $100    +10	+10    x2	100   CAVALRY
XMERCENARY  	$300   $100    +20	+15    x1	0
XTROLL		$300   $120    +25	+15    x1	200   MA_MONST
XEND
X			UNIT TYPES - CONTINUED
X
X		costs		combat				power
X		enlist maintain	attack defend move	iron	prerequisites
X
XELITE		$300   $120    +20	+20  x1.3	200   STEEL
XLT_CAVALRY 	$400   $200    +10	+10  x1.5	100   CAVALRY
XCAVALRY		$600   $250    +30	+30    x2	300   CAVALRY
XCATAPULT	$750   $300    -20	-20   x.5	1000
XSIEGE		$750   $300    -20	-20   x.5	1000
XROC		$700   $350    +20	+30    x1	300   AVIAN
XKNIGHT		$1000  $400    +50	+50    x2	600   ARMOR & CAVALRY
XGRIFFON		$1200  $500    +40	+50  x1.5	400   AVIAN
XELEPHANT	$1000  $400    +50	+50   x.5	600   DERVISH
XEND
X			ADDITIONAL ADVANTAGES TO UNITS
X
XDragoons are cavalry that fight on foot as regular infantry (treat as inf)
XArchers gain an additional +15%*(percent of cavalry/knight opponents)
XArchers gain +15% defending & +5% attacking forts (no bonus vs cavalry also)
XMercenaries don't deplete population when hired, but you can only have 1/2
X   your normal troops in mercenaries. They cost their enlist cost to disband.
XSeige_engines add +1%/20 men *TO WHOLE COMBAT* attacking fortress (max +30%)
XCatapults add +1%/40 men *TO WHOLE COMBAT* in normal combat (max +10%).
XCatapults add +1%/20 men *TO WHOLE COMBAT* when defending castle (max +10%).
XCatapults have a % chance of damaging a fortress when attacking it
XCavalry and Knights get -20% attacking or defending fortress.
XKnights are heavy cavalry
XPhalanx are infantry that get combat bonus *only* if in 500+ men units
XLegionaires are infantry that get combat bonus *only* if in 1000+ men units
XRoc and Griffon Troops fly and can ignore zones of control.
XNinja act as scouts in that they are not effected by zones of control
XMarines are the only units that can land by ship in unowned sectors
XEND
X	                   SCORING & CHARACTER CLASSES
XEach nation has a types (classe), which is choosen when it it is created, and
Xwhich determines how Victory points are received.  Some classes start with
Xpowers and have a starting cost. Warlord/Monster powers get all the prerequisite
Xpowers, and thus starting cost can varies.
X
X         Per   1000   1000  100K  100K  100K Magic  10  Start
X       Sector People Troops Gold Jewels Iron Power Ship Cost  Races Powers
Xking     1      1       2     3    0     0     0     0   0    HDE   None
Xempire   1.5    0       0     0    0     0     0     0   0    HDE   None
Xwizard   0      2       1     0    3     5    20     0   2    HDE   SUMMON
Xpriest   1      1       0     0    3     0     7     0   2    H     HEALER
Xpirate   0      0       5     0   10    10     1     5   1    HO    SAILOR
Xtrader   1      1       0     0    1     1     1     8   2    ED    URBAN
Xwarlord  1      1       2     0    1     1     1     0   *    HO    WARLORD
Xdemon    1      0       1     0    1     0    10     0   2    O     DESTROYER
Xdragon   0      0       0    10   20     0     0     0   2    O     MA_MONST
Xshadow   1      0       0     0    0     5     0     0   1    O     VOID
XNPC      1      1       0     0    1     1     1     0   0    HDEO  None
XEND
X				VIEWING THE WORLD
X
XWhen you log in, you will notice that you can only see a part of the
Xworld.  You must discover the world by getting certain magical powers,
Xby taking land, or by moving armies and navies.  The use of SCOUT armies
Xis intended for this purpose.
X
XThe 'd' command allows you to change what you see on the map.  You can
Xalter the information in the sector and can  change the type of sectors that
Xare highlighted as follows:
X
Xinformation:  (d)esignation, (r)ace, (m)ove cost, (p)eople, (D)efense
X        (f)ood, (c)ontour, (v)egetation, (i)ron, (n)ation mark, (j)old
X
Xhighlight options:
X	(o)wner (a)rmy (y)our Army (x)=none (M)ove left
X
XI have tried to make the use of these options clear and self explainatory.
XEND
X	                 POSSIBLE ARMY STATUS
X
XMARCH    :Marching doubles army movement at the expense of combat strength.
XSCOUT    :Scouts avoid any enemy, if possible, and can move through hostile
X	 :   armies, but must have less than 25 men per army and can not take
X	 :   even unowned land.  They are useful to check out the  map and
X	 :   to determine the enemy combat strength.  You must draft scouts
X	 :   as you can not split scouts from an army.
XATTACK   :Armies in this mode can take owned sectors, initiate
X	 :   combat, and have they reasonable movement rates.
XDEFEND   :In this mode, can take owned sectors and have good defense
X	 :   and movement, but can not initiate combat.
XGARRISON :This mode offers the strongest defense but is used only in Towns,
X	 :   Capitol, and castles.  Garrisons may not move.
X
XNote: It takes the greater of 75 and total soldiers/150 men to take a sector.
XYour attack bonus increases by 5% if you take over a non player country.
XEND
X			SHIPS AND SHIP COSTS
X
X		crew	build cost	maintain cost	capacity
XWarship		50	XWARSHPCOST		XSHIPMAINT		0
XMerchant	50	XMERSHPCOST		XSHIPMAINT		XSHIPCP
X
XShips will now have crews - which, in addition to being drafted upon
Xconstruction, represent the ships current level of damage and are replaced,
Xin harbor, by using the construct ships command.  Movement of
Xa fleet is reduced if the crews are not full.  Marine or Sailor Armies
Xcan also be carried by navies with warships.  Each fleet may carry one army
Xin addition to any troops that are ferried - who dont count in combat.
XMarines add to chances of success in shipboard combat.
X
XShips permit rapid relocation of armies & civilians to strategic points.  Their
Xmovement is 3x your nations maximum movement, and they only pay 1 move point 
Xper sector (coast lands), 4 in deep water, 4 in your harbor, and the min of
X10 and all their remaining points points for non harbor coastlands.  Naval 
Xcombat has not been adequately play tested, and Sailor units dont work.
XEND
X	                         MAGIC POWERS
XMagic powers differentiate your nation from all the other nations in the
Xworld.  There are three types of powers - truely MAGICAL powers, which
Xusually involve summoning or spell use, CIVILIAN powers, which are related
Xto civilization and trade, and MILITARY powers, which measure your ability
Xto make war.  All nations start with at least one power (based on race or
Xclass) and can purchase additional powers by expending jewels.  The formula
Xfor this is to take two to the power of the sum of the number of powers you
Xhave from that type and half the number of other powers times your base value:
X
Xjewel cost for civilian power = Base * 2**( #mgk/2 + #civ + #mil/2 )
X
X				type of power desired
Xrace			magical		civilian	military
X	elves -		50K		50K		50K
X	dwarves -	80K		40K		40K
X	humans -	100K		25K		50K
X	orcs -		100K		50K		25K
X
Xfor example a human with 1 of each power wanting a magic power would pay
X		50* 2**(1+1/2+1/2)=200K jewels
XEND
X			COMBAT TYPE POWERS
X
XWARRIOR 	+10% in combat, 1/2 Enlistment cost
XCAPTAIN 	+10% in combat, Can have Phalanx Units
XWARLORD 	+10% in combat, Can have Legionary Units
XARCHER 		Able to get ARCHER units.
XCAVALRY 	Able to get CAVALRY & DRAGOONS units.
XSAPPER 		Catapult/Siege Engines @ 1/2 price and 1/2 iron. 1/2 maint.
XARMOR 		With CAVALRY, can get knights; -3 Move (4 Min), +20 Defense
XAVIAN 		Use roc and griffon units.
XMONSTER POWERS	If the Orc Takeover option is implemented, then
X		All monsters have a chance to takeover ORC NPCs for jewels.
XMINOR MONST 	Army 0 fights at +20%. Can have ORC units. (ORCS ONLY)
XAVERAGE MONST 	Army 0 fights at +20% (above MI_MONST) Can have
X		Uruk Hai Units. (ORCS ONLY)
XMAJOR MONST 	Army 0 fights at +20% per level (above MI_MONST)
X		Can have Troll Units. (ORCS ONLY)
XEND
X			CIVILIAN TYPE POWERS
X
XDERVISH	   Desert/ICE sectors => 1 move point, vegetation 6, +30% combat in
X		XDERVDESG redesignate desert/ice sectors.
XHIDDEN	   Nobody can count troops in your armies on map.
XARCHITECT  Double strength forts, Double Town revenue.
XHEALER	   +2 repro to 10% limit.  excess repro adds to defense. (Not ORCS).
XMINER	   (DWARVES) 2x iron and jewel production
XURBAN 	   +3% Birth Rate to 12% limit.  remainder gives + to move (roads)
XBREEDER    +3% Birth Rate (ORCS ONLY) (to 13% limit). -10% combat. (no urban)
X		BREEDER and URBAN powers are mutually exclusive.
XSTEEL	   Additional 2x Iron Production for MINERS.
XNINJA 	   Can have Ninja units.  Spys show enemy troop/civilian strength
X		exactly (even voids)
XSAILOR 	   1/2 price naval units.  Can use marines. +10% ramming.
XDEMOCRACY  +10% in combat (moralle) +1 Move +1 repro All units eat double.
XROADS 	   +4 to move if unit starts in your nation.
XSLAVER     you gain 25% of the populace of *any* sector you take over
XEND
X			MAGICAL TYPE POWERS
X
XTHE_VOID   Nobody can see your sectors/armies (appear blank)
XKNOWALL	   Know all troop strengths and see the whole map (except voids)
XDESTROYER  Vegetation in 3 sectors of Capitol = Desert.  Act as Dervish.
XVAMPIRE	   35% of troops killed become yours, -35% in all combat, -2 Move,
X		1/4 cost for soldier maintenance, can't add to combat bonus
X		Vampire Power causes all nations to go to jihad with you.
XSUMMON 	   gives 4 spell pts per turn... can summon monsters with them
X		Can also do spell research.  100K Jewels and 1M gold gives
X		a 20% chance of gaining +1 spell point per turn
XWYZARD 	   Gives +3 spell points.  Must have SUMMON Power
XSORCERER   Gives +3 spell points.  Must have SUMMON Power
XEND
X			SUMMONED MONSTERS
X
XMonsters can be summoned via the magic menu if you have the SUMMON power.
XA monster unit represents one monster, but is the equivalent in combat of an
Xarmy of the given number of men.  When summoned, they appear in your Capitol,
Xand are yours to command until you disband them or can not afford to pay
Xtheir per/turn jewel cost *and* 5x that cost in gold.  Monsters may be
Xwounded in combat as can normal army units.  Wounded monsters have a percent
Xchance of dying based on the percent damage taken (a dragon (1000 men) taking
X200 equivalent men of damage has a 20% chance of dying).  Next turn, however
Xits strength will be fully restored (1000 men again).
X
XSpell points are accumulated by having the SUMMON/WYZARD/SORCERER power.
XSpell points can accumulate from turn to turn, but there is a 25% chance
Xthat half your unused spell points dissappear each turn... Gives you some
Xincentive to use them.
XEND
X			SUMMONED MONSTER TYPES
X
X	        spell	combat			jewels	power
X		points	bonus	move	men	turn	prerequisites
XSPIRIT		2	+0	x1	50	1000
XASSASSIN	2	+20	x1	50	400	NINJA
XDJINNI		2	+10	x1.5	50	400	DERVISH
XGARGOYLE	2	+10	x1	75	450	MI_MONST
XWRAITH		2	+10	x1	75	450	VAMPIRE
XHERO		2	+0	x1	100	200	WARRIOR
XCENTAUR		2	+10	x1.5	50	200
XGIANT		5	+0	x1	150	2100
XSUPERHERO  	5	+15	x1	150	450	WARLORD
XMUMMY		5	+15	x1	150	1050	VAMPIRE
XELEMENTAL  	5	+5	x1.5	175	1925	SORCERER
XMINOTAUR	5	+20	x1	150	2100	DESTROYER
XDEMON		10	+50	x1	500	6000	DESTROYER
XBALROG		10	+40	x1.5	500	6000	WIZARD & VAMPIRE
XDRAGON		15	+50	x2	1000	10000	MA_MONST & WIZARD
XEND
X	                    	NOTES ON COMBAT
X
XLosses per unit are inversely proportional to a units combat bonus.
X
XYou can expect to take several turns to reduce a large army, especially
X	 on a Town or Capitol.  NPC defenders will draft new troops each turn
X
XThe only method to take an occupied Town or Capitol is to be the the only
X	 army in the sector when the combat is *over*.
X
XTHE NEXT PAGE IS THE COMBAT RESULTS TABLE
X	 basically the attacker wants a high roll and the defender wants low.
XEND
X	        6-1 5-1 4-1 3-1 2-1 3-2 5-4 1-1 4-5 2-3 1-2 1-3 1-4 1-5 1-6
X    <--010     20% 40% 50% 60% 70% 80% 90% 100%100%100%110%120%120%130%130%
X   010-020     20% 30% 40% 50% 50% 60% 60% 90% 90% 90% 100%110%110%110%120%
X   020-030     20% 20% 30% 40% 40% 40% 50% 60% 80% 80% 100%110%100%110%110%
X   030-040     20% 20% 30% 30% 40% 40% 50% 60% 70% 80% 90% 100%100%100%110%
X   040-050     20% 20% 30% 30% 40% 40% 50% 60% 70% 70% 80% 90% 90% 100%110%
XD  050-060     15% 20% 20% 30% 40% 40% 40% 60% 70% 70% 80% 90% 90% 90% 100%
XI  060-070     10% 20% 20% 20% 30% 30% 40% 50% 60% 60% 80% 90% 90% 90% 100%
XE  070-080     10% 10% 20% 20% 30% 30% 30% 50% 60% 60% 80% 90% 90% 90% 90%
X   080-090     10% 10% 20% 20% 20% 30% 30% 40% 50% 50% 70% 80% 80% 80% 90%
XR  090-100     10% 10% 10% 20% 20% 30% 30% 40% 50% 50% 60% 80% 80% 80% 90%
XO  100-110      5% 10% 10% 10% 20% 20% 30% 40% 50% 50% 60% 70% 70% 70% 80%
XL  110-120      5%  5% 10% 10% 20% 20% 30% 40% 50% 50% 60% 70% 70% 70% 80%
XL  120-130      5%  5% 10% 10% 10% 20% 30% 30% 40% 40% 50% 70% 70% 70% 80%
X   130-140      5%  5%  5% 10% 10% 20% 30% 30% 40% 40% 50% 70% 70% 70% 70%
X   140-150      5%  0%  5%  5% 10% 20% 30% 30% 40% 40% 50% 60% 60% 60% 70%
X   150-160      0%  0%  5%  5% 10% 20% 30% 30% 40% 40% 50% 50% 50% 50% 50%
X   160-170      0%  0%  0%  5% 10% 20% 30% 20% 40% 40% 50% 50% 50% 50% 50%
X   170-180      0%  0%  0%  0%  5% 10% 20% 20% 30% 40% 40% 40% 40% 40% 40%
X   180-190      0%  0%  0%  0%  5% 10% 10% 20% 20% 30% 30% 30% 30% 40% 40%
X   190+++       0%  0%  0%  0%  5% 10% 10% 10% 20% 20% 30% 30% 30% 30% 40%
XEND
X	                 FINAL HINTS & OTHER COSTS
X
XIt is important to initially have a reprorate of 9-10% and a move of ~8-9.
XYou need about 1000 military to start - to take enough new land.
XTake as much land as possible in the beginning.
XMake sure your combat bonus stays respectable.
XDiplomacy with non player nations is important as it determines if you get 
X	attacked or not.  Bribing NPCs is a good way to get some breathing room.
X	You waste your money if you are at war with them that turn.
X
X				OTHER COSTS
X
X		Designation Costs:		$XDESCOST
X		Designation to Towns/Capitol:	20x$XDESCOST+$XDESCOST IRON
X		Fortification:			$XFORTCOST*(2**Fort Level)
X		Bribe Nation:			$XBRIBE/level
X		Move Civilians:			$50/civilian
XEND
X				OTHER NOTES
X
X   The computer can move for players if they dont enter a turn and the
XCMOVE variable is set before the program is compiled.  This works well... 
Xfor a time.  The Computer will NOT redesignate captured sectors for you.
X
XMercenaries must be paid a discharge fee equal to enlistcost when disbanded.
X
XIf you have too many people in a given non Town, non capitol sector, 
Xreproduction and production is halved for them.  If you have a huge 
X(>10,000,000) number of people in a sector, they will not reproduce.
XEND
X			OPTIONS OF YOUR VERSION
X
X	Maximum Number of Armies Per Nation....XMAXARM
X	Maximum Number of Navies Per Nation....XMAXNAVY
X	Absolute Maximum Number of Nations.....XMAXNTN
X	Percentage of Water in the World.......XPWATER
X	Starting Points to buy your nation.....XMAXPTS
X	Map Size is............................XMAPX by XMAPY
X	Percentage of land that is mountains...XPMOUNT
X	Storm Percentage.......................XPSTORM
X	Cost for Orc Npc Takeover..............XTAKEPRICE
X	Average Number of Random Events........XNORANDEVENTS
X	Chance of Volcano Eruption.............XPVULCAN
X
X	Lizards		XLZARD	  System V	XSYSV
X	Monsters	XMONSTER	  Npc Cheat	XCHEAT
X	Storms		XSTORMS	  Volcanos	XVULCANIZE
X	Npc Nations 	XNPC	  PC Automove	XCMOVE
X	Random Events	XRANEVENT	  Orc Takeovers	XORCTAKE
X	Super God	XOGOD
XEND
X	                ADDITIONAL OPTIONS
X
X	Land Vision Range is..................XLANDSEE
X	Navy Vision Range is..................XNAVYSEE
X	Army Vision Range is..................XARMYSEE
X
X	Taxation Rates:
X	Food tax per value point per person...XTAXFOOD
X	Jewel tax per jewel point per person..XTAXGOLD
X	Iron tax per iron point per person....XTAXIRON
X	Town tax per person...................XTAXCITY
X	Capitol tax per person................XTAXCAP
X
X	100% chance per XTOMUCHMINED iron mined of deplete iron mines.
X	100% chance per XTOMUCHMINED jewels mined of deplete gold mines.
X	XFINDPERCENT% chance that new materials are found in a sector.
X	Maximum Sector Population is XTOMANYPEOPLE.
X	Ships hold XSHIPHOLD men.
XEND
XDONE
END_OF_help.txt
if test 26815 -ne `wc -c <help.txt`; then
    echo shar: \"help.txt\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f misc.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"misc.c\"
else
echo shar: Extracting \"misc.c\" \(26322 characters\)
sed "s/^X//" >misc.c <<'END_OF_misc.c'
X/* Conquer: Copyright (c) 1988 by Edward M Barlow */
X#include	<ctype.h>
X#include	<stdio.h>
X#include	"header.h"
X#include	"data.h"
X
Xextern FILE *fnews;
X
Xextern char *HVegcost;
Xextern char *OVegcost;
Xextern char *EVegcost;
Xextern char *DVegcost;
Xextern char *HElecost;
Xextern char *OElecost;
Xextern char *EElecost;
Xextern char *DElecost;
X
X#ifdef SYSV
Xchar    *memset();
X#endif
X
X#ifdef CONQUER
Xint
Xmove_file( from, to )
Xregister char	*from;
Xregister char	*to;
X{
X	if( unlink( to ) < 0 ) {
X		fprintf( stderr, "unlink( %s ) failed \n", to );
X		sleep( 2 );
X		return( -1 );
X	}
X
X	if( link( from, to ) < 0 ) {
X		fprintf( stderr, "link( %s, %s ) failed \n", from, to );
X		sleep( 2 );
X		return( -1 );
X	}
X
X	if( unlink( from ) < 0 ) {
X		fprintf( stderr, "unlink( %s ) failed \n", from );
X		sleep( 2 );
X		return( -1 );
X	}
X
X	return( 0 );
X} /* move_file() */
X#endif CONQUER
X
Xint
Xmax( a, b )
Xregister int	a;
Xregister int	b;
X{
X	return( (a > b) ? a : b );
X}
X
Xint
Xmin( a, b )
Xregister int	a;
Xregister int	b;
X{
X	return( (a < b) ? a : b );
X}
X
Xvoid
Xverify_ntn( __file__, __line__ )
Xchar	__file__[];
Xint	__line__;
X{
X	register struct nation	*nptr;
X	register int		i;
X	register int		country;
X	struct army	*a;
X
X	for( country = 0; country < NTOTAL; country++ ) {
X		nptr = &ntn[country];
X
X		if( nptr->tiron < 0.0 ) {
X			fprintf( stderr, "file %s: line %d: nation[%d] iron = %ld\n",
X				__file__, __line__, country, nptr->tiron );
X			nptr->tiron = 0.0;
X		}
X
X		if( nptr->jewels < 0 ) {
X			fprintf( stderr, "file %s: line %d: nation[%d] jewels = %ld\n",
X				__file__, __line__, country, nptr->jewels );
X			nptr->jewels = 0.0;
X		}
X
X		for( i = 0; i < MAXARM; i++ ) {
X			a = &nptr->arm[i];
X			if( a->sold < 0 ) {
X				fprintf( stderr, "file %s: line %d: nation[%d] army[%d] sold = %d\n",
X					__file__, __line__, country, i, nptr->arm[i].sold );
X				nptr->arm[i].sold = 0;
X			}
X			if( a->xloc < 0 || a->xloc >= MAPX ) {
X				fprintf( stderr, "file %s: line %d: nation[%d] army[%d] xlocation = %d\n",
X					__file__, __line__, country, i, nptr->arm[i].xloc );
X				nptr->arm[i].xloc = 0;
X			}
X			if( a->yloc < 0 || a->yloc >= MAPY ) {
X				fprintf( stderr, "file %s: line %d: nation[%d] army[%d] ylocation = %d\n",
X					__file__, __line__, country, i, nptr->arm[i].yloc );
X				nptr->arm[i].yloc = 0;
X			}
X		} /* for */
X
X		for( i = 0; i < NTOTAL; i++ ) {
X			if( nptr->dstatus[i] > JIHAD ) {
X				fprintf( stderr, "file %s: line %d: nation[%d] diplomatic status with %d = %d\n",
X					__file__, __line__, country, i, nptr->dstatus[i] );
X				nptr->dstatus[i] = WAR;
X			}
X			if( nptr->dstatus[i] < UNMET ) {
X				fprintf( stderr, "file %s: line %d: nation[%d] diplomatic status with %d = %d\n",
X					__file__, __line__, country, i, nptr->dstatus[i] );
X				nptr->dstatus[i] = UNMET;
X			}
X		} /* for */
X	} /* for */
X} /* verify_ntn() */
X
Xvoid
Xverify_sct( __file__, __line__ )
Xchar	__file__[];
Xint	__line__;
X{
X	register struct s_sector	*sptr;
X	register int		x, y;
X
X	for( x = 0; x < MAPX; x++ ) {
X		for( y = 0; y < MAPX; y++ ) {
X			sptr = &sct[x][y];
X
X			if( sptr->people < 0 ) {
X				fprintf( stderr, "file %s: line %d: sct[%d][%d].people = %d\n", __file__, __line__, x, y, sptr->people );
X				if( sptr->people < -1*BIG )
X					sptr->people = BIG;
X				else sptr->people = 0;
X			}
X
X			if( sptr->owner != 0 && sptr->altitude == WATER ) {
X				fprintf( stderr, "file %s: line %d: sct[%d][%d].owner = %s (a water sector)\n",__file__,__line__, x, y, ntn[sptr->owner].name );
X				sptr->owner = 0;
X			}
X			if( sptr->fortress > 12 ){
X				fprintf( stderr, "file %s: line %d: sct[%d][%d].fortress = %d \n",__file__,__line__, x, y, sptr->fortress );
X				sptr->fortress = 12;
X			}
X		} /* for */
X	} /* for */
X} /* verify_sct() */
X
Xvoid
Xverifydata( __file__, __line__ )
Xchar	__file__[];
Xint	__line__;
X{
X	/* check for invalid values */
X	verify_ntn( __file__, __line__ );
X	verify_sct( __file__, __line__ );
X}/* verifydata() */
X
Xint
Xget_number()
X{
X	char ch;
X	int done=FALSE,count=0,xpos,ypos;
X	int sum=0;
X
X	/* this routine totally redone to allow deleting */
X	while(!done) {
X		ch=getch();
X		if (isdigit(ch) && count<12) {
X			/* only print numbers to the screen */
X			addch(ch);
X			refresh();
X			sum *= 10L;
X			count++;
X			sum += (long)(ch-'0');
X		}
X		else if ((ch=='\b' || ch=='\177')&&(count))
X		{
X			/* only delete what was printed */
X			getyx(stdscr,ypos,xpos);
X			move(ypos,--xpos);
X			addch(' ');
X			move(ypos,xpos);
X			refresh();
X			sum /= 10L;
X			count--;
X		}
X		else if (ch=='\n') {
X			done=TRUE;
X		}
X	}
X	return( sum );
X}
X
X#define INFINITE	1000
X
Xint		bx;		/* distination 'x' coordinate */
Xint		by;		/* destination 'y' coordinate */
Xint		moving_country;	/* country that is moving */
X
X#define MAX_MOVE_UNITS	0x7f
Xunsigned char	history_reachp[ MAPX ][ MAPY ];
X
X#if 1
Xint	level;
X#endif
X
X/*
X *	land_2reachp()
X */
X
Xint
Xland_2reachp( ax, ay, move_points )
Xint	ax;
Xint	ay;
Xint	move_points;
X{
X	register int	i = 0;
X	int	delta_x, delta_y;
X	int	x_abs_delta, y_abs_delta;
X	int	own;
X	int	dx[ 8 ];
X	int	dy[ 8 ];
X
X	delta_x = bx - ax;
X	delta_y = by - ay;
X
X	/* Have we got where we are going? */
X	if( delta_x == 0 && delta_y == 0 ) {
X		return( 1 );
X	}
X
X	/* Any move points left? (optimization) */
X	if( move_points == 0 ) {
X		return( 0 );
X	}
X
X	x_abs_delta = (delta_x < 0) ? -delta_x : delta_x;
X	y_abs_delta = (delta_y < 0) ? -delta_y : delta_y;
X
X	/* couldn't reach if all moves cost 1 (optimization) */
X	if( max( x_abs_delta, y_abs_delta ) > move_points ) {
X		return( 0 );
X	}
X
X	{
X		register int	inc_x;
X		register int	inc_y;
X
X		inc_x = (delta_x < 0 ) ? -1 : 1;
X		inc_y = (delta_y < 0 ) ? -1 : 1;
X
X		/*I HAVE CHANGED THIS CODE FROM THE ORIGINAL TO OPTIMIZE IT*/
X		/*I think it should work well*/
X		if( y_abs_delta == 0) {
X			/* try 'x' movements first */
X			dx[i] = inc_x; dy[i++] = 0;
X			dx[i] = inc_x; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = -inc_y;
X			dx[i] = 0; dy[i++] = inc_y;
X			dx[i] = 0; dy[i++] = -inc_y;
X			dx[i] = -inc_x; dy[i++] = inc_y;
X			dx[i] = -inc_x; dy[i++] = 0;
X			dx[i] = -inc_x; dy[i++] = -inc_y;
X		} else if( x_abs_delta == 0 ) {
X			/* try 'y' movements first */
X			dx[i] = 0; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = inc_y;
X			dx[i] = -inc_x; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = 0;
X			dx[i] = -inc_x; dy[i++] = 0;
X			dx[i] = inc_x; dy[i++] = -inc_y;
X			dx[i] = 0; dy[i++] = -inc_y;
X			dx[i] = -inc_x; dy[i++] = -inc_y;
X		} else {	/* x_abs_delta != 0, 0 != y_abs_delta */
X			/* try diagonal movements first */
X			dx[i] = inc_x; dy[i++] = inc_y;
X
X			dx[i] = 0; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = 0;
X
X			dx[i] = -inc_x; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = -inc_y;
X
X			dx[i] = -inc_x; dy[i++] = 0;
X			dx[i] = 0; dy[i++] = -inc_y;
X
X			dx[i] = -inc_x; dy[i++] = -inc_y;
X		} /* if */
X	} /* block */
X
X	{
X		register int	x, y;
X		register int	new_mp;
X
X		for( i = 0; i < 8; i++ ) {
X			if( (x = ax + dx[i]) < 0 || x >= MAPX )
X				continue;
X			if( (y = ay + dy[i]) < 0 || y >= MAPY )
X				continue;
X
X			if( sct[x][y].altitude == PEAK)
X				continue;
X			if( sct[x][y].altitude == WATER)
X				continue;
X
X			new_mp = move_points - movecost[ x ][ y ];
X			if( new_mp < 0 )
X				continue;
X
X			/*
X			*	If we have been to this sector before
X			*	in fewer move points this path is not
X			*	going to do any better.
X			*/
X			if( history_reachp[x][y] >= new_mp ) {
X				continue;
X			}
X			history_reachp[x][y] = new_mp;
X
X			/*
X			*	Test for a hostile army
X			*/
X			/* BUG: should engage if army is hostile but does not own sector */
X			/* BUG: take into account THE_VOID, HIDDEN, and NINJA */
X			/* BUG: NEUTRAL does not allow to pass */
X			if( (own = sct[x][y].owner) > 0 &&
X			ntn[own].dstatus[moving_country] >= WAR &&
X			x != bx && y != by &&
X			solds_in_sector( x, y, own ) > 0 ) {
X				continue;	/* at war with the owner, may not pass */
X			}
X
X			level++;
X			if( land_2reachp( x, y, new_mp ) ) {
X				level--;
X				return( 1 );
X			} /* if */
X			level--;
X		} /* for */
X	} /* block */
X	return( 0 );
X} /* land_2reachp() */
X
X/*
X *	land_reachp()
X */
X#ifdef ADMIN
Xint
Xland_reachp( ax, ay, gx, gy, move_points, movee )
Xint	ax;
Xint	ay;
Xint	gx;
Xint	gy;
Xint	move_points;
Xint	movee;
X{
X	int	result;
X
X	if( move_points >= MAX_MOVE_UNITS ) {
X		fprintf( stderr, "land_reachp(): move_points = %d\n",
X			move_points );
X
X		abrt();
X	}
X
X	/* Are we starting or ending in the water or on a peak? */
X	if( sct[ax][ay].altitude == WATER || sct[ax][ay].altitude == PEAK )
X		return( 0 );
X	if( sct[gx][gy].altitude == WATER || sct[gx][gy].altitude == PEAK )
X		return( 0 );
X
X#ifdef SYSV
X	memset( history_reachp, 0, sizeof(history_reachp) );
X#else
X	bzero((char *) history_reachp,sizeof(history_reachp));
X#endif
X
X	history_reachp[ax][ay] = move_points;
X
X	bx = gx;
X	by = gy;
X	moving_country = movee;
X
X	level = 1;
X	result = land_2reachp( ax, ay, move_points );
X	return( result );
X} /* land_reachp() */
X#endif ADMIN
X#ifdef ADMIN
X/*
X *	water_2reachp()
X */
X
Xint
Xwater_2reachp( ax, ay, move_points )
Xint	ax;
Xint	ay;
Xint	move_points;
X{
X	register int	i = 0;
X	int	delta_x;
X	int	delta_y;
X	int	dx[ 8 ];
X	int	dy[ 8 ];
X
X	/* this path uses too many move units */
X	if( move_points < 0 )
X		return( 0 );
X
X	/*
X	*	If we have been to this sector before in fewer move points
X	*	this path is not going to do any better.
X	*/
X	if( history_reachp[ ax ][ ay ] <= move_points )
X		return( 0 );
X
X	history_reachp[ ax ][ ay ] = move_points;
X
X	delta_x = ax - bx;
X	delta_y = ay - by;
X
X	/* Have we got where we are going? */
X	if( delta_x == 0 && delta_y == 0 )
X		return( 1 );
X
X	/* Have we run into ground, but not reached our destination? */
X	if( sct[ax][ay].altitude != WATER )
X		return( 0 );
X
X	/* Any move points left? (optimization) */
X	if( move_points == 0 )
X		return( 0 );
X
X	/* couldn't reach if all moves cost 1 (optimization) */
X	if( max( abs( delta_x ), abs( delta_y ) ) > move_points )
X		return( 0 );
X
X	/* BUG: test for an enemy navy */
X
X	{
X		register int	inc_x;
X		register int	inc_y;
X
X		inc_x = (delta_x < 0 ) ? -1 : (delta_x > 0) ? 1 : 0;
X		inc_y = (delta_y < 0 ) ? -1 : (delta_y > 0) ? 1 : 0;
X
X		if( abs(delta_x) > abs(delta_y) ) {
X			/* try 'x' movements first */
X			dx[i] = inc_x; dy[i++] = 0;
X			dx[i] = inc_x; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = -inc_y;
X			dx[i] = 0; dy[i++] = inc_y;
X			dx[i] = 0; dy[i++] = -inc_y;
X			dx[i] = -inc_x; dy[i++] = inc_y;
X			dx[i] = -inc_x; dy[i++] = 0;
X			dx[i] = -inc_x; dy[i++] = -inc_y;
X		} else {	/* abs(delta_x) < abs(delta_y) */
X			/* try 'y' movements first */
X			dx[i] = 0; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = inc_y;
X			dx[i] = -inc_x; dy[i++] = inc_y;
X			dx[i] = inc_x; dy[i++] = 0;
X			dx[i] = -inc_x; dy[i++] = 0;
X			dx[i] = inc_x; dy[i++] = -inc_y;
X			dx[i] = 0; dy[i++] = -inc_y;
X			dx[i] = -inc_x; dy[i++] = -inc_y;
X		} /* if */
X	} /* block */
X
X	{
X		register int	x, y;
X		register int	new_mp;
X
X		for( i = 0; i < 8; i++ ) {
X			if( (x = ax + dx[i]) < 0 || x >= MAPX )
X				continue;
X			if( (y = ay + dy[i]) < 0 || y >= MAPY )
X				continue;
X
X			new_mp = move_points - 1;
X			if( new_mp < 0 )
X				continue;
X
X			if( water_2reachp( x, y, new_mp ) )
X				return( 1 );
X		} /* for */
X	} /* block */
X
X	return( 0 );
X} /* water_2reachp() */
X#endif ADMIN
X#ifdef 0
X/*
X *	water_reachp()
X */
X
Xint
Xwater_reachp( ax, ay, gx, gy, move_points, movee )
Xint	ax;
Xint	ay;
Xint	gx;
Xint	gy;
Xint	move_points;
Xint	movee;
X{
X	if( move_points >= MAX_MOVE_UNITS ) {
X		fprintf( stderr, "water_reachp(): move_points = %d\n",
X			move_points );
X
X		abrt();
X	}
X
X#ifdef SYSV
X	memset(history_reachp, MAX_MOVE_UNITS, sizeof(history_reachp));
X#else
X	{ register int i,j;
X		for (i=0; i < MAPX ; i++)
X		for (j=0; j < MAPY ; j++ )
X			history_reachp [i] [j] = MAX_MOVE_UNITS ;
X	}/* eof memset replacement block */
X#endif
X
X	history_reachp[ ax ][ ay ] = 0;
X
X	bx = gx;
X	by = gy;
X	moving_country = movee;
X
X	return( water_2reachp( ax, ay, move_points ) );
X} /* water_reachp() */
X#endif 0
X
X/*
X *	solds_in_sector()
X */
X
Xint
Xsolds_in_sector( x, y, country )
Xint	x;
Xint	y;
Xint	country;
X{
X	register struct nation	*nptr = &ntn[country];
X	register int	j;
X	register int	total = 0;
X
X	for( j = 0; j < MAXARM; j++ ) {
X		if( nptr->arm[j].sold == 0 )
X			continue;
X
X		if( nptr->arm[j].xloc == x && nptr->arm[j].yloc == y )
X			total += nptr->arm[j].sold;
X	}
X
X	return( total );
X} /* solds_in_sector() */
X#ifdef ADMIN
X/*
X *	score_one()
X */
X
Xstruct wght {
X	int	sectors;
X	int	civilians;
X	int	soldiers;
X	int	gold;
X	int	jewels;
X	int	iron;
X	int	magics;
X	int	ships;
X} weights[] = {
X/*		Per 2  1000    1000      100K 100K   100K   Magic  10 */
X/*	Races   Sector People  Soldiers  Gold Jewels Iron   Power Ship */
X/* NPC */	{ 2,    1,     0,        0,    1,    1,     1,    0 },
X/* kingdom */	{ 2,    1,     2,        3,    0,    0,     0,    0 },
X/* empire */	{ 3,    0,     0,        0,    0,    0,     0,    0 },
X/* wizard */	{ 0,    2,     1,        0,    3,    5,     20,   0 },
X/* theocracy */	{ 2,    1,     0,        0,    3,    0,     7,    0 },
X/* pirate */	{ 0,    0,     5,        0,    10,   10,    1,    5 },
X/* trader */	{ 2,    1,     0,        0,    1,    1,     1,    8 },
X/* warlord */	{ 2,    1,     2,        0,    1,    1,     1,    0 },
X/* demon */	{ 2,    0,     1,        0,    1,    0,     10,   0 },
X/* dragon */	{ 0,    0,     0,        10,   20,   0,     0,    0 },
X/* shadow */	{ 2,    0,     0,        0,    0,    5,     0,    0 },
X/* miner */	{ 0,    0,    5,    0,    10,   10,   1,    5 },
X};
X
Xlong
Xscore_one( country )
Xint	country;
X{
X	register struct nation	*nptr = &ntn[ country ];
X	register long		total = 0;
X	register struct wght	*wght = &weights[ nptr-> class ];
X
X	total += wght->sectors * nptr->tsctrs / 2;
X	total += wght->civilians * nptr->tciv / 1000;
X	total += wght->soldiers * nptr->tmil / 1000;
X	if(nptr->tgold > 0 ) total += wght->gold * nptr->tgold / 100000;
X	total += wght->jewels * nptr->jewels / 100000;
X	total += wght->iron * nptr->tiron / 100000;
X	total += wght->magics * num_powers(country,M_MIL);
X	total += wght->magics * num_powers(country,M_CIV);
X	total += wght->magics * num_powers(country,M_MGK);
X	total += wght->ships * nptr->tships / 10;
X
X	return( total );
X} /* score_one() */
X#endif ADMIN
X/*
X *	print_accum()
X */
X
X	/* max number of print_accum() calls in one printf() */
X#define MAX_BUFFER	4
X#define BUFFER_SIZE	20
X
X/*
X *	is_habitable()
X */
X
Xint
Xis_habitable( x, y )
Xint	x;
Xint	y;
X{
X	if( sct[x][y].altitude==WATER ) return( 0 );
X	if( sct[x][y].altitude==PEAK ) return( 0 );
X
X	if( tofood( sct[x][y].vegetation,sct[x][y].owner ) < DESFOOD) return(0);
X
X	return( 1 );
X}
X
X#ifdef CONQUER
Xint
Xunits_in_sector(x,y,country)
Xint	x;
Xint	y;
X{
Xint count=0;
Xint armynum, nvynum;
Xfor(armynum=0;armynum<MAXARM;armynum++)
X	if((ASOLD>0)&&(AXLOC==x)&&(AYLOC==y)) count++;
Xfor(nvynum=0;nvynum<MAXNAVY;nvynum++)
X	if(((NWAR+NMER)!=0)&&(NXLOC==x)&&(NYLOC==y)) count++;
Xreturn(count);
X}
X#endif CONQUER
X
Xint
Xnum_powers(country,type)
Xint country,type;
X{
Xint count_magic=0;
Xint try;
Xlong start, end;
Xswitch(type){
X	case M_MGK:
X		start=S_MGK;
X		end=E_MGK;
X		break;
X	case M_CIV:
X		start=S_CIV;
X		end=E_CIV;
X		break;
X	case M_MIL:
X		start=S_MIL;
X		end=E_MIL;
X		break;
X	default:
X		printf("fatal error in num_powers");
X		abrt();
X}
Xfor( try = start; try < start+end; try++ )
X	if( magic(country, powers[try] ) == 1 ) count_magic++;
Xreturn(count_magic);
X}
X
X/* returns food value of sector */
X/* 4 is limit of livable land */
Xtofood(vegetation,cntry)
Xint cntry;
Xregister char	vegetation;
X{
X	int i=0;
X	int foodvalue;
X#ifdef DERVDESG
X	if ((magic(cntry,DERVISH)||magic(cntry,DESTROYER))
X	&&(vegetation==DESERT || vegetation==ICE)) return(6);
X#endif DERVDESG
X	while( vegetation != *(veg+i) ) {
X		if( *(veg+i) == '0') break;
X		else i++;
X	}
X	foodvalue = *(vegfood+i);
X	if(ntn[cntry].race == ELF){
X		if(vegetation == FOREST) foodvalue++;
X		else if(vegetation == BARREN) foodvalue--;
X	}
X	return( foodvalue );
X}
X
X/*jewel cost for civilian power = Base * 2**( #mgk/2 + #civ + #mil/2 )	*/
X/*race			magical		civilian	military	*/
X/*	elves -		50K		50K		50K		*/
X/*	dwarves -	80K		40K		40K		*/
X/*	humans -	100K		25K		50K		*/
X/*	orcs -		100K		50K		25K		*/
X
X/* returns cost of magic power - returns -1 if invalid */
Xlong
Xgetmgkcost(type,country)
Xint type, country;
X{
X	int i;
X	long cost;
X	long base=50000L;
X	int npowers;
X	switch(type) {
X	case M_MGK:
X		if(ntn[country].race==DWARF)		base=80000L;
X		else if(ntn[country].race==HUMAN)	base=100000L;
X		else if(ntn[country].race==ORC)		base=100000L;
X		npowers=num_powers(country,M_CIV)+num_powers(country,M_MIL)+1
X		+2*num_powers(country,M_MGK);
X		npowers/=2;
X		break;
X	case M_CIV:
X		if(ntn[country].race==DWARF)		base=40000L;
X		else if(ntn[country].race==HUMAN)	base=25000L;
X		npowers=num_powers(country,M_MGK)+num_powers(country,M_MIL)+1
X		+2*num_powers(country,M_CIV);
X		npowers/=2;
X		break;
X	case M_MIL:
X		if(ntn[country].race==DWARF)		base=40000L;
X		else if(ntn[country].race==ORC)		base=25000L;
X		npowers=num_powers(country,M_CIV)+num_powers(country,M_MGK)+1
X		+2*num_powers(country,M_MIL);
X		npowers/=2;
X		break;
X	default:
X		return(-1);
X	}
X	cost = base;
X	for (i=1; i<npowers; i++) {
X		cost <<= 1;
X		if (cost > BIG)
X			return(BIG/2L);
X	}
X	return(cost);
X}
X
Xint
Xtodigit(character)
Xregister int	character;
X{
X	if( character >= '0' && character <= '9' )
X		return( character - '0' );
X	return( -1 );
X}
X
Xvoid
Xprep(country)
Xint country;
X{
X	short armynum,nvynum;
X	int save,i,j;
X
X	/*set occ to 0*/
X	for(i=0;i<MAPX;i++) for(j=0;j<MAPY;j++) occ[i][j]=0;
X
X	save=country;
X	/*set occ to country of occupant army*/
X	for(country=0;country<NTOTAL;country++) if(ntn[country].active!=0) {
X			for(armynum=0;armynum<MAXARM;armynum++){
X				if((ASOLD>0)&&(ASTAT!=SCOUT)){
X					if((occ[AXLOC][AYLOC]== 0)
X					||(occ[AXLOC][AYLOC]== country))
X						occ[AXLOC][AYLOC]= country;
X					else occ[AXLOC][AYLOC]= MAXNTN+5;
X				}
X			}
X			for(nvynum=0;nvynum<MAXNAVY;nvynum++){
X				if(NWAR+NMER>0){
X					if((occ[NXLOC][NYLOC]== 0)
X					||(occ[NXLOC][NYLOC]== country))
X						occ[NXLOC][NYLOC]= country;
X					else occ[NXLOC][NYLOC]= MAXNTN+5;
X				}
X			}
X		}
X	country=save;
X}
X
X/*destroy nation--special case if capitol not owned by other nation*/
Xvoid
Xdestroy(country)
Xint country;
X{
X	short armynum, nvynum;
X	int i, x, y;
X	fprintf(fnews,"1.\tDESTROY NATION %s",ntn[country].name);
X	if(country!=sct[ntn[country].capx][ntn[country].capy].owner){
X		fprintf(fnews,"\t(their capitol is owned by %s)\n",ntn[sct[ntn[country].capx][ntn[country].capy].owner].name);
X		/*get +5% to combat skill*/
X		ntn[sct[ntn[country].capx][ntn[country].capy].owner].aplus+=5;
X	}
X	else fprintf(fnews,"\t(they own their capitol)\n");
X
X	ntn[country].active=0;
X	for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) {
X		if(ntn[sct[AXLOC][AYLOC].owner].race==ntn[country].race)
X			sct[AXLOC][AYLOC].people+=ASOLD;
X		ASOLD=0;
X	}
X	for(nvynum=0;nvynum<MAXNAVY;nvynum++) {
X		NMER=0;
X		NWAR=0;
X	}
X	for(i=0;i<MAXNTN;i++) {
X		ntn[i].dstatus[country]=UNMET;
X		ntn[country].dstatus[i]=UNMET;
X	}
X
X	/*if take them you get their gold*/
X	if(country!=sct[ntn[country].capx][ntn[country].capy].owner){
X		if(ntn[country].tgold>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tgold+=ntn[country].tgold;
X		if(ntn[country].jewels>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].jewels+=ntn[country].jewels;
X		if(ntn[country].tiron>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tiron+=ntn[country].tiron;
X		if(ntn[country].tfood>0) ntn[sct[ntn[country].capx][ntn[country].capy].owner].tfood+=ntn[country].tfood;
X	}
X
X	/*if god destroys then kill all population*/
X	if(country==sct[ntn[country].capx][ntn[country].capy].owner){
X		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X		if(sct[x][y].owner==country) {
X			sct[x][y].people=0;
X			sct[x][y].owner=0;
X			if(tofood(sct[x][y].vegetation,0)>=DESFOOD)
X				sct[x][y].designation=DNODESIG;
X#ifdef DERVDESG
X			if((sct[x][y].vegetation==DESERT)
X			||(sct[x][y].vegetation==ICE))
X				sct[x][y].designation=sct[x][y].vegetation;
X#endif DERVDESG
X		}
X	}
X	/*slowly take over and all people flee*/
X	else if(ntn[sct[ntn[country].capx][ntn[country].capy].owner].race!=ntn[country].race){
X		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X		if(sct[x][y].owner==country) {
X			/*all kinds of refugees to neighboring countries*/
X			flee(x,y,1,0);
X			sct[x][y].people=0;
X			sct[x][y].owner=0;
X			if(tofood(sct[x][y].vegetation,0)>=DESFOOD)
X				sct[x][y].designation=DNODESIG;
X#ifdef DERVDESG
X			if((sct[x][y].vegetation==DESERT)
X			||(sct[x][y].vegetation==ICE))
X				sct[x][y].designation=sct[x][y].vegetation;
X#endif DERVDESG
X		}
X	}
X	/*else same race, so give all land to conqueror*/
X	else {
X		for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++)
X		if(sct[x][y].owner==country){
X			sct[x][y].owner=sct[ntn[country].capx][ntn[country].capy].owner;
X			if(tofood(sct[x][y].vegetation,0)>=DESFOOD)
X				sct[x][y].designation=DNODESIG;
X#ifdef DERVDESG
X			if((sct[x][y].vegetation==DESERT)
X			||(sct[x][y].vegetation==ICE))
X				sct[x][y].designation=sct[x][y].vegetation;
X#endif DERVDESG
X		}
X	}
X	return;
X}
X
X#define ALPHA_SIZE	128
X
X/*movecost contains movement cost unless water  -1 or unenterable land (-2)*/
X/* if water and not ajacent to land will cost -4*/
Xvoid
Xupdmove(race,country)
Xint country;
Xchar race;
X{
X	register struct s_sector	*sptr;
X	register int	i,j;
X	int x,y;
X	short	veg_cost[ ALPHA_SIZE ];
X	short	ele_cost[ ALPHA_SIZE ];
X
X	for( j = 0; j < ALPHA_SIZE; j++ )
X		veg_cost[j] = ele_cost[j] = -1;
X
X	for( j = 0; veg[j] != '0'; j++ ) {
X		switch( race ) {
X		case ELF:
X			veg_cost[ veg[j] ] = todigit( EVegcost[j] );
X			break;
X		case DWARF:
X			veg_cost[ veg[j] ] = todigit( DVegcost[j] );
X			break;
X		case ORC:
X			veg_cost[ veg[j] ] = todigit( OVegcost[j] );
X			break;
X		case HUMAN:
X		default:
X			veg_cost[ veg[j] ] = todigit( HVegcost[j] );
X			break;
X		} /* switch */
X	} /* for */
X
X	for( j = 0; ele[j] != '0'; j++ ) {
X		switch( race ) {
X		case ELF:
X			ele_cost[ ele[j] ] = todigit( EElecost[j] );
X			break;
X		case DWARF:
X			ele_cost[ ele[j] ] = todigit( DElecost[j] );
X			break;
X		case ORC:
X			ele_cost[ ele[j] ] = todigit( OElecost[j] );
X			break;
X		case HUMAN:
X		default:
X			ele_cost[ ele[j] ] = todigit( HElecost[j] );
X			break;
X		} /* switch */
X	} /* for */
X
X	for(x=0;x<MAPX;x++) for(y=0;y<MAPX;y++){
X		sptr = &sct[x][y];
X
X		if(race==GOD) movecost[x][y] = 0;
X		else
X		if(sptr->altitude==WATER) {
X			movecost[x][y] = -4;
X			for(i=x-1;i<=x+1;i++) for(j=y-1;j<=y+1;j++)
X			if( i>=0 && j>=0 && i<MAPX && j<MAPY)
X				if( sct[i][j].altitude != WATER)
X					movecost[x][y] = -1;
X		} else
X		if(((magic(country,DERVISH)==1)
X			||(magic(country,DESTROYER)==1))
X		&&((sptr->vegetation==ICE)
X			||(sptr->vegetation==DESERT))) {
X				movecost[x][y] = 1;
X		} else {
X			if( veg_cost[ sptr->vegetation ] == -1
X			|| ele_cost[ sptr->altitude ] == -1 )
X				movecost[x][y] = -2;
X			else
X				movecost[x][y] = veg_cost[ sptr->vegetation ] + ele_cost[ sptr->altitude ];
X		} /* if */
X	} /* for */
X} /* updmove() */
X
Xspreadsheet(nation)
Xint nation;
X{
X	register struct s_sector	*sptr;
X	register struct nation		*nptr;
X	long	product;
X	long	city_pop, cap_pop;
X	int x,y;
X
X	nptr = &ntn[ nation ];
X
X	spread.revfood = spread.revjewels = spread.reviron = spread.revcap = spread.revcity = 0L;
X	spread.incity = spread.incap = spread.ingold = spread.infarm = spread.iniron = 0;
X	spread.food = nptr->tfood;
X	spread.gold = nptr->tgold;
X	spread.iron = nptr->tiron;
X	spread.jewels = nptr->jewels;
X	spread.sectors = 0;
X	spread.civilians = 0;
X
X	for(x=0;x<MAPX;x++) for(y=0;y<MAPY;y++) {
X		sptr = &sct[x][y];
X		if(sptr->owner!=nation) continue;
X
X		/*update nation file for owner*/
X		spread.sectors++;
X		spread.civilians += sptr->people;
X
X		/*PRODUCE*/
X		/*increase tmin based on mined stuff...*/
X		if(sptr->designation==DMINE) {
X			spread.iniron += sptr->people;
X			product = sptr->iron * (long) sptr->people;
X			if(sptr->people>TOMANYPEOPLE) product/=2;
X			if(magic(sptr->owner,MINER)==1) product*=2;
X			if(magic(sptr->owner,STEEL)==1) product*=2;
X			spread.iron += product;
X			spread.reviron += product*TAXIRON/100L;
X		}
X		/*harvest food*/
X		else if(sptr->designation==DFARM) {
X			spread.infarm += sptr->people;
X			product= (long)tofood(sptr->vegetation,sptr->owner) * (long) sptr->people;
X			if(sptr->people>TOMANYPEOPLE) product/=2;
X
X			spread.food += product;
X			spread.revfood += product*TAXFOOD/100L;
X		}
X		/*gold mines produce gold*/
X		else if(sptr->designation==DGOLDMINE) {
X			spread.ingold += sptr->people;
X			product = sptr->gold * (long) sptr->people;
X
X			if(sptr->people>TOMANYPEOPLE) product/=2;
X
X			if(magic(sptr->owner,MINER)==1) product*=2;
X
X			spread.jewels += product;
X			spread.revjewels += product*TAXGOLD/100L;
X		}
X		else if(sptr->designation==DCAPITOL) {
X			/* it had better be your capitol */
X			if((x!=nptr->capx)&&(y!=nptr->capy)) {
X				if(sct[nptr->capx][nptr->capy].designation != DCAPITOL){
X					nptr->capx=x;
X					nptr->capy=y;
X					cap_pop  = sptr->people;
X					city_pop = 0;
X				} else {
X					cap_pop = 0;
X					city_pop = sptr->people;
X					printf("changing %d %d to a town",x,y);
X					sptr->designation = DCITY;
X				}
X			} else {
X				city_pop = 0;
X				cap_pop = sptr->people;
X			}
X			spread.incap += cap_pop;
X			spread.incity += city_pop;
X
X			if( magic(sptr->owner, ARCHITECT ) ) {
X				city_pop *= 2L;
X				cap_pop *= 2L;
X			}
X
X			spread.revcity +=  city_pop * TAXCITY / 100L;
X			spread.revcap +=  cap_pop * TAXCAP / 100L;
X		}
X		else if(sptr->designation==DCITY) {
X			spread.incity += sptr->people;
X			city_pop = sptr->people;
X			if( magic(sptr->owner, ARCHITECT ) )
X				city_pop *= 2L;
X			spread.gold +=  city_pop * TAXCITY / 100L;
X			spread.revcity +=  city_pop * TAXCITY / 100L;
X		}
X#ifndef DERVDESG
X		else if(((magic(sptr->owner,DERVISH)==1)
X			||(magic(sptr->owner,DESTROYER)==1))
X		&&((sptr->vegetation==ICE) ||(sptr->vegetation==DESERT))
X		&&(sptr->people>0)) {
X			product= 6L * sptr->people;
X			spread.food += product;
X			spread.revfood += product*TAXFOOD/100L;
X		}
X#endif DERVDESG
X	}
X	spread.gold += spread.revfood + spread.revjewels + spread.reviron + spread.revcity + spread.revcap;
X}
X
X#ifdef CONQUER
X
X/* string inputing routine to allow deleting */
Xget_nname(str)
Xchar str[];
X{
X	char ch;
X	int done=0,count=0,maxsize,xpos,ypos;
X
X	maxsize=12;	/* nation name input size */
X	while(!done) {
X		ch=getch();
X		if (isprint(ch)) {
X			if (count<maxsize) {
X				/* only input displayable characters */
X				addch(ch);
X				refresh();
X				str[count++] = ch;
X			}
X		}
X		else if ((ch=='\b' || ch=='\177')&&(count))
X		{
X			/* only delete what was printed */
X			getyx(stdscr,ypos,xpos);
X			move(ypos,--xpos);
X			addch(' ');
X			move(ypos,xpos);
X			refresh();
X			count--;
X		} else if (ch=='\n') {
X			done=1;
X		}
X	}
X	str[count++] = '\0';
X	return(count);
X}
X#endif CONQUER
END_OF_misc.c
if test 26322 -ne `wc -c <misc.c`; then
    echo shar: \"misc.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 3 \(of 8\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 8 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0