home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-10 | 61.0 KB | 1,714 lines |
- Path: uunet!zephyr.ens.tek.com!master!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v13i052: dominion - a multi-player world simulation game, Part16/28
- Message-ID: <2455@masterCNA.TEK.COM>
- Date: 11 Feb 92 18:25:20 GMT
- Sender: news@masterCNA.TEK.COM
- Lines: 1703
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: rosalia@dirac.physics.sunysb.edu (Mark Galassi)
- Posting-number: Volume 13, Issue 52
- Archive-name: dominion/Part16
- Environment: Unix, curses
-
-
-
- #! /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 16 (of 28)."
- # Contents: dom_tex.aa file.c
- # Wrapped by billr@saab on Tue Feb 11 10:14:55 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'dom_tex.aa' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'dom_tex.aa'\"
- else
- echo shar: Extracting \"'dom_tex.aa'\" \(40579 characters\)
- sed "s/^X//" >'dom_tex.aa' <<'END_OF_FILE'
- X\documentstyle[12pt,latexinfo,tabular]{report}
- X\pagestyle{headings}
- X
- X\begin{document}
- X
- X\newindex{cp}
- X\newindex{vr}
- X\newindex{fn}
- X\newindex{tp}
- X\newindex{pg}
- X\newindex{ky}
- X
- X\comment %**start of header (This is for running Texinfo on a region.)
- X\setfilename{dominion.info}
- X\markboth{Dominion Manual}{Dominion Manual}
- X\comment %**end of header (This is for running Texinfo on a region.)
- X
- X\begin{tex}
- X\pagestyle{empty}
- X\title{Dominion Manual}
- X
- X\author{The Dominion Project}
- X
- X\date{\today}
- X
- X\maketitle
- X\pagestyle{headings}
- X\pagenumbering{roman}
- X\tableofcontents
- X
- X\comment The following two commands start the copyright page.
- X\clearpage
- X\comment \vskip 0pt plus 1filll
- X
- XCopyright \copyright{} 1990 Free Software Foundation, Inc.
- X
- XPermission is granted to make and distribute verbatim copies of this manual
- Xprovided the copyright notice and this permission notice are preserved on
- Xall copies.
- X
- XPermission is granted to copy and distribute modified versions of this
- Xmanual under the conditions for verbatim copying, provided also that the
- XGNU Copyright statement is available to the distributee, and provided that
- Xthe entire resulting derived work is distributed under the terms of a
- Xpermission notice identical to this one.
- X
- XPermission is granted to copy and distribute translations of this manual
- Xinto another language, under the above conditions for modified versions.
- X
- X\clearpage
- X\end{tex}
- X
- X\begin{ifinfo}
- XThis file documents dominion.
- X
- XCopyright @copyright{} 1990 Free Software Foundation, Inc.
- XAuthored by the dominion project (see Authors section of this manual).
- X
- XPermission is granted to make and distribute verbatim copies of this manual
- Xprovided the copyright notice and this permission notice are preserved on
- Xall copies.
- X\begin{ignore}
- XPermission is granted to process this file through Tex and print the
- Xresults, provided the printed document carries copying permission notice
- Xidentical to this one except for the removal of this paragraph (this
- Xparagraph not being relevant to the printed manual).
- X\end{ignore}
- XPermission is granted to copy and distribute modified versions of this
- Xmanual under the conditions for verbatim copying, provided also that the
- XGNU Copyright statement is available to the distributee, and provided that
- Xthe entire resulting derived work is distributed under the terms of a
- Xpermission notice identical to this one.
- X
- XPermission is granted to copy and distribute translations of this manual
- Xinto another language, under the above conditions for modified versions.
- X\end{ifinfo}
- X
- X\clearpage
- X\pagenumbering{arabic}
- X
- X\chapter{Overview}
- X
- X\strong{Dominion} is an empire-style multi-player world simulation game.
- XEach player is the leader of a nation, and makes decisions for that
- Xnation. The decisions are political, military, diplomatic and
- Xeconomic, and all these are extremely important for the well-being of
- Xa nation. Some nations can be played by the computer. These nations
- Xare called NPCs (Non Player Countries). They play a challenging game,
- Xand are quite useful if few human players are available.
- X
- XDominion has features from both fantasy role-playing games, educational
- Xgames, and war games: a user needs to develop a character as leader of
- Xa nation, keep a healty economy, and can then develop a strong
- Xmilitary force using magic or technology.
- X
- XMost of the moves you make are not resolved until the end of a turn,
- Xwhen the \emph{update} is run. This update will incorporate your
- Xchanges into the world data base, then it will update your economy,
- Xhandle migration of people, resolve battles and conquest of land,
- Xfreshen up your armies (restore move points), and a few other things.
- X
- XThe rhythm of the game is set by how much money you have spent, and
- Xhow much you have moved your armies. If you have spent all your
- Xmoney, you will need to wait until your revenue comes in (after the
- Xupdate) before you can spend more. Similarly, if you have already
- Xmoved all your armies, and they are overcome by fatigue, then you will
- Xhave to wait until they have recovered. This will happen in the
- Xupdate. The time elapsed between updates is called a \emph{thon}.
- X
- X\chapter{Getting started}
- X
- XYour nation is added to the game by the Game Master, or someone
- Xtrusted by the Game Master. You get to choose the \emph{name},
- X\emph{leader name}, \emph{race}, \emph{nation mark} (used for display)
- Xand \emph{magical order} for your nation. The choice of race and
- Xmagical order are important: each race comes with certain
- Xcharacteristics (dwarves are better miners; elves are more
- Xintelligent, have good magical aptitude; orcs reproduce like crazy and
- Xso on\dots{}). The magical order determines what spirits you will be
- Xable to summon, and which spells will be available for you to cast.
- XApart from the advantages of each race and magic order, they largely
- Xdetermine what role you will play in the game.
- X
- XWhen you first look at your country you will see sectors with letters on
- Xthem. Each of these is a sector designation from which you can tell
- Xwhat your country uses the sector for. You can change these
- Xdesignations once you own a sector; this will typically cost money,
- Xand maybe metal and jewels.
- X
- X\section{Moving around the map}
- XYou can move to another sector on the map using the [h], [j], [k], [l]
- Xkeys to move up, down, right, left; and the keys [y], [u], [b], [n] to
- Xmove diagonally. This is similar to the cursor movements in some
- Xeditors (like \emph{vi}), and some UNIX games (such as \emph{rogue},
- X\emph{larn}, \emph{nethack}, \emph{conquer}, \dots{}).
- X
- XAlternatively, you may use the numeric keypad, in which case the
- Xnumber keys represent the same direction in which they point on the
- Xkeypad. Both the ordinary keys and the numeric keypad can be used to
- Xbrowse the map and to move armies. The following diagram shows you
- Xthe directions and keys you can use.
- X
- XFor large movements across the map, you can use the \emph{upper-case}
- Xletters [H], [J], [K], [L]. These jump 8 sectors over.
- X
- XOne last thing: when you are starting out in the game, you might be
- Xoverwhelmed by the number of commands, options, report screens, and so
- Xon\dots{}. You might also be overwhelmed by the size of this manual,
- Xand not want to read it all until you have been playing a few turns.
- XThe way out is to just explore the commands described in the reference
- Xcard. Except at main level of the game (where you look at your
- Xnation's map), all the commands have menus for the subcommands, and
- Xyou can usually follow those. Moreover, we have a context-sensitive
- Xhelp system, so at any moment you can type [?] and get that part of
- Xthe manual which regards the command you are currently using.
- X
- X\comment hmm, think about keeping this on the same page.
- X\comment \newpage
- X\begin{verbatim}
- 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\end{verbatim}
- X
- X\section{Moving your armies}
- XArmies and navies are manipulated with the [a] menu. Here are
- X\emph{some} of the army commands. A complete list comes later.
- X
- X\begin{itemize}
- X
- X\item
- X\emph{[l]ist} army types will give you a list of army and navy types
- Xavailable to you for drafting. As your technology improves, more army
- Xand navy types will become available. At the start, you should only
- Xsee \emph{Cavemen} and \emph{Caravans} in the list.
- X
- X\item
- X\emph{[n]ext army}
- X\item
- X\emph{[p]revious army}. These pick the next and previous armies in the
- Xcurrent sector, skipping armies that do not belong to you. The
- Xcurrently ``picked'' army should be highlighted.
- X
- X\item
- X\emph{[N]} and \emph{[P]} are like [n] and [p], but they move the the next
- Xarmy \emph{number}, whether it is on the same sector or not. These
- Xcan be used to cycle through all the armies in your nation.
- X
- X\item
- X\emph{[m]ove}. after you have selected an army you want to move just type
- X[m] and move the cursor to where you want the army to be.
- X\emph{Warning}: watch your army's \strong{move points} and the
- X\strong{move cost} of each sector you cross: if you run out your army
- Xmight get stuck where you don't want it!!
- X
- X\item
- X\emph{[s]tatus}. This lets you change your army's status. The status is
- Xthe mode your army is in, and affects what your army will do in
- Xvarious situation. The most basic army statuses are:
- X
- X\begin{itemize}
- X\item
- X\emph{[a]ttack}. When in this mode your army will attack another
- Xarmy in the same sector. This will happen only if you are at WAR
- Xor JIHAD.
- X
- X\item
- X\emph{[d]efend}. An army in defend status can not take a sector nor
- Xwill it attack another army. If attacked it will defend itself.
- X
- X\item
- X\emph{[o]ccupy}. If you want to take a sector that is un-owned or owned
- Xby an enemy, you move an army to that sector and set its status to
- Xoccupy.
- X\end{itemize}
- X
- X\item
- X\emph{[d]raft}. To draft an army or navy you must be in a city or
- Xcapital that you own. Drafting an army will cost metal and money, so
- Xbe careful and watch how much you spend. You will be given the list
- Xof available army types, (see [l]ist), and you must just type the
- Xabbreviation character for that army type.
- X
- X\end{itemize}
- X
- X\section{Taking sectors}
- XAt the beginning of the game, you should take many sectors: this gives
- Xa safety buffer around your capital, and allows you to look for
- Xresources in the new occupied lands. You take sectors by moving an
- Xarmy \emph{of at least 100 soldiers} to that sector and setting it on
- Xoccupy mode. If the sector belongs to another nation, you will have
- Xto declare war on them to take the sector from them. You declare war
- Xusing the [r]eports menu, and choosing [d]iplomacy.
- X
- XOnce you take a sector (it will become yours after the update), you
- Xcan redesignate that sector so it produces what you want. For
- Xexample, redesignating to a farm will make that sector produce food,
- Xand so on. Sector designations are described in great detail later,
- Xbut you should know now that to change a designation you use the
- X[Z]oom key to focus on the specific sector, and then you can change
- Xthe designation with the [r]edesignate key \emph{inside} the [Z]oom
- Xscreen. You will be given a menu of possible designations.
- X
- XTo help you choose a designation for the sectors you take, the sector
- Xwindow (to the bottom right of your screen) shows you the \strong{soil},
- X\strong{metal}, \strong{jewels} in that sector. If the soil value is
- Xhigh, then redesignating to a \strong{farm} is a good idea. If the
- Xsector has a high metal yield, you might want to make a \strong{metal mine}
- Xout of it, and so on.
- X
- XBelow is an example of a sector window that shows a sector with jewels
- X5, metal 0 and soil 6. The sector belongs to nation Khazad Dum, has
- Xcoordinates (2, 2) relative to the current player, has 452 inhabitants
- Xwhich are of race (D) (Dwarves).
- X
- X\comment Hmm: think about putting it on the same page or a new page
- X\comment \newpage
- X\begin{verbatim}
- X +----------------------+
- X |(2,2) |
- X |Khazad Dum-jwl. mine |
- X |Brush Plateau |
- X |452 people (D) |
- X |metal 0 jewels 5 |
- X | soil 6 movecost 1 |
- X +----------------------+
- X\end{verbatim}
- X
- X\section{Setting up your budget}
- XIt is important that you set up your budget properly. You do
- Xthis by hitting [r] ([r]eport), and then [b] (for the [b]udget
- Xreport). In here you should choose your tax rate, and the amount of
- Xmoney/metal/jewels you choose to invest in various types of research.
- XA note about taxes: if your taxes are too high, your production of
- Xfood, metal and jewels will decrease.
- X
- XThere are default values set for investment in magic and technology,
- Xand there is a default tax rate. This is intended to guide new
- Xplayers through their first moves.
- X
- XIn the budget report you can also spend a fraction of your
- X\emph{reserves} on various types of research. To do this
- Xyou use the [s]torage option, and spend what you want of your current
- Xtreasury. This amount will be reset to 0 after each update.
- X
- X\section{Checking out your info screen}
- XYou should check your info screen every thon. This shows parameters
- Xof your race and nation, including your skills in magic and
- Xtechnology, combat, espionage and so forth.
- X
- X\section{Commands (brief)}
- XThis is a brief list of dominion commands. It is actually a verbatim copy
- Xof the reference card available as on-line help in dominion (you access
- Xthis with the [?] key followed by [r]).
- X\newpage
- X\begin{verbatim}
- X Dominion QUICK REFERENCE CARD
- XMovement (you are where the `*' is):
- X NORTH
- X (K)
- X y,7 k,8 u,9
- X \ | /
- X \ | /
- X WEST (H) h,4 ---- * ---- l,6 (L) EAST
- X / | \
- X / | \
- X b,1 j,2 n,3
- X (J)
- X SOUTH
- XDisplay:
- X [d]isplay options [F] dump map to file [w]indow manipulation
- X [^L] redraw screen [p] jump to a point [P] jump to your capital
- XAdministration:
- X [r]eports [a]rmies [Z]oom on sector
- X [W]izardry [t]ransportation [C]onstruct
- XMiscellaneous:
- X [Q]uit (or [q]uit) [m]ail [N]ews
- X [O]ptions
- X
- X\end{verbatim}
- X
- X\chapter{What is in the world}
- X
- XHere we describe races, terrain, technology, magic, designations,
- Xcommunications\dots{}
- X
- X\section{Races}
- XThere are several races in dominion, and each Game Master can add any
- Xraces s/he pleases by modifying the race descriptor file.
- X
- XThe parameters describing your race are strength, reproduction,
- Xmortality rate, intelligence, speed, stealth, the race's preferred
- Xaltitude, vegetation, and temperature, aptitude for magic, farming and
- Xmining.
- X
- XIn addition to these parameters, each race has certain special army
- Xtypes available to it. For example, Orcs can draft armies of type
- X``Orc'', which have some advantages, and Harpies can draft armies of
- Xtype ``Harpies'' which can fly. Ogres have the army type ``Ogres'',
- Xwhich fight very well; and Hobbits can draft ``Hobbits'', who are
- Xhidden from their enemies' sight.
- X
- XThe races currently available are Elf, Human, Dwarf, Orc, Merfolk,
- XIcefolk, Hobbit, Gnome, Harpy, Ogre, Walrus, Algae, and Squid. If you have a
- Xrace you would like to play and do not see it listed, talk to your
- Xgame administrator about adding it to the game. This should not be
- Xdone lightly, because the parameters describing each new race have to
- Xbe tuned to preserve game balance.
- X
- XSome of the races (Merfolk, Walrus, Algae, and Squid) live under water. The
- Xgame is almost symmetrical for races that live above and below water,
- Xthough there are some differences. Races that live above and below
- Xwater can interact (and fight) in several ways, as described below.
- X
- XEach of the above listed traits effects the races in the following ways:
- X
- X\begin{itemize}
- X\item
- XStrength: affects your combat bonus.
- X\item
- XReproduction: the rate at which people are born in your nation.
- X\item
- XMortality: every year this percentage of your population dies.
- X\item
- XIntelligence: affects your acquisition of technological skill, and
- Xalso helps in combat.
- X\item
- XSpeed: affects your armies' move points.
- X\item
- XStealth: affects your spy and secrecy skills.
- X\item
- XPreferred altitude, preferred vegetation, preferred temperature: these
- Xaffect migration of people, and move cost too. If your race likes high
- Xtemperatures, deserts will have less move cost. If they like high
- Xaltitude, mountains will have less move cost.
- X\item
- XMagic aptitude: this affects how quickly you learn the spells for the
- Xnation's chosen magical order, and how many spell points you gain.
- X\item
- XFarming: your farms produce this percentage more than their basic
- Xproductivity. This will increase during the game, as you acquire new
- Xtechnology.
- X\item
- XMining: your metal and jewel mines produce this percentage more than
- Xtheir basic productivity. This will increase during the game as you
- Xacquire new technology.
- X\end{itemize}
- X
- X\subsection{Basic races shipped with dominion}
- XThe Race descriptor table, below, shows the parameters for each race.
- X
- X\begin{same}
- X\begin{table}[hbpt]
- X\caption{Race Types}
- X\begin{tabular}{ || l | r | r | r | r | r | r | r | r | r | r | r | r || }
- X\hline
- XRace &Str&Rep&Mort&Intel&Spd&Stl&Alt&Veg&Temp&Mag&Farm&Mine\\
- X\hline
- XMaster & 0& 0& 0& 0& 0&0&0& 0& 0& 0& 0& 0\\
- XHuman &80&11& 8&50& 65&4&2& 3& 7&30& 0& 0\\
- XElf &70& 8& 5&70& 80&8&2& 5& 7&55&10&-15\\
- XOrc &50&15&10&20& 40&3&4& 4& 4&35& 0& 5\\
- XDwarf &95& 9& 6&60& 40&2&5& 3& 6&30&-5&20\\
- XHobbit &15&10& 7&45& 50&9&3& 4& 7&20& 5& 5\\
- XMerfolk &30& 7& 4&75& 80&7&-2&-1& 4&55&50&-10\\
- XIcefolk &90& 9& 7&50& 70&4&3& 0&10&30&50& 0\\
- XGnome &75&10& 8&95& 40&9&4& 3& 5&10& 0&10\\
- XHarpy &40&12&10&25& 60&5&5& 4& 6&30& 0&-5\\
- XOgre &95& 5& 3&75& 60&5&4& 3& 6&50& 5& 5\\
- XWalrus &95& 9& 7&30& 80&3&-1&-1& 7&55&50& 5\\
- XAlgae &15&11& 6&50& 60&7&-2&-1& 3&45&80& 0\\
- XSquid &40& 9& 8&25& 110&8&-2&-1& 5&40&50&15\\
- X\hline
- X\end{tabular}
- X\end{table}
- X\end{same}
- X
- X\subsection{A brief history of each race}
- X\indent \strong{Elves} are a race of great wisdom and magical skill. They do
- Xnot die unless killed in battle.
- X
- X\strong{Humans} are stronger than elves, but less wise, less magical, and
- Xthey have shorter life spans.
- X
- X\strong{Orcs} are an evil mockery of elves. They come from elves that were
- Xcaptured by the Dark Lord and twisted into horrible shapes. They
- Xreproduce very quickly, but are stupid, slow and weak.
- X
- X\strong{Dwarves} are sons of the earth. They are very strong, as they were
- Xmade to withstand the world in an evil age. They love mountains and caves,
- Xand typically build their kingdoms in great networks of caves.
- X
- X\strong{Hobbits} are merry little folk. They meddle little into the affairs
- Xof men and elves, and are not a warlike people. They can move very quietly.
- X
- X\strong{Merfolk} are people who live in the water. They are strong in magic.
- X
- X\strong{Icefolk} are creatures of the polar caps and glaciers. They like
- Xthe cold temperatures.
- X
- X\strong{Gnomes} are very technologically apt, but deal little with magic.
- X
- X\strong{Harpies} are stupid and vicious. Their only strength is that they can
- Xdraft armies of flying Harpies.
- X
- X\strong{Ogres} are slow but strong. They are quick to anger but soon forget
- Xwhat they were angry about. They do not reproduce much, but are extremely
- Xinteligent.
- X
- X\strong{Walrus} are water creatures with a preference towards colder climates.
- XThey would rather sit on an iceberg than a warm sunny beach.
- X
- X\strong{Algae} are water creatures that move little, are quite weak against
- Xfoes, but handy with magic and farming.
- X
- X\strong{Squid} are very fast water creatures, with decent aptitudes.
- X
- X\subsection{Land-water interaction}
- XFor the most part, land races operate on land and water races in the
- Xwater. But each can extend its influence to the other side of the sea
- Xlevel in various ways.
- X
- XShips, when owned by a land race, will travel on water. The converse
- Xis true for a water race: its ships will travel on land.
- X
- XIf a land nation sees some good mines or farms in the water, it can
- Xoccupy that sector using {\em Swimmers} or {\em Scuba_divers} army
- Xunits which have the \key{W} (Water) flag. Similarly, a water race
- Xcan occupy land sectors using armies such as {\em Walkers} which have
- Xthe \key{L} (Land) flag. Notice that any other army or spirit with
- Xthe W and L flags will work fine.
- X
- XThe army types mentioned above all have the \key{f} (front line) flag,
- Xso they can be unloaded from ships onto the desired sector.
- X
- XOnce the sector is occupied you cannot move people into it or they
- Xwill drown (or suffocate). But you can (at great expense) build a
- Xbubble over the sector (or cast a change-altitude spell) which will
- Xallow your people to move into it, even if it is a water (or land)
- Xsector. This provides a means for colonizing the oceans (continents).
- X
- X\section{Technology}
- XA nation starts with very low skills in mining, farming, construction,
- Xetc\dots{} These skills can be developed by investing money or metal
- Xin technology research. This investment is made in the budget report.
- XIncrease in technology depends on how much metal and money you invest
- Xeach thon. Metal will increase technology proportional to the
- X\emph{4/3's root} of the amount of metal invested;
- Xmoney will increase technology proportional
- Xto the \emph{square root} of the amount of metal invested
- X
- XOther benefits of technological R\&D are that with each new technology
- Xyou develop, you can gain certain things. For example, \strong{fire}
- Xincreases mining ability, decreases the mortality rate, and increases
- Xfarming ability. As well, you can gain the ability to draft
- Xnew types of armies.
- X
- X\section{Magic}
- XYour nation is initiated to one of the magic orders available.
- X
- XEach order is characterized by the set of \strong{spells} known to that
- Xorder, and a set of \strong{spirits} that can be summoned by mages of
- Xthat order. When you are initiated as a national leader you know only
- Xa little of the magic of that order, but you can increase your
- Xknowledge by investing money and jewels into magical research. As you
- Xinvest more and more, your magic skill will increase, and you will
- Xlearn more advanced spells, and how to summon more powerful spirits.
- XThis investment is made with the budget report.
- X
- XAs with technology, your magic skill increase is proportional to the
- Xjewels invested, and to the square root of the money you invest.
- X
- XOn top of this, some magical orders bring a set of characteristics to
- Xits initiates. These are described order by order.
- X
- XTo \emph{use} magic, i.e. to cast spells and summon spirits, you must
- Xacquire \strong{spell points}, and initiate one or more mages. You get
- Xspell points in proportion to the amount of \emph{jewels} you invest
- Xin magical R\&D, but \emph{not} from your money investment.
- X
- XYou need to bring a mage to a certain sector to cast a spell in it or
- Xsummon a spirit there, so you should make sure you initiate some mages
- Xto work for your nation. They cost a lot to initiate and maintain,
- Xbut are worthwhile. Mages are initiated in your temples and
- Xuniversities, which are located in either the city or the country.
- X
- XThe [W]izardry command allows you [l]ist available spells and spirits,
- X[c]ast spells, [s]ummon spirits, and [i]nitiate mages.
- X
- XThe basic magic orders in dominion are:
- X
- X\begin{itemize}
- X
- X\item
- XOrder of \emph{Aule}. Aule is the god of the earth, and is interested
- Xin all that happens in the depths of the earth. He protects miners
- Xand workers of metal and stone, and gives them an extra 10% mining
- Xskill.
- X
- X\item
- XOrder of \emph{Avian}. This order allows you to summon spirits
- Xrelated to the air.
- X
- X\item
- XOrder of \emph{Chess}. This order allows you to summon spirits
- Xsimilar to those on the chessboard in their movements and strength.
- X
- X\item
- XOrder of \emph{Demonology}, concerned with the conjuring of demons.
- X
- X\item
- XOrder of \emph{Diana}, mostly concerned with animals and hunting.
- X
- X\item
- XOrder of \emph{Inferno}. This order is concerned with power through
- Xfire.
- X
- X\item
- XOrder of \emph{Monsters}, this order has available to it many
- Xmonstrous creatures.
- X
- X\item
- XOrder of \emph{Necromancy}, concerned with the invocation of dead and
- Xundead spirits. Nations of this order start with their death rate
- Xincreased by 2%.
- X
- X\item
- XOrder of \emph{Neptune}. Neptune is the god of the oceans, and his
- Xorder is concerned with the waters.
- X
- X\item
- XOrder of \emph{Time}. This order steps back to the age of the
- Xdinosaurs.
- X
- X\item
- XOrder of \emph{Unity}. This order has spirits that combine different
- Xcreatures in one body.
- X
- X\item
- XOrder of \emph{Yavanna}. Yavanna is the godess of plants, and
- Xbasically everything that grows and is fertile is under her
- Xprotection. Yavanna gives her initiates an extra 50% farming skill.
- X
- X\item
- XOrder of \emph{Insects}. This order has spirits from the insect
- Xworld. This initiation gives a nation 1% extra reproduction.
- X
- X\end{itemize}
- X
- XThe Game Master can add other magical orders to the game by inserting
- Xa list of spirits for that order into a file.
- X
- X\section{Designations}
- XIf you own a sector, you can \emph{redesignate} it. That is, specify
- Xwhat function that sector has. It costs a certain amount of money
- X(and possibly also metal, jewels, \dots{}) to redesignate a sector.
- X
- XEach type of sector can employ a different number of people. For
- Xexample, a city can employ several thousand people, whereas a farm
- Xsector can only properly employ a few hundred people. The \emph{basic
- Xnumber} of people that a sector can employ is listed in the table
- Xbelow. This value is then modified by how much your race tends to
- Xcrowd. If you are an orc, for example, more people can be crammed
- Xinto a single sector, so the formula is:
- X\begin{ifinfo}
- X max_employed = sector_max * sqrt(reproduction / 10).
- X\end{ifinfo}
- X\begin{tex}
- X\[ max\_employed = sector\_max \times \sqrt{\frac{reproduction}{10}}. \]
- X\end{tex}
- X
- XThe possible designations (together with the characters that are
- Xdisplayed on the map) are:
- X\begin{itemize}
- X\item
- XFarm (\kbd{f}) - these produce food. Without farmers producing food,
- Xyour people will starve to death. Farms also generate revenue in the
- Xform of taxes.
- X\item
- XMetal mine (\kbd{m}) - supplies your country with metal, proportional to
- Xhow good the metal mine it is, how many people you have in it, and your
- Xmining ability. Also generates revenue in the form of taxes.
- X\item
- XJewel mine (\kbd{j}) - supplies your country with jewels, proportional to
- Xhow good a jewel mine it is, how many people you have in it, and your
- Xmining ability. Also generates revenue in the form of taxes.
- X\item
- XCity (\kbd{c}) - generate a lot of revenue in the form of taxes.
- XCities are also the places in which you can draft armies and construct
- Xships. Cities also contain universities and temples, so mages can be
- Xinitiated in them.
- X\item
- XCapital (\kbd{C}) - are like cities, but the administrative bureaucracy
- Xof your nation is based in your capital, so if your capital is
- Xsacked, many of your nation's riches will be taken.
- X\item
- XUniversity (\kbd{u}) - this is a school of higher education. Your
- Xcountry's intelligence can be increased if you put a lot of people in
- Xuniversities. Universities cost to maintain. Mages can be initiated
- Xin universities.
- X\item
- XTemple (\kbd{+}) - a place of worship. Mages can be initiated in
- Xtemples. Also, the fraction of your people in temples increases your
- Xmagic skill.
- X\item
- XStadium (\kbd{s}) - your country holds sports events here. (for now,
- Xdoes nothing)
- X\item
- XTrade post (\kbd{T}) - a caravan or ship can give goods and armies to
- Xanother nation by dropping them off at a trade post belonging to that
- Xother nation.
- X\item
- XEmbassy (\kbd{e}) - necessary to establish relations with another
- Xcountry. (for now, does nothing)
- X\item
- XFort (\kbd{!}) - forts give bonus to armies camped there (3/turn).
- X\item
- XHospital (\kbd{h}) - hospitals affect birth and death rates in your
- Xnation. (not yet) Hospitals have maintainance costs each turn.
- X\item
- XRefinery (\kbd{r}) - refines your metals. Increases the productivity
- Xof adjacent metal mines. A metal mine has 12% more production for
- Xeach surrounding refinery, if that refinery has at least the minimum
- Xemployment.
- X\end{itemize}
- X
- XThe \emph{Designation table} describes the properties of various
- Xdesignations: what they cost, how much revenue they produce per
- Xcapita, how much they cost to maintain, the minimum employment (not
- Xused in all cases), and how many people can be employed in that
- Xsector.
- X\begin{same}
- X\begin{table}[hbpt]
- X\caption{Designation table}
- X\begin{tabular}{ || l | l | l | l | l | l | l || }
- X\hline
- XDesignation &mark&desig& revenue & maint. & min & max \\
- X & &cost & per cap.&per turn&people&employed \\
- X\hline
- XNone & x & 1000 & 30 & 0 & 0 & 20 \\
- XFarm & f & 5000 & 100 & 0 & 10 & 500 \\
- XMetal mine & m &10000 & 100 & 0 & 10 & 800 \\
- XJewel mine & j &10000 & 100 & 0 & 10 & 800 \\
- XCity & c &30000 & 200 & 0 & 300 & 5000 \\
- XCapital & C &50000 & 300 & 0 & 500 & 7000 \\
- XUniversity & u &10000 & 30 & 2000 & 200 & 1000 \\
- XTemple & + & 5000 & 0 & 0 & 200 & 1000 \\
- XStadium & s & 5000 & 150 & 0 & 10 & 400 \\
- XTrade post & T & 5000 & 150 & 0 & 10 & 300 \\
- XEmbassy & e & 5000 & 0 & 0 & 50 & 200 \\
- XFort & ! &10000 & 50 & 0 & 10 & 200 \\
- XHospital & h &10000 & 100 & 4000 & 10 & 300 \\
- XRefinery & r & 8000 & 130 & 0 & 100 & 200 \\
- X\hline
- X\end{tabular}
- X\end{table}
- X\end{same}
- X
- X\section{Economy and natural resources}
- XThe pillars of your economy are money and natural resources (soil
- Xfertility, metal and jewels).
- X
- X\subsection{Money}
- XYou get money by levying taxes. You set the tax rate in the budget
- Xscreen. It is not wise to set a very high tax rate, because that will
- Xkill the spirit of entrepreneurship in your nation, and production of
- Xfood, metal and jewels will decrease in proportion.
- X
- XMoney is spent for just about everything: redesignating sectors,
- Xdrafting and maintaining armies, research and development, supporting
- Xuniversities and hospitals, and many other things.
- X
- X\subsubsection{Debt}
- X
- X[NOTE: the section on bonds described here is not yet implemented;
- Xfor now a debt simply means negative money]
- X
- XIf your nation's money balance goes negative, you will be forced to
- Xissue bonds to your population to finance the debt (this happens
- Xautomatically over the update, so there is no way you can plummet into
- Xa negative balance). You must then pay an interest on these bonds.
- X
- XAt any time you can also negotiate for other nations to purchase your
- Xbonds. Interest rate on domestic bonds is fixed (15%/thon), but you
- Xcan negotiate the price for bonds issued to other countries.
- X
- XIf you want to finance a big war, and get lots of cash fast, the best
- Xway to go is probably to issue a lot of bonds to other countries.
- X
- X(??) The bonds your nation issues must always be backed by your
- Xreserve of jewels.
- X
- X\subsection{Soil fertility}
- XYour nation must produce the food necessary to feed its people. This is
- Xdone by designating certain sectors to be farms. These farms will be
- Xmore productive if they are on sectors with a better soil parameter.
- X
- XYour farming skill also determines how productive your farms will be.
- XYou can increase your farming skill with research in technology, because
- Xyour nation will discover better tools and methods for farming.
- X
- XIf your food production is insufficient, your reserves will be used.
- XIf those are not enough, you had better arrange to purchase some, or
- Xthat part of your civilians who did not get enough food will starve.
- XOnce all your civilians have starved, your armies will start to
- Xstarve.
- X
- X\subsection{Metal}
- XMetal represents all metals and construction materials used for
- Xpractical purposes, such as construction and armaments. It is found
- Xin metal mines. The production of each mine is greater if the sector
- Xhas a higher metal parameter, and is also increased by your nation's
- Xmining skill. Your mining skill can increase if you invest in
- Xtechnology, because your nation will discover better tools for mining
- Xand prospecting.
- X
- XYou can spend your metal in several ways, including drafting armies,
- Xtechnological R\&D, constructing fortification and roads\dots{}
- X
- X\subsection{Jewels}
- XIn dominion, Jewels represent all kinds of rare resources, such as jewels,
- Xgold, silver, platinum, pearls, and so on. Jewels are found in jewel
- Xmines. How many jewels you produce in a mine depends on the jewels
- Xparameter of that sector, and also on your mining ability (see section
- Xon metal).
- X
- XJewels are very important, because they are invested in magical
- Xresearch, and are used to get spells. In fact, your spell points
- Xdepend only on the amount of jewels you invest in magical R\&D.
- X
- XJewels are also important in that they constitute your nation's
- Xreserve that backs up its currency and bonds. When you issue bonds,
- Xthese have to be backed up by jewels, so it is a good idea to save up
- Xsome jewels, and not spend them all. (note: bonds are not yet
- Ximplemented)
- X
- X(We must find another use for jewels, so nations have more choices to
- Xmake in spending jewels.)
- X
- X\section{Transportation and trade}
- XYou can trade with other nation, or just transport goods/armies/people
- Xfor your own benefit, using \strong{ships} and \strong{caravans}.
- XCaravans travel on land, whereas ships travel in the water.
- X
- XShips and caravans are ``drafted'' as if they were armies, and should
- Xappear in your [l]ist of available armies in the [a]rmy menu. The
- Xconstruction and maintainance costs of ships and caravans are
- Xtabulated with those of other army types. Note that some spirits also
- Xbehave as ships and caravas, in that they have the [c]argo flag.
- XExamples of this are the \emph{flying carpet}, the \emph{ghost ship}
- Xand the \emph{living ship}.
- X
- XA single cargo hold can only transport a certain amount of goods. The
- Xunit of weight is \emph{the weight of a single person}, and a caravan
- Xcan transport 250 person weights. A bar of metal weighs 0.1, money
- Xweighs 0.01 for a sheckel, food 0.05, a jewel basket 0.01. If you
- Xload soldiers, their weight is equal to the weight of the number of
- Xpeople plus the weight of the metal used in drafting an army that
- Xsize. Any caravan can transport only a single army and a single land
- Xtitle. The land title does not have significant weight.
- X
- XTo load a caravan or navy, you select it (with [a]rmy commands) and
- Xthen use the [t]ransportation command to [l]oad goods, which can be
- X[s]hekels (money units), [m]etal, [f]ood, [p]eople, [a]army or
- X[t]itle. To unload it you move the caravan or navy to its destination
- Xand do the same with [u]nload instead of [l]oad.
- X
- XYou can only load certain goods onto a caravan in certain places.
- XAnything can be loaded in a city. Metal can also be loaded in metal
- Xmines, jewels in jewel mines and food in farms. The title to a sector
- X\emph{must} be loaded on that sector itself. People can be loaded
- Xfrom any of your own populated sectors. Armies can be loaded anywhere
- Xin your land, but out of your territory they can only be loaded if
- Xthey have the front-line flag.
- X
- XTo unload in a foreign land you must be in a trading post, or you can
- Xunload armies with the front-line flag (for example, Sailors, Marines,
- XScuba divers). To trade an army in a foreign trading post, you should
- Xput the army in TRADED status, and then unload it on the trading post.
- XAlternatively, since armies move on their own, you can put them on
- XTRADED status and just walk them up to the trading post. When you
- Xstop that army on the foreign trading post, you will be asked if you
- Xreally want to trade it. You can also change the army to TRADED
- Xstatus once it is already on the trading post. In all cases you will
- Xbe asked for confirmation of the army trading.
- X
- XTransporting goods within your country is kind of useless. In your
- Xland, goods must be unloaded in trading posts or cities. Transporting
- Xpeople is an effective way of getting them to the better mines and
- Xfarms. Transporting armies can help mobilize your forces more
- Xquickly, since you can then unload them and they can still march.
- X
- XSome armies, such as Sailors and Marines, have ``front line'' flag
- X(see the army types table). This means that they can be unloaded from
- Xcaravans and ships anywhere: in your land, in un-owned land, and in
- Xforeign land. Thus ships and caravans can be used for transportation
- Xof fighting troops, not just for trade and migration.
- X
- X\section{Communications}
- XNations in dominion communicate through \strong{mail} and \strong{news}. Mail
- Xallows you to send personal messages to leaders of other nations.
- XNews is for general announcements, and is read by all nations.
- X
- XThere can be several newsgroups. One is always reserved for messages
- Xfrom the computer, containing general information on what has happened
- Xover the update. This newsgroup is usually called ``News''. Other
- Xnewsgroups are set up by the Game Master, and any nation leader can
- Xpost to them. At Stony Brook we usually have a newsgroup called
- X``public'' which receives many very creative postings from
- Xparticipants.
- X
- XYou should read your mail and news whenever you play your turn, to be
- Xin touch with your neighbours and the rest of the world. You also get
- Xmail from the update program after each update, telling you what has
- Xchanged in your nation over the update.
- X
- X\section{Construction}
- XYou can construct on a sector with the [C]onstruct command. Your
- Xconstruction will cost money and/or metal, and can make that sector
- Xmore valuable. You can construct:
- X\begin{itemize}
- X\item
- X\emph{[r]oads:} decreases the move cost for you (and anyone else) in this
- Xsector. The cost for building roads doubles for the next level of
- Xroad construction. For each level of roads construction, the move
- Xcost goes down by 1 (but it never goes below 1).
- X\item
- X\emph{[f]ortification:} fortifies the current sector: adds 10 to the
- Xfortification level, which gives \emph{your} armies that much bonus
- Xwhen defending that sector.
- X\item
- X\emph{[b]ubbles:} these are air/water-tight bubbles. They are necessary
- Xto colonize underwater (if you are an above-water race) and land (if you
- Xare an underwater nation). Once you have a bubble, you can move
- Xtroops and civillians to that sector.
- X\end{itemize}
- X
- X\section{World topology}
- XThe world is shaped like a torus (i.e. the surface of a doughnut).
- XThis is the best approximation of a sphere which can be displayed
- Xeasily on a flat terminal.
- X
- XThus, the world wraps; so, for example, if you are playing
- Xin a 100x100 world, and your nation grows to be 100 sectors
- Xwide, you can travel around the world.
- X
- X%\section{Terrain}
- X
- X\chapter{Diplomacy and war}
- X
- XDiplomatic relations with your neighbours are extremely important.
- XYour nation can be destroyed if you did not properly set your
- Xdiplomacy: you might make several enemies who could then form a treaty
- Xto fight you. This happens quite often.
- X
- XYour nation starts out with 10 armies of 100 Cavemen in your capital;
- Xmore can be drafted using the [a]rmy menu. Soldiers are used to
- Xoccupy unowned land, to defend your own territory, and also to conduct
- Xwar against enemy nations.
- X
- XTo occupy an unowned sector, you must have an army of at least 100
- Xsoldiers there, set on occupy mode. To occupy a sector owned by
- Xanother nation, you have to declare \emph{WAR} or \emph{JIHAD} with
- Xthem. Sectors can also be occupied by spirits with 100 units or more.
- X
- X\section{Diplomatic status}
- XIn the [r]eports menu, you can access your [d]iplomacy report. This
- Xreport shows you your status toward other countries, and their status
- Xtoward you. You start out \emph{UNMET} with all nations. Then, as
- Xyour armies come close to their sectors, or vice-versa, the two
- Xnations will meet and be put in neutral status.
- X
- XYou can change your status to other countries. A lot of statuses are
- Xpossible, but the most important ones are:
- X\begin{itemize}
- X\item[ALLIED]
- Xgives permission to the other nation to pass through your land at a
- Xlower move cost. Also, you can put your armies in GARRISON in allied
- Xland, and they will get 1/2 of the GARRISON bonus.
- X\item[TREATY]
- Xgoes beyond ALLIED: if your armies or those of the other nation are
- Xinvolved in a battle, and the other has armies on the same sector, the
- Xtwo will fight together. Also, if you put your armies in GARRISON in
- Xtreaty land, they will get the full GARRISON bonus.
- X\item[WAR]
- XIf any army of yours is on the same sector as an enemy army, and one
- Xof the two is on ATTACK or OCCUPY mode, there will be a battle.
- X\item[JIHAD]
- XFor now, the same as WAR. In the future, JIHAD should involve some
- Xexpense, and give a better fighting bonus due to fanatism in combat.
- X\end{itemize}
- X
- XYou can change your diplomatic status towards any nation you have met.
- XThey will see the change immediately. You can only change it by two
- Xdegrees, so that you cannot be ALLIED, march into someone's land, and
- Xthen declare WAR and occupy all their sectors.
- X
- END_OF_FILE
- if test 40579 -ne `wc -c <'dom_tex.aa'`; then
- echo shar: \"'dom_tex.aa'\" unpacked with wrong size!
- fi
- # end of 'dom_tex.aa'
- fi
- if test -f 'file.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'file.c'\"
- else
- echo shar: Extracting \"'file.c'\" \(17975 characters\)
- sed "s/^X//" >'file.c' <<'END_OF_FILE'
- X /* file.c -- file operations */
- X
- X/*
- X * Copyright (C) 1990 Free Software Foundation, Inc.
- X * Written by the dominion project.
- X *
- X * This file is part of dominion.
- X *
- X * dominion is free software; you can redistribute it and/or
- X * modify it under the terms of the GNU General Public License as published
- X * by the Free Software Foundation; either version 1, or (at your option)
- X * any later version.
- X *
- X * This software is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this software; see the file COPYING. If not, write to
- X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- X */
- X
- X/* this module contains routines that read and write the
- X world data file, and also routines that handle lock files.
- X */
- X
- X#include <stdio.h>
- X#ifdef SYSV
- X# include <string.h>
- X#else
- X# include <strings.h>
- X#endif /* SYSV */
- X#include "dominion.h"
- X#include "misc.h"
- X#define UPDATE_FILE "last_update"
- X
- Xextern int debug, compressed_world;
- Xextern struct race_list *races;
- Xextern Suser user;
- X
- Xread_world(wp, fname)
- X Sworld *wp;
- X char fname[];
- X{
- X int i, j;
- X FILE *fp, *fopen();
- X char cmd[200];
- X
- X compressed_world = check_compressed_world(fname);
- X if (compressed_world) {
- X sprintf(cmd, "zcat %s", fname);
- X if ((fp = popen(cmd, "r")) == NULL) {
- X printf("\r\ncannot open pipe <%s> for reading\r\n", cmd);
- X clean_exit();
- X exit(1);
- X }
- X } else {
- X if ((fp = fopen(fname, "r")) == NULL) {
- X printf("\r\ncannot open file <%s> for reading\r\n", fname);
- X clean_exit();
- X exit(1);
- X }
- X }
- X fprintf(stderr, "reading world data file %s", fname);
- X
- X fread(&wp->turn, sizeof(int), 1, fp); /* get current turn */
- X fread(&wp->xmax, sizeof(int), 1, fp); /* get world size */
- X fread(&wp->ymax, sizeof(int), 1, fp);
- X/* fprintf(stderr, "world size is %dx%d\n", wp->xmax, wp->ymax); */
- X
- X /* make space for world sectors */
- X wp->map = (Ssector **) malloc(wp->xmax*sizeof(Ssector *));
- X for (i = 0; i < wp->xmax; ++i) {
- X wp->map[i] = (Ssector *) malloc(wp->ymax * sizeof(Ssector));
- X }
- X /* now read in the world map */
- X for (i = 0; i < wp->xmax; ++i) {
- X for (j = 0; j < wp->ymax; ++j) {
- X fread(&wp->map[i][j], sizeof(Ssector), 1, fp);
- X wp->map[i][j].alist = NULL;
- X }
- X if (i % (wp->xmax/8) == 0) {
- X fprintf(stderr, ".");
- X fflush(stdout);
- X }
- X }
- X /* load geography */
- X fread(&wp->geo, sizeof(wp->geo), 1, fp);
- X fprintf(stderr, ".");
- X fflush(stdout);
- X /* now read in nations */
- X fread(&wp->n_nations, sizeof(int), 1, fp);
- X/* printf("reading in %d nation%c\n",
- X wp->n_nations, wp->n_nations == 1 ? ' ' : 's'); */
- X for (i = 0; i < wp->n_nations; ++i) {
- X /* must find a better way of loading linked lists
- X (when I make the nations be a linked list!!)
- X */
- X read_nation(&wp->nations[i], fp, wp);
- X load_options(&wp->nations[i]);
- X
- X fprintf(stderr, ".");
- X fflush(stdout);
- X/* if (debug) {
- X printf("just read nation %d\n", i);
- X show_nation(&wp->nations[i]);
- X putchar('.');
- X }
- X*/
- X }
- X if (compressed_world) {
- X pclose(fp);
- X } else {
- X fclose(fp);
- X }
- X init_wrap();
- X fprintf(stderr, "\n");
- X}
- X
- X /* save the world data file */
- Xwrite_world(wp, fname)
- X Sworld *wp; /* pointer to the world */
- X char fname[];
- X{
- X int i, j;
- X FILE *fp, *fopen();
- X char cmd[200]; /* for compression command */
- X
- X if (compressed_world) {
- X sprintf(cmd, "compress > %s.Z", fname);
- X if ((fp = popen(cmd, "w")) == NULL) {
- X printf("\r\ncannot open pipe <%s> for writing\r\n", cmd);
- X clean_exit();
- X exit(1);
- X }
- X } else {
- X if ((fp = fopen(fname, "w")) == NULL) {
- X printf("cannot open file <%s> for writing\n", fname);
- X clean_exit();
- X exit(1);
- X }
- X }
- X critical();
- X fwrite(&wp->turn, sizeof(int), 1, fp); /* write current turn number */
- X fwrite(&wp->xmax, sizeof(int), 1, fp);
- X fwrite(&wp->ymax, sizeof(int), 1, fp);
- X for (i = 0; i < wp->xmax; ++i) {
- X for (j = 0; j < wp->ymax; ++j) {
- X fwrite(&wp->map[i][j], sizeof(Ssector), 1, fp);
- X }
- X }
- X /* write out geography */
- X fwrite(&wp->geo, sizeof(wp->geo), 1, fp);
- X
- X printf("writing out %d nation%c\n",
- X wp->n_nations, wp->n_nations == 1 ? ' ' : 's');
- X fwrite(&wp->n_nations, sizeof(int), 1, fp);
- X /* only save as many nations as there are */
- X for (i = 0; i < wp->n_nations; ++i) {
- X write_nation(&wp->nations[i], fp);
- X if (debug) {
- X putchar('.');
- X }
- X }
- X
- X if (compressed_world) {
- X pclose(fp);
- X } else {
- X fclose(fp);
- X }
- X noncritical(); /* delicate phase over */
- X}
- X
- X /* short hand */
- X#define WRITE_DATUM(x) fwrite(&x, sizeof(x), 1, fp)
- X
- Xwrite_nation(np, fp)
- X Snation *np;
- X FILE *fp;
- X{
- X int i;
- X Sarmy *ap; /* for armies */
- X struct pt_list *pp; /* for owned sectors */
- X
- X /* here is how we save a nation: write out the actual nation data
- X structure first, and after it write out the various linked lists
- X (which are the army list and the list of owned points).
- X */
- X
- X fwrite(np, sizeof(Snation), 1, fp);
- X
- X /* write out list of country's armies */
- X ap = np->armies;
- X for (i = 0; i < np->n_armies; ++i) {
- X fwrite(ap, sizeof(Sarmy), 1, fp);
- X if (debug) {
- X putchar('a');
- X }
- X ap = ap->next;
- X }
- X
- X /* write list of owned locations */
- X pp = np->ptlist;
- X for (i = 0; i < np->n_sects; ++i) {
- X fwrite(pp, sizeof(struct pt_list), 1, fp);
- X if (debug) {
- X putchar('s');
- X }
- X pp = pp->next;
- X }
- X}
- X
- Xread_nation(np, fp, wp)
- X Snation *np;
- X FILE *fp;
- X Sworld *wp;
- X{
- X int i, x, y;
- X Ssector *sp; /* for tmp use */
- X Sarmy army; /* for armies */
- X struct pt_list *pp; /* for owned sectors */
- X
- X /* here is how we load a nation: read out the actual nation data
- X structure first, and after it read out the various linked lists
- X (which are the army list and the list of owned
- X points). This is harder than writing because we must insert
- X all into linked lists.
- X */
- X
- X fread(np, sizeof(Snation), 1, fp); /* this is the easy part */
- X
- X /* now reset to zero the nation's "current" R&D values:
- X that way the special R&D investments of the previous turn
- X are zeroed, and only the percent-of-revenue values are saved
- X */
- X np->cur_mag_r_d = np->cur_mag_r_d_jewels = 0;
- X np->cur_tech_r_d = np->cur_tech_r_d_metal = 0;
- X np->cur_spy_r_d = 0;
- X
- X /* read list of country's armies add each army to the list for
- X its nation and for its sector. Special case for first army.
- X */
- X np->armies = NULL;
- X for (i = 0; i < np->n_armies; ++i) {
- X fread(&army, sizeof(Sarmy), 1, fp);
- X army.next = NULL;
- X x = army.pos.x;
- X y = army.pos.y;
- X sp = &(wp->map[x][y]);
- X if (i == 0) {
- X/* army.id = 0; */
- X np->armies = (Sarmy *) malloc(sizeof(Sarmy));
- X *(np->armies) = army;
- X np->armies->next = NULL;
- X } else {
- X/* if (debug) {
- X printf("Calling insert_army_nation, id=%d\n", army.id);
- X }
- X*/
- X insert_army_nation(np, &army, army.id);
- X/* if (debug) {
- X printf("Called insert_army_nation.\n");
- X }
- X*/
- X }
- X/* if (debug) {
- X printf("Calling insert_army_sector (%d,%d)\n", sp->loc.x, sp->loc.y);
- X }
- X*/
- X insert_army_sector(sp, &army);
- X /* if (debug) {
- X printf("Called insert_army_sector.\n");
- X }
- X*/
- X }
- X
- X /* read list of owned locations (special case for first one) */
- X if (np->n_sects > 0) {
- X np->ptlist = (struct pt_list *) malloc(sizeof(struct pt_list));
- X fread(np->ptlist, sizeof(struct pt_list), 1, fp);
- X /* np->ptlist->pt = np->capital; */
- X np->ptlist->next = NULL;
- X pp = np->ptlist;
- X }
- X for (i = 1; i < np->n_sects; ++i) {
- X pp->next = (struct pt_list *) malloc(sizeof(struct pt_list));
- X fread(pp->next, sizeof(struct pt_list), 1, fp);
- X pp = pp->next;
- X pp->next = NULL;
- X if (debug) {
- X putchar('s');
- X }
- X }
- X}
- X
- X /* reads in the list of all races */
- Xread_races()
- X{
- X FILE *fp, *fopen();
- X char s[200];
- X int i, n_races;
- X Srace tmp_race; /* for temporary use */
- X struct race_list *rlp; /* to make the linked list */
- X
- X if ((fp = fopen(RACES_FILE, "r")) == NULL) {
- X printf("cannot open races file. you might have the wrong directory..\n");
- X clean_exit();
- X exit(1);
- X }
- X
- X /* the initial race is the master, and is hardwired */
- X races = (struct race_list *) malloc(sizeof(struct race_list));
- X strcpy(races->race.name, "Master");
- X races->race.mark = 'C';
- X races->race.strength = 0;
- X races->race.repro = 0;
- X races->race.mortality = 0;
- X races->race.intel = 0;
- X races->race.speed = 0;
- X races->race.stealth = 0;
- X races->race.pref_alt = 0;
- X races->race.pref_terrain = 0;
- X races->race.pref_climate = 0;
- X races->race.mag_apt = 0;
- X races->race.farming = 0;
- X races->race.mining = 0;
- X races->next = NULL;
- X
- X rlp = races;
- X
- X /* now get the number of races from the file
- X (we trust that the file is consistent)
- X */
- X fgets(s, 180, fp);
- X while (s[0] == '#') { /* ignore comments */
- X/* if (debug) {
- X printf("<%s>", s);
- X }
- X*/
- X fgets(s, 180, fp);
- X }
- X/* if (debug) {
- X printf("<%s>", s);
- X }
- X*/
- X sscanf(s, "%d", &n_races); /* first line has number of races */
- X
- X for (i = 0; i < n_races; ) { /* now read them in!! */
- X char c;
- X char name[180];
- X fgets(s, 180, fp);
- X s[strlen(s)-1] = '\0';
- X/* if (debug) {
- X printf("<%s>", s);
- X }
- X*/
- X if (s[0] != '#') { /* skip comments */
- X ++i;
- X sscanf(s,
- X "%s : %1s : %d : %d : %d : %d : %d : %d : %d : %d : %d : %d : %d : %d",
- X tmp_race.name, &tmp_race.mark, &tmp_race.strength,
- X &tmp_race.repro, &tmp_race.mortality, &tmp_race.intel,
- X &tmp_race.speed, &tmp_race.stealth, &tmp_race.pref_alt,
- X &tmp_race.pref_terrain, &tmp_race.pref_climate,
- X &tmp_race.mag_apt, &tmp_race.farming, &tmp_race.mining);
- X
- X/* if (debug) {
- X show_race(&tmp_race);
- X }
- X*/
- X /* now that we have loaded it, add it to the list */
- X rlp->next = (struct race_list *) malloc(sizeof(struct race_list));
- X rlp = rlp->next;
- X rlp->race = tmp_race;
- X rlp->next = NULL;
- X }
- X }
- X fclose(fp);
- X}
- X
- X /* this routine checks to see if the world file is
- X in a compressed format. It it is, it returns 1.
- X Otherwise, 0.
- X */
- Xcheck_compressed_world(fname)
- X char fname[];
- X{
- X char Zname[200];
- X FILE *fopen(),*fp;
- X
- X strcpy(Zname, fname);
- X strcat(Zname, ".Z"); /* if .Z file exists, it must be compressed! */
- X if ((fp = fopen(Zname, "r")) != NULL) {
- X fclose(fp);
- X return 1;
- X }
- X return 0;
- X}
- X
- X /* sets a master lock file */
- Xset_master_lock()
- X{
- X close(creat("lock.master", 0600));
- X}
- X
- X /* sets a lock for the given nation id */
- Xset_lock(id)
- X int id;
- X{
- X char fname[PATHLEN];
- X FILE *fp, *fopen();
- X extern Sworld world;
- X extern int ruid;
- X long now_secs;
- X
- X sprintf(fname, "lock.%d", id);
- X/* close(creat(fname, 0666)); */
- X if ((fp = fopen(fname, "w")) == NULL) {
- X printf("cannot open the lock file file <%s> for writing\n", fname);
- X clean_exit();
- X exit(1);
- X }
- X now_secs = time(0L);
- X /* now put some titbits of information into the lock file */
- X fprintf(fp, "%ld; Nation %s; real uid %d; time: %s", now_secs,
- X world.nations[id].name, ruid, ctime(&now_secs));
- X fclose(fp);
- X}
- X
- X /* removes a lock for the given nation id */
- Xdel_lock(id)
- X int id;
- X{
- X char fname[PATHLEN];
- X
- X sprintf(fname, "lock.%d", id);
- X unlink(fname);
- X}
- X
- X /* removes the master lock file */
- Xdel_master_lock()
- X{
- X unlink("lock.master");
- X}
- X
- X /* tries to open the lock file. returns the file pointer
- X it gets, with the file open for reading (if it exists)
- X */
- XFILE *is_locked(id)
- X int id;
- X{
- X FILE *fopen();
- X char fname[PATHLEN];
- X
- X sprintf(fname, "lock.%d", id);
- X return fopen(fname, "r");
- X/* if ((fp = fopen(fname, "r")) != NULL) {
- X fclose(fp);
- X return 1; /* yeah, it is locked */
- X/* }
- X return 0; */
- X}
- X
- X /* checks if even a single nation has a lock or not */
- Xis_any_lock()
- X{
- X int i;
- X FILE *fp;
- X
- X for (i = 0; i < NATIONS; ++i) {
- X if (fp = is_locked(i)) {
- X fclose(fp);
- X return 1;
- X }
- X }
- X return 0;
- X}
- X
- X /* cheks if there is a master lock file */
- Xis_master_lock()
- X{
- X FILE *fp, *fopen();
- X
- X if ((fp = fopen("lock.master", "r")) != NULL) {
- X fclose(fp);
- X return 1;
- X }
- X return 0;
- X}
- X
- Xset_update_time()
- X{
- X char fname[PATHLEN];
- X FILE *fp, *fopen();
- X extern Sworld world;
- X extern int ruid;
- X long now_secs;
- X
- X sprintf(fname, UPDATE_FILE);
- X if ((fp = fopen(fname, "w")) == NULL) {
- X printf("cannot open the update file file <%s> for writing\n", fname);
- X clean_exit();
- X exit(1);
- X }
- X now_secs = time(0L);
- X /* now put some titbits of information into the lock file */
- X fprintf(fp, "%ld; time: %s", now_secs, ctime(&now_secs));
- X fclose(fp);
- X}
- X
- Xchar *get_update_time()
- X{
- X char fname[PATHLEN];
- X FILE *fp, *fopen();
- X extern Sworld world;
- X extern int ruid;
- X long secs, len;
- X char s[300], *rtvl, *tmp;
- X
- X sprintf(fname, UPDATE_FILE);
- X if ((fp = fopen(fname, "r")) == NULL) {
- X set_update_time();
- X }
- X fgets(s,299,fp);
- X if ((rtvl = (char *) malloc(strlen(s) * sizeof(char))) == NULL) mem_error();
- X tmp = strchr(s,(int)':');
- X strcpy(rtvl,(tmp+1));
- X fclose(fp);
- X return rtvl;
- X}
- X
- Xmem_error()
- X/*
- X If we can't allocate any more memory, then tell the user that's the
- X case, and then die quietly, rather than the horrible death not
- X checking mallocs would cause.
- X*/
- X{
- X fprintf(stderr,"Error: Couldn't allocate requested memory");
- X cleanup();
- X clean_exit();
- X exit(1);
- X}
- X
- Xload_options(np)
- XSnation *np;
- X/* Loads various options form the options file into the user's option record */
- X{
- X char opt_file[PATHLEN], opt_line[100];
- X FILE *fopt;
- X int len;
- X
- X init_options(np);
- X sprintf(opt_file, "%s/opt.%d", OPT_DIR, np->id);
- X if ((fopt = fopen(opt_file,"r")) == NULL) {
- X save_options(np);
- X return;
- X }
- X while (fgets(opt_line, 99, fopt) != NULL) {
- X if (strncmp(opt_line, "EXPERT_MODE: ", 13) == 0)
- X {
- X np->opts->expert_mode = atoi(&(opt_line[13]));
- X user.xmode = np->opts->expert_mode;
- X } else if (strncmp(opt_line, "CIV_MOVEMODE: ", 14) == 0) {
- X np->opts->civ_movemode = atoi(&(opt_line[14]));
- X } else if (strncmp(opt_line, "MAIL_FORWARD: ", 14) == 0) {
- X if (opt_line[14] == '\n') {
- X np->opts->mail_forward = NULL;
- X continue;
- X }
- X len = strlen(&(opt_line[14]));
- X if ((np->opts->mail_forward = (char *)malloc((len + 1)* sizeof(char)))
- X == NULL) { mem_error(); }
- X strcpy(np->opts->mail_forward,&(opt_line[14]));
- X len = strlen(np->opts->mail_forward);
- X if (np->opts->mail_forward[len - 1] == '\n') {
- X np->opts->mail_forward[len - 1] = '\0';
- X }
- X } else if (strncmp(opt_line, "MAIL_READER: ", 13) == 0) {
- X if (opt_line[13] == '\n') {
- X np->opts->mail_reader = NULL;
- X continue;
- X }
- X len = strlen(&(opt_line[13]));
- X if ((np->opts->mail_reader = (char *)malloc((len + 1)* sizeof(char)))
- X == NULL) { mem_error(); }
- X strcpy(np->opts->mail_reader,&(opt_line[13]));
- X len = strlen(np->opts->mail_reader);
- X if (np->opts->mail_reader[len - 1] == '\n') {
- X np->opts->mail_reader[len - 1] = '\0';
- X }
- X } else {
- X fprintf(stderr,"Error: Bad Option %s\n",opt_line);
- X }
- X }
- X fclose(fopt);
- X}
- X
- Xsave_options(np)
- X/* Save all of the user's optoins to a file. */
- XSnation *np;
- X{
- X FILE *fopt;
- X char opt_file[PATHLEN], opt_line[100], *rtvl = NULL;
- X int len;
- X
- X sprintf(opt_file, "%s/opt.%d", OPT_DIR, np->id);
- X if ((fopt = fopen(opt_file,"w")) == NULL) {
- X clean_exit();
- X fprintf(stderr,"Error: Cannot Open Options File %s\n",opt_file);
- X exit(1);
- X }
- X
- X fprintf(fopt,"EXPERT_MODE: %d\n",np->opts->expert_mode);
- X fprintf(fopt,"CIV_MOVEMODE: %d\n", np->opts->civ_movemode);
- X if (np->opts->mail_forward == NULL) {
- X fprintf(fopt,"MAIL_FORWARD: \n");
- X } else {
- X fprintf(fopt,"MAIL_FORWARD: %s\n",np->opts->mail_forward);
- X }
- X if (np->opts->mail_reader == NULL) {
- X fprintf(fopt,"MAIL_READER: \n");
- X } else {
- X fprintf(fopt,"MAIL_READER: %s\n",np->opts->mail_reader);
- X }
- X fclose (fopt);
- X}
- X
- Xchar *get_char_option(user_num, optname)
- X/* This function returns a character option for the given user */
- Xint user_num;
- Xchar *optname;
- X{
- X FILE *fopt;
- X char opt_file[PATHLEN], opt_line[100], *rtvl = NULL;
- X int len, optlen = strlen(optname);
- X
- X sprintf(opt_file, "%s/opt.%d", OPT_DIR, user_num);
- X if ((fopt = fopen(opt_file,"r")) == NULL) {
- X return NULL;
- X }
- X
- X while (fgets(opt_line, 99, fopt) != NULL) {
- X if (strncmp(opt_line, optname, optlen) == 0) {
- X if (opt_line[optlen + 2] == '\n') {
- X rtvl = NULL;
- X break;
- X }
- X len = strlen(&(opt_line[optlen + 2]));
- X if ((rtvl = (char *)malloc((len + 1)* sizeof(char))) == NULL) {
- X mem_error(); }
- X strcpy(rtvl,&(opt_line[optlen + 2]));
- X len = strlen(rtvl);
- X if (rtvl[len - 1] == '\n') {
- X rtvl[len - 1] = '\0';
- X }
- X }
- X }
- X fclose(fopt);
- X return rtvl;
- X}
- X
- Xint get_int_option(user_num, optname)
- X/* This function returns an integer option for a given user */
- Xint user_num;
- Xchar *optname;
- X{
- X FILE *fopt;
- X char opt_file[PATHLEN], opt_line[100];
- X int len, optlen = strlen(optname), rtvl;
- X
- X sprintf(opt_file, "%s/opt.%d", OPT_DIR, user_num);
- X if ((fopt = fopen(opt_file,"r")) == NULL) {
- X return NULL;
- X }
- X
- X while (fgets(opt_line, 99, fopt) != NULL) {
- X if (strncmp(opt_line, optname, optlen) == 0) {
- X rtvl = atoi(&(opt_line[optlen + 2]));
- X break;
- X }
- X }
- X
- X fclose(fopt);
- X return rtvl;
- X}
- X
- Xinit_options(np)
- X/* Init an unused option record */
- XSnation *np;
- X{
- X if ((np->opts = (Soptions *)malloc(sizeof(Soptions))) == NULL){mem_error();}
- X
- X np->opts->expert_mode = 0;
- X np->opts->civ_movemode = 2; /* Move freely unless restricted by gov */
- X np->opts->mail_forward = NULL;
- X np->opts->mail_reader = NULL;
- X}
- END_OF_FILE
- if test 17975 -ne `wc -c <'file.c'`; then
- echo shar: \"'file.c'\" unpacked with wrong size!
- fi
- # end of 'file.c'
- fi
- echo shar: End of archive 16 \(of 28\).
- cp /dev/null ark16isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 28 archives.
- echo "Now execute ./do_cat.sh to build doc files"
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-