diff --git a/COPYING b/COPYING
deleted file mode 100644
index f6cdd22..0000000
--- a/COPYING
+++ /dev/null
@@ -1,232 +0,0 @@
-GNU GENERAL PUBLIC LICENSE
-Version 3, 29 June 2007
-
-Copyright © 2007 Free Software Foundation, Inc.
-
-Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The GNU General Public License is a free, copyleft license for software and other kinds of works.
-
-The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
-
-To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
-
-For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
-
-Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
-
-For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
-
-Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
-
-Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
-
-The precise terms and conditions for copying, distribution and modification follow.
-
-TERMS AND CONDITIONS
-
-0. Definitions.
-
-“This License” refers to version 3 of the GNU General Public License.
-
-“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
-
-“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
-
-To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
-
-A “covered work” means either the unmodified Program or a work based on the Program.
-
-To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
-
-To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
-
-An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
-
-1. Source Code.
-The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
-
-A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
-
-The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
-
-The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
-
-The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
-
-The Corresponding Source for a work in source code form is that same work.
-
-2. Basic Permissions.
-All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
-
-You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
-
-Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
-
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
-
-When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
-
-4. Conveying Verbatim Copies.
-You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
-
-You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
-
-5. Conveying Modified Source Versions.
-You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
-
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
-
-A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
-
-6. Conveying Non-Source Forms.
-You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
-
- d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
-
-A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
-
-A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
-
-“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
-
-If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
-
-The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
-
-Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
-
-7. Additional Terms.
-“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
-
-When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
-
-Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
-
-All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
-
-If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
-
-Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
-
-8. Termination.
-You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
-
-However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
-
-Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
-
-Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
-
-9. Acceptance Not Required for Having Copies.
-You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
-
-10. Automatic Licensing of Downstream Recipients.
-Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
-
-An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
-
-You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
-
-11. Patents.
-A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
-
-A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
-
-Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
-
-In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
-
-If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
-
-If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
-
-A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
-
-Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
-
-12. No Surrender of Others' Freedom.
-If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
-
-13. Use with the GNU Affero General Public License.
-Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
-
-14. Revised Versions of this License.
-The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
-
-If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
-
-Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
-
-15. Disclaimer of Warranty.
-THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. Limitation of Liability.
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-17. Interpretation of Sections 15 and 16.
-If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
-
-You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see .
-
-The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .
diff --git a/LICENSE-NOTICE.md b/LICENSE-NOTICE.md
new file mode 100644
index 0000000..10bc7b7
--- /dev/null
+++ b/LICENSE-NOTICE.md
@@ -0,0 +1,187 @@
+# License Notice
+
+This document explains the legal framework for the multi-component Conquer repository and how different licenses interact.
+
+## Repository Structure
+
+This repository follows the proven dual-licensing structure established in [conquerv5](https://github.com/vejeta/conquerv5):
+
+- **`gpl-release/`** - Clean GPL v3 distribution for modern development
+- **`original/`** - Complete historical preservation of original distribution
+- **`richard-caley-utilities/`** - Detailed documentation of Richard Caley's contributions
+- **Root level** - Licensing documentation and prominent attribution
+
+## Component Details
+
+### Core Game (GPL v3)
+- **Location**: `gpl-release/` folder
+- **License**: GNU General Public License v3.0+
+- **Authors**: Edward M. Barlow and Adam Bryant (original), Juan Manuel Méndez Rey (GPL coordination)
+- **Usage**: Free to use, modify, and distribute under GPL terms
+
+**Legal Basis**:
+- Explicit written permission obtained from both original authors
+- Relicensing process completed in 2025
+- All copyright holders have agreed to GPL terms
+
+**Rights Granted**:
+- ✅ Use for any purpose (including commercial)
+- ✅ Modify and create derivative works
+- ✅ Distribute original and modified versions
+- ✅ Charge fees for distribution
+- ✅ Private use and modification
+
+**Obligations**:
+- 📋 Provide source code with distribution
+- 📋 Preserve copyright notices
+- 📋 Include GPL license text
+- 📋 Document modifications
+- 📋 License derivatives under GPL
+
+### Richard Caley Map Utility (Custom License)
+- **Location**: `original/utilities/` folder (original code), `richard-caley-utilities/` folder (documentation)
+- **License**: Custom permissive license (see `richard-caley-utilities/LICENSE`)
+- **Author**: Richard Caley (deceased 2006)
+- **Usage**: Free to copy, distribute, and modify with restrictions (no charging, must include source)
+
+**Legal Basis**:
+- Original author's published license terms
+- Permissive license allows copying and modification
+- Used under original terms as published
+
+**Rights Granted**:
+- ✅ Copy and distribute
+- ✅ Modify ("do what you will")
+- ✅ Use for any non-commercial purpose
+- ✅ Create derivative works
+
+**Obligations**:
+- 📋 Preserve license notice in all copies
+- 📋 Distribute source code with program
+- ❌ Cannot charge money for the software
+
+**Restrictions**:
+- ❌ No commercial distribution (charging fees)
+- ❌ Cannot distribute without source code
+
+## License Interaction
+
+### Compatibility Analysis
+
+The two licenses are **NOT directly compatible** for code merging due to conflicting terms:
+
+- **GPL v3**: Permits charging fees (essential freedom)
+- **Caley License**: Prohibits charging fees (explicit restriction)
+
+### Safe Usage Patterns
+
+✅ **ALLOWED**:
+- Distribute both components in the same repository
+- Use both components in the same project
+- Document both components together
+- Link to both from the same website
+- Include both in the same documentation
+
+✅ **ALLOWED with care**:
+- Create wrapper scripts that use both (keep components separate)
+- Build systems that compile both (as separate executables)
+- Configuration that coordinates both (without code merging)
+
+❌ **NOT ALLOWED**:
+- Merge Caley code directly into GPL components
+- Include Caley code in GPL-licensed files
+- Create combined works under single license
+- Sublicense Caley code under GPL terms
+
+### Distribution Guidelines
+
+When distributing this software:
+
+1. **Preserve both license texts** in their respective locations (`gpl-release/LICENSE` and `richard-caley-utilities/LICENSE`)
+2. **Document the dual licensing** clearly (this document serves that purpose)
+3. **Separate the components** in distribution packages:
+ - `gpl-release/` contains clean GPL code
+ - `original/` preserves complete historical distribution
+ - `richard-caley-utilities/` provides documentation context
+4. **Inform users** about different terms for each component
+
+## Legal Precedents
+
+This approach follows established patterns:
+
+- **Debian**: Multi-license packages with clear component separation
+- **GNU/Linux**: Combines GPL and non-GPL components (kernel modules, firmware)
+- **Web browsers**: Bundle components under different licenses
+- **Academic software**: Preserves historical code with original licenses
+
+## Contribution Guidelines
+
+### For Core Game (GPL Components)
+
+- Submit contributions under GPL v3+ terms
+- Ensure new code is compatible with GPL
+- Follow GPL requirements for derivative works
+- Can freely modify and enhance
+
+### For Richard Caley Components
+
+- **Cannot accept contributions** to original code (author deceased)
+- Can document bugs or historical behavior
+- Can create separate derivative works under different licenses
+- Original code preserved as historical artifact
+
+## Future Considerations
+
+### Modern Ports
+
+Developers wishing to create modern versions of Richard Caley's map utility can:
+
+1. **Study the original** for reference (educational use)
+2. **Implement from scratch** under new license
+3. **Create inspired-by versions** under GPL or other licenses
+4. **Document historical techniques** for educational purposes
+
+### License Evolution
+
+- **Core Game**: Can be upgraded to future GPL versions
+- **Caley Code**: Frozen at original 1989 terms (cannot be changed)
+
+## Quick Reference
+
+| Component | Location | License | Can Charge? | Source Required? | Modifications OK? |
+|-----------|----------|---------|-------------|------------------|-------------------|
+| Core Game | `gpl-release/` | GPL v3 | ✅ Yes | ✅ Yes | ✅ Yes |
+| Map Utility | `original/utilities/` | Custom | ❌ No | ✅ Yes | ✅ Yes* |
+
+*Modifications to Richard Caley's code are permitted by his license but preserved historically in `original/`.
+
+## FAQ
+
+**Q: Can I charge for the complete package?**
+A: No, because it includes Richard Caley's component which prohibits charging.
+
+**Q: Can I charge for just the GPL component?**
+A: Yes, if distributed separately from the Caley component.
+
+**Q: Can I modify Richard Caley's code?**
+A: Yes, his license explicitly permits modification.
+
+**Q: Can I contribute improvements to Richard Caley's code?**
+A: No, we preserve it as a historical artifact in its original form.
+
+**Q: Are the licenses compatible for linking?**
+A: No, they cannot be directly linked into a single executable under unified terms.
+
+**Q: Can I create a GUI that uses both?**
+A: Yes, as long as you keep the components separate and respect both license terms.
+
+## Contact
+
+For legal questions about this licensing framework:
+- Create an issue in the GitHub repository
+- Consult with legal counsel for commercial use cases
+- Reference this document in license discussions
+
+---
+
+*This document provides guidance but is not legal advice. Consult qualified legal counsel for specific situations.*
diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt
index f6cdd22..f288702 100644
--- a/LICENSES/GPL-3.0-or-later.txt
+++ b/LICENSES/GPL-3.0-or-later.txt
@@ -1,232 +1,674 @@
-GNU GENERAL PUBLIC LICENSE
-Version 3, 29 June 2007
-
-Copyright © 2007 Free Software Foundation, Inc.
-
-Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The GNU General Public License is a free, copyleft license for software and other kinds of works.
-
-The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
-
-To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
-
-For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
-
-Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
-
-For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
-
-Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
-
-Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
-
-The precise terms and conditions for copying, distribution and modification follow.
-
-TERMS AND CONDITIONS
-
-0. Definitions.
-
-“This License” refers to version 3 of the GNU General Public License.
-
-“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
-
-“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
-
-To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
-
-A “covered work” means either the unmodified Program or a work based on the Program.
-
-To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
-
-To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
-
-An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
-
-1. Source Code.
-The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
-
-A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
-
-The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
-
-The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
-
-The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
-
-The Corresponding Source for a work in source code form is that same work.
-
-2. Basic Permissions.
-All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
-
-You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
-
-Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
-
-3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
-
-When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
-
-4. Conveying Verbatim Copies.
-You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
-
-You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
-
-5. Conveying Modified Source Versions.
-You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
-
- c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
-
-A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
-
-6. Conveying Non-Source Forms.
-You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
-
- d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
-
-A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
-
-A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
-
-“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
-
-If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
-
-The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
-
-Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
-
-7. Additional Terms.
-“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
-
-When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
-
-Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
-
-All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
-
-If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
-
-Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
-
-8. Termination.
-You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
-
-However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
-
-Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
-
-Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
-
-9. Acceptance Not Required for Having Copies.
-You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
-
-10. Automatic Licensing of Downstream Recipients.
-Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
-
-An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
-
-You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
-
-11. Patents.
-A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
-
-A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
-
-Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
-
-In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
-
-If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
-
-If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
-
-A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
-
-Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
-
-12. No Surrender of Others' Freedom.
-If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
-
-13. Use with the GNU Affero General Public License.
-Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
-
-14. Revised Versions of this License.
-The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
-
-If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
-
-Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
-
-15. Disclaimer of Warranty.
-THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-16. Limitation of Liability.
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-17. Interpretation of Sections 15 and 16.
-If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with this program. If not, see .
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
-If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
-
-You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see .
-
-The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read .
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/LICENSES/LicenseRef-Original-Restrictive.txt b/LICENSES/LicenseRef-Original-Restrictive.txt
new file mode 100644
index 0000000..08b7a6a
--- /dev/null
+++ b/LICENSES/LicenseRef-Original-Restrictive.txt
@@ -0,0 +1,45 @@
+Conquer Original License
+Copyright (c) 1988, 1989 by Ed Barlow.
+
+ MODIFICATION OF THIS FILE IMPLIES THAT THE MODIFIER WILL ACCEPT
+ A LIMITED USE COPYRIGHT AS FOLLOWS:
+
+
+ 1) This software is copyrighted and protected by law. The
+ sole owner of this software, which hereafter is known as
+ "conquer" is Edward M. Barlow, who hereby grants you a
+ personal, non-exclusive right to use this software.
+ All rights on this software are reserved.
+ 2) conquer may not be redistributed in any form. Any requests for
+ new software shall, for now, be the perogative of the author.
+ 3) loss or damage caused by this software shall not be
+ the responsibility of the author.
+ 4) Ed Barlow or Adam Bryant shall be notified of enhancements to this
+ software via electronic mail and, if there is no response, via
+ US mail to:
+
+ Ed Barlow
+ 115 E 34ths St.
+ NY, NY 10016
+
+ My home phone is 212-679-1439. Use it sparingly and call
+ before 11PM if it is important. Note that I no longer have
+ access to the arpanet and cant really support conquer like
+ I used to. If somebody knows of a cheap (free) way of getting
+ a login somewhere where there is network access - HELP ME!!!!
+ Since i am "volunteering" my time for this project, I am not
+ about to spend millions of dollars to buy network access...
+ I can get a modem for my PC if somebody will help me get
+ something to call into. -ED-
+ 5) no attempt shall be made to make any money from this game or to
+ use any portion of this code to make any money without the
+ authors permission.
+ 6) no attempt shall be made to port this software to any form of
+ personal computer without the permission of Ed Barlow.
+ 7) you agree to use your best efforts to see that any user
+ of conquer complies with the terms and conditions stated above.
+ 8) The above copyright agreement will not be tampered with in any form.
+
+
+ Special thanks to Brian Beuning, Adam Bryant, and any others who helped
+ me by making enhancements and bug reports
diff --git a/LICENSES/LicenseRef-Richard-Caley.txt b/LICENSES/LicenseRef-Richard-Caley.txt
new file mode 100644
index 0000000..67282ac
--- /dev/null
+++ b/LICENSES/LicenseRef-Richard-Caley.txt
@@ -0,0 +1,16 @@
+Richard Caley Map Drawing Utility License
+
+This program draws a map of the conquer world on a bitmap system
+
+Written by Richard Caley July 1989 and hacked extensively thereafter.
+
+You may copy, distribute, modify or do what you will with this code so long as
+this message remains in it and so long as you do not charge for it, nor
+distribute the program without the source.
+
+There is a horrid hack for getpass - to make this read the password from
+standard in one has to disconnect from the control terminal. GAG! It should
+be possible to disconnect just the conquer from the control terminal . . .
+someday.
+
+See Readme for more details.
diff --git a/README.md b/README.md
index 7e9512d..90518ea 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,20 @@
-[](https://www.gnu.org/licenses/gpl-3.0)
-[](./RELICENSING-PERMISSIONS.md)
-*********************************************************
-* README FILE FOR THE INSTALLER OF CONQUER *
-*********************************************************
+# Conquer - Classic Unix Strategy Game
-CONQUER - Classic Multi-Player Strategy Game
+**Conquer** is the classic multi-player strategy game originally created by Edward M. Barlow and Adam Bryant in the late 1980s. This repository preserves both the historical distribution and provides a modern GPL-licensed version for continued development.
-What you have here is a GPL v3 licensed version of the classic CONQUER game,
-originally created by Edward M. Barlow and Adam Bryant. This version has been
-relicensed to GPL v3 in 2025 by Juan Manuel Méndez Rey (Vejeta) with explicit
-permission from the original authors.
+## 🗺️ Special Recognition: Richard Caley's Map Utility
-LICENSING INFORMATION:
-======================
-- Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
-- Copyright (C) 2025 Juan Manuel Méndez Rey (Vejeta)
-- Licensed under GPL v3 with permission from original authors
+This repository includes a significant historical contribution: **Richard Caley's map drawing utility** from 1989. Richard Caley, a researcher at the University of Edinburgh's Centre for Speech Technology Research and contributor to the Festival Speech Synthesis System, created a bitmap visualization tool for Conquer game worlds.
-This program is free software: you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation, either version 3 of the License, or (at your option) any later
-version. See the COPYING file for the complete GPL v3 license text.
+His work represents an early example of game data visualization, created with the generous spirit typical of the late 1980s Unix computing community. Richard wrote: *"You may copy, distribute, modify or do what you will with this code"* - embodying the collaborative ethos that shaped early computer gaming.
+**📖 Learn more about Richard Caley's contributions**: See [`richard-caley-utilities/`](richard-caley-utilities/) for detailed biographical information, technical context, and links to his archived research and personal materials.
-### Relicensing Documentation
+*Richard Caley passed away in 2006. This code is preserved in his memory and as a testament to the early Unix gaming community's collaborative spirit.*
-This game has been successfully relicensed from its original restrictive license to GPL v3 through a **15-year effort** (2006-2025) with explicit written permission from all copyright holders:
+## Relicensing Achievement
-📄 **[Full Legal Documentation](./RELICENSING-PERMISSIONS.md)** - Complete email permissions with headers
-📄 **[Authors & Attribution](./AUTHORS.md)** - All contributors and their roles
-📄 **[Project History](./HISTORY.md)** - Timeline from 1987 USENET release to present
-📄 **[License Text](./COPYING)** - Full GPL v3 license
+This repository represents a successful **15-year relicensing effort** (2006-2025) that transformed Conquer from a restrictively licensed game into a modern GPL v3 project. All original copyright holders provided explicit written permission:
### Summary of Permissions
@@ -44,7 +28,7 @@ This game has been successfully relicensed from its original restrictive license
> *"Yes i delegated it all to adam aeons ago. Im easy on it all.... copyleft didnt exist when i wrote it and it was all for fun so..."* - Ed Barlow, 2016
-> *""Oh, that was a long time ago. But yes, that was me. And I have no problem with relicensing it to GPL."* - Martin Forssen, 2025
+> *"Oh, that was a long time ago. But yes, that was me. And I have no problem with relicensing it to GPL."* - Martin Forssen, 2025
### Legal Validation
@@ -54,207 +38,104 @@ This relicensing effort has been:
- ✅ Documented at [vejeta.com](http://vejeta.com/historia-del-conquer/)
- ✅ Preserved with complete email headers for authentication
-### What This Means For You
+📄 **Complete legal documentation**: See [`gpl-release/RELICENSING-PERMISSIONS.md`](gpl-release/RELICENSING-PERMISSIONS.md) for full email permissions with headers.
-- ✅ **Free to use, modify, and distribute** under GPL v3 terms
-- ✅ **No legal concerns** - all permissions properly obtained
-- ✅ **Contribute with confidence** - clear legal foundation
-- ✅ **Fork freely** - create your own versions under GPL v3
+## Repository Structure
-For questions about the relicensing process: vejeta@gmail.com
+This repository uses a dual-licensing approach to balance historical preservation with modern development:
----
+### 🚀 For Modern Development
+- **[`gpl-release/`](gpl-release/)** - Clean GPL v3 licensed distribution
+ - Free to use, modify, and distribute commercially
+ - Relicensed with explicit permission from all original authors
+ - Recommended for new projects and contributions
+
+### 📚 For Historical Research
+- **[`original/`](original/)** - Complete original distribution preserved
+ - Original restrictive licensing (personal use only)
+ - Includes Richard Caley's map utility in `original/utilities/`
+ - Historical accuracy for researchers and gaming archaeologists
+
+### 🎯 Documentation & Attribution
+- **[`richard-caley-utilities/`](richard-caley-utilities/)** - Detailed documentation of Richard Caley's contributions
+- **[`LICENSES/`](LICENSES/)** - All license texts for REUSE compliance
+- **[`LICENSE-NOTICE.md`](LICENSE-NOTICE.md)** - Comprehensive licensing framework explanation
+
+## Quick Start
+
+### Playing the Game
+Use the modern GPL version for the best experience:
+
+```bash
+cd gpl-release/
+# See gpl-release/README.md for complete build and setup instructions
+```
+### Historical Research
+Explore the original distribution exactly as it was shared in the late 1980s:
-HISTORICAL NOTE:
-================
-This is based on the original release 4 version of CONQUER. The original
-authors made no guarantees to the sanity or style of this code, but believed
-that it should work as documented. It included numerous bugfixes from previous
-releases and various enhancements.
-
-The original development team included Edward M. Barlow and Adam Bryant, who
-set up mailing lists and provided community support in the late 1980s. Their
-innovative work created one of the early multi-player strategy games that
-influenced many later games in the genre.
-
-CURRENT STATUS:
-===============
-This version maintains the original gameplay and functionality while being
-made available under modern open-source licensing terms. Bug reports, feature
-requests, and contributions are welcome through the project's repository.
-
-INCLUDED IN THIS DISTRIBUTION:
-===============================
- 1) A Brief Description of Conquer
- 2) Installation (unpacking) Instructions
- 3) Configuration Instructions
- 4) Compilation Instructions
- 5) Administration instructions
- 6) GPL v3 License Information
-
------------------------------------------------------------
-I A Brief Description of Conquer
------------------------------------------------------------
-A complete description of Conquer v4 is contained in "man.pag" and can be
-generated in "conquer.docs". The game is a multi-player strategy simulation
-where players control nations, managing resources, armies, diplomacy, and
-territorial expansion.
-
-Key features include:
-- Multi-player strategy gameplay
-- Resource management (food, gold, metal, jewels)
-- Military units and naval fleets
-- Magic system and special powers
-- Diplomatic relations between nations
+```bash
+cd original/
+# See original README and build instructions for historical reference
+```
+
+## About Conquer
+
+Conquer is a turn-based strategy game where players control nations in a fantasy world, managing resources, armies, diplomacy, and territorial expansion. Key features include:
+
+- Multi-player strategy gameplay with up to 50+ nations
+- Resource management (food, gold, metal, jewels)
+- Military units, naval fleets, and siege warfare
+- Magic system with spells and artifacts
+- Diplomatic relations and trade between nations
- NPC nations with AI behavior
-- Random events and world dynamics
+- Random events and dynamic world systems
- Customizable world generation
-The documentation files txt[0-5] contain help information that is customized
-from data in the header files and converted to help[0-5] files during
-compilation. "make docs" will create documentation from current data.
-
------------------------------------------------------------
-II Installation Instructions
------------------------------------------------------------
-SYSTEM REQUIREMENTS:
-- Unix-like operating system (Linux, BSD, macOS)
-- C compiler (gcc recommended)
-- make utility
-- curses library (ncurses)
-- Standard Unix utilities
-
-COMPILATION:
-1. Extract the source code to a directory
-2. Review and modify configuration files (see Configuration section)
-3. Compile: `make`
-4. Install and set up new game: `make new_game`
-
-If curses linking fails, you may need to add "-ltermcap" or "-lncurses"
-to the library flags in the Makefile.
-
------------------------------------------------------------
-III Configuration
------------------------------------------------------------
-THE FOLLOWING FILES SHOULD BE MODIFIED TO REFLECT YOUR ENVIRONMENT
-AND THE TYPE OF GAME YOU WISH TO PLAY:
-
-REQUIRED MODIFICATIONS:
-- header.h: Game configuration constants and settings
-- Makefile: Build configuration and paths
-
-OPTIONAL MODIFICATIONS:
-- rules: Grammar rules for NPC message generation
-- nations: NPC nation configurations for world creation
-
-The options specified in these files will be reflected in the documentation
-and help files when the program is compiled.
-
-IMPORTANT: Edit the following defines in header.h:
-- OWNER: Administrator name
-- LOGIN: Administrator login ID
-- Directory paths for game data and executables
-- System-specific settings (BSD vs SYSV)
-
-The "rules" file contains grammar rules for random messages generated by
-NPCs. You may customize this with local names or creative content following
-the format: %CLASS declares a class, with %MAIN being the top level.
-
------------------------------------------------------------
-IV Compilation Instructions
------------------------------------------------------------
-After configuring header.h and Makefile:
-
-Basic compilation:
- make # Compile the game
- make clean # Clean up object files
- make clobber # Remove all generated files
-
-Game setup:
- make new_game # Build and install a complete new game
- make install # Install executables only
- make docs # Generate documentation
-
-TROUBLESHOOTING:
-- If linking fails with curses errors, add "-ltermcap" to LIBRARIES in Makefile
-- If make gives "command not found" errors, try: setenv SHELL /bin/sh
-- Ensure all directory paths in header.h exist and are writable
-
------------------------------------------------------------
-V Administration Instructions
------------------------------------------------------------
-COMMAND LINE ADMINISTRATION:
-
-conqrun options:
- -m Create/make a new world
- -a Add new player to existing world
- -x Execute update (process turn)
- -d DIR Use specified game directory
- -r SCENARIO Read map from scenario files during world creation
-
-GAME ADMINISTRATION LEVELS:
-1. God: Primary administrator (defined by LOGIN in header.h)
-2. Demi-God: World-specific administrator (can be changed during game)
-
-During world creation, you'll be prompted to designate a demi-god for the
-world, or you can serve as demi-god yourself.
-
-SETUP PROCEDURE:
-1. Create world: `conqrun -m`
- - Sets up the game world and NPC nations per the nations file
- - NPCs use the same password as god initially
-
-2. Add players: `conqrun -a`
- - Interactive player addition
- - Won't work if world is full from scenario loading
-
-3. Alternative - Scenario-based: `conqrun -r SCENARIO`
- - Uses SCENARIO.ele, SCENARIO.veg, and SCENARIO.ntn files
- - Pre-configured world setup
-
-GOD FUNCTIONS:
-Access god functions by logging in with: `conquer -n god`
-- Modify terrain and sectors
-- Manage nations (create/destroy)
-- Adjust game balance
-- Administrative oversight
-
-GAME BALANCE:
-The world generation is not perfectly balanced. Some players may start in
-difficult positions. As god, you can:
-- Redesignate terrain to improve starting positions
-- Destroy and recreate nations in better locations
-- Modify surrounding terrain for fairness
-- Use the change nation command to adjust player situations
-
-REGULAR OPERATION:
-- Players connect: `conquer`
-- Process turns: `conqrun -x` (typically automated via cron)
-- Monitor via god login for administrative needs
-
-AUTOMATED UPDATES:
-Use the included "run" script as a template for automated turn processing.
-Modify it for your preferred update schedule and system configuration.
-
-For detailed gameplay help, use the '?' command within the game.
-
------------------------------------------------------------
-VI Contributing and Support
------------------------------------------------------------
-This open-source version welcomes contributions:
+## Contributors & History
+
+- **Edward M. Barlow** (1987-1988) - Original creator and core engine
+- **Adam Bryant** (1987-1988) - Co-author, maintainer, and enhancements
+- **Richard Caley** (1989) - Map drawing utility for world visualization
+- **Martin Forssen** (1989) - PostScript utilities and enhancements
+- **Juan Manuel Méndez Rey** (2006-2025) - Historical preservation and GPL relicensing coordination
+
+## Licensing
+
+This repository contains software under multiple licenses:
+
+| Component | Location | License | Commercial Use |
+|-----------|----------|---------|----------------|
+| **Modern Game** | `gpl-release/` | GPL v3+ | ✅ Allowed |
+| **Original Distribution** | `original/` | Restrictive | ❌ Personal use only |
+| **Richard Caley Utility** | `original/utilities/` | Custom permissive | ❌ No charging allowed |
+
+**📋 See [`LICENSE-NOTICE.md`](LICENSE-NOTICE.md)** for complete licensing details and legal framework.
+
+## Contributing
+
+Contributions are welcome for the GPL-licensed components in [`gpl-release/`](gpl-release/):
+
- Bug reports and fixes
-- Feature enhancements
+- Feature enhancements
- Documentation improvements
-- Platform compatibility updates
+- Modern platform support
- Translation efforts
-Please maintain the spirit of the original game while modernizing the codebase
-for current systems and development practices.
+Please maintain the spirit of the original game while modernizing for current systems.
+
+## Historical Significance
+
+This preservation effort maintains one of the early examples of:
+- Unix-based multiplayer gaming (1987-1988)
+- Community-driven game development via USENET
+- Early game world visualization tools (Richard Caley's work)
+- Collaborative open-source game development principles
+
+The generous code-sharing philosophy of contributors like Richard Caley helped establish the collaborative culture that continues in modern open-source gaming.
+
+---
-The original creators, Edward M. Barlow and Adam Bryant, laid the foundation
-for this classic strategy game. This GPL v3 version ensures it remains
-available for future generations of strategy game enthusiasts.
+**🎮 Ready to conquer?** Start with [`gpl-release/`](gpl-release/) for the modern experience, or explore [`original/`](original/) for historical gaming archaeology.
------------------------------------------------------------
-For more information, see the man page (man.pag) and in-game help system.
+**📖 Learn about the people behind the code:** Visit [`richard-caley-utilities/`](richard-caley-utilities/) to discover the fascinating individuals who created this classic game.
\ No newline at end of file
diff --git a/REUSE.toml b/REUSE.toml
index 9153e74..36e87e4 100644
--- a/REUSE.toml
+++ b/REUSE.toml
@@ -16,3 +16,63 @@ precedence = "aggregate"
SPDX-FileCopyrightText = ["1987-1989 Original Authors (see headers)", "2006-2025 Juan Manuel Méndez Rey "]
SPDX-License-Identifier = "GPL-3.0-or-later"
SPDX-FileComment = "Fallback rule for all other files not covered above."
+version = 1
+SPDX-PackageName = "conquer"
+SPDX-PackageSupplier = "Juan Manuel Méndez Rey "
+SPDX-PackageDownloadLocation = "https://github.com/vejeta/conquer"
+
+# Richard Caley's specific contribution (highest precedence)
+[[annotations]]
+path = ["original/utilities/xconqrast.h"]
+precedence = "override"
+SPDX-FileCopyrightText = "1989 Richard Caley "
+SPDX-License-Identifier = "LicenseRef-Richard-Caley"
+SPDX-FileComment = "Map drawing utility for Conquer worlds. Written by Richard Caley July 1989. Original permissive license allows copying, distribution, and modification but prohibits charging fees."
+
+# GPL release folder - clean modern distribution
+[[annotations]]
+path = ["gpl-release/**"]
+precedence = "aggregate"
+SPDX-FileCopyrightText = ["1987-1988 Ed Barlow ", "1987-1988 Adam Bryant ", "2006-2025 Juan Manuel Méndez Rey "]
+SPDX-License-Identifier = "GPL-3.0-or-later"
+SPDX-FileComment = "Core Conquer game - relicensed to GPL with explicit permission from all original authors. Ed Barlow: Original creator, core engine. Adam Bryant: Co-author, maintainer. Juan Manuel Méndez Rey: Relicensing coordinator and current maintainer."
+
+# Original folder - preserves historical restrictive licensing (except Richard Caley's file)
+[[annotations]]
+path = ["original/**.c", "original/**.h"]
+precedence = "aggregate"
+SPDX-FileCopyrightText = ["1987-1988 Ed Barlow ", "1987-1988 Adam Bryant "]
+SPDX-License-Identifier = "LicenseRef-Original-Restrictive"
+SPDX-FileComment = "Original Conquer distribution preserved with historical restrictive licensing. Cannot be redistributed without author permission. Relicensed version available in gpl-release/ folder."
+
+# Original folder non-source files
+[[annotations]]
+path = ["original/**"]
+precedence = "aggregate"
+SPDX-FileCopyrightText = ["1987-1988 Ed Barlow ", "1987-1988 Adam Bryant "]
+SPDX-License-Identifier = "LicenseRef-Original-Restrictive"
+SPDX-FileComment = "Original Conquer distribution preserved with historical restrictive licensing."
+
+# Richard Caley utilities documentation folder
+[[annotations]]
+path = ["richard-caley-utilities/**"]
+precedence = "aggregate"
+SPDX-FileCopyrightText = "2025 Juan Manuel Méndez Rey "
+SPDX-License-Identifier = "CC0-1.0"
+SPDX-FileComment = "Documentation and preservation materials for Richard Caley's contributions. Released as public domain documentation."
+
+# Root level documentation and build files
+[[annotations]]
+path = ["README.md", "LICENSE-NOTICE.md", "Makefile*", "*.toml"]
+precedence = "aggregate"
+SPDX-FileCopyrightText = "2006-2025 Juan Manuel Méndez Rey "
+SPDX-License-Identifier = "CC0-1.0"
+SPDX-FileComment = "Repository documentation, build configuration, and licensing framework."
+
+# Fallback rule for any remaining files
+[[annotations]]
+path = "**"
+precedence = "aggregate"
+SPDX-FileCopyrightText = ["1987-1989 Original Authors (see specific file headers)", "2006-2025 Juan Manuel Méndez Rey "]
+SPDX-License-Identifier = "LicenseRef-Original-Restrictive"
+SPDX-FileComment = "Fallback rule - preserves original restrictive licensing unless explicitly overridden. See LICENSE-NOTICE.md for detailed licensing framework."
diff --git a/.indent.pro b/gpl-release/.indent.pro
similarity index 100%
rename from .indent.pro
rename to gpl-release/.indent.pro
diff --git a/AUTHORS.md b/gpl-release/AUTHORS.md
similarity index 100%
rename from AUTHORS.md
rename to gpl-release/AUTHORS.md
diff --git a/CONQPS.INFO b/gpl-release/CONQPS.INFO
similarity index 100%
rename from CONQPS.INFO
rename to gpl-release/CONQPS.INFO
diff --git a/gpl-release/COPYING b/gpl-release/COPYING
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/gpl-release/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/HISTORY.md b/gpl-release/HISTORY.md
similarity index 100%
rename from HISTORY.md
rename to gpl-release/HISTORY.md
diff --git a/LICENSE.md b/gpl-release/LICENSE.md
similarity index 100%
rename from LICENSE.md
rename to gpl-release/LICENSE.md
diff --git a/MANIFEST b/gpl-release/MANIFEST
similarity index 100%
rename from MANIFEST
rename to gpl-release/MANIFEST
diff --git a/Makefile b/gpl-release/Makefile
similarity index 100%
rename from Makefile
rename to gpl-release/Makefile
diff --git a/gpl-release/Makefile.orig b/gpl-release/Makefile.orig
new file mode 100644
index 0000000..e400fcd
--- /dev/null
+++ b/gpl-release/Makefile.orig
@@ -0,0 +1,361 @@
+#
+# Makefile - Build configuration and compilation rules
+#
+# This file is part of Conquer.
+# Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+# Copyright (C) 2025 Juan Manuel Méndez Rey (Vejeta) - Licensed under GPL v3 with permission from original authors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+MAKE = /usr/bin/make
+CC = /usr/bin/gcc
+RM = /bin/rm -f
+
+# LN must be "ln -s" if source and default directories span disks
+LN = /bin/ln
+CP = /bin/cp
+NULL = 2>/dev/null
+
+# Flags to lint
+LTFLG = -h -lcurses
+
+# Options for the postscript map printing program.
+# The file 'conqps.ps' will be installed in the EXEDIR
+# directory which is determined below.
+#
+# To avoid building this program, remove $(PSPROG) from
+# both the 'all:' list and the 'install:' list
+PSPROG = conqps
+PSSRC = psmap.c
+PSHEAD = psmap.h
+PSDATA = psmap.ps
+# Default Pagesize Setting:
+# A4 for European page size.
+# LETTER for American page size.
+# OTHER for Local page size. [edit conqps.h]
+PSPAGE = LETTER
+
+# Options for shar program, SHARLIM is limit of each shar
+# file created in kilobytes and SHARNAM is the prefix for
+# SHARFILE name.
+# [This is for a public domain shar from USENET, I can send
+# copies if you wish - adb@bu-cs.bu.edu]
+SHAR = /usr/bin/shar
+SHARLIM = 50
+SHARNAM = shar.
+SHARFLG = -D -c -l$(SHARLIM) -o$(SHARNAM)
+
+# This should be installed by whomever you want to own the game.
+# I recommend "games" or "root".
+
+# uncomment the next line if you dont have getopt in your library
+# (eg you are on a pc, or a non unix system). getopt.c is a
+# public domain software, and has not been tested by the authors
+# of conquer. [not distributed with conquer V4]
+#GETOPT = getopt.o
+
+#
+# libraries for BSD systems:
+LIBRARIES = -lcurses -ltermcap -lcrypt
+#
+# libraries for SYSV systems:
+#LIBRARIES = -lcurses
+#
+# libraries for Xenix systems:
+#LIBRARIES = -ltermlib -ltcap -lcrypt
+
+# CURRENT is this directory. The directory where the source
+# and Makefile are located
+CURRENT = /home/conquer/src
+
+# DEFAULT is the directory where default nations & help files will be
+# stored. It is also the default directory = where players will play
+# if they do not use the -d option.
+DEFAULT = /home/conquer/lib
+
+# This directory is where the executables will be stored
+EXEDIR = /home/conquer/bin
+
+# Definitions used for compiling conquer
+CDEFS = -DDEFAULTDIR=\"$(DEFAULT)\" -DEXEDIR=\"$(EXEDIR)\"
+
+# Options flag used for normal compilation
+OPTFLG = -O
+
+# Options flag used for debugging purposes
+# [make sure to comment out 'strip' commands in install section]
+#OPTFLG = -DDEBUG -g
+
+# this is the name of the user executable
+# the user executable contains commands for the games players
+GAME = conquer
+# this is the name of the administrative executable
+# the administrative executable contains commands for the game super user
+ADMIN = conqrun
+# this is the name of the sorting program which conquer uses
+SORT = conqsort
+
+# GAME IDENTIFICATION
+#
+# Set this to some unique identifier for each game you wish
+# to create via 'make new_game'. It will make a subdirectory
+# $(GAMEID) to the DEFAULT data directory where it will store
+# data for the new game. [Leave it blank to create the default
+# game]
+GAMEID =
+
+# AFILS are files needed for game updating...
+AFILS = combat.c cexecute.c io.c admin.c makeworl.c navy.c spew.c \
+newlogin.c update.c magic.c npc.c misc.c randeven.c data.c trade.c check.c
+AOBJS = combat.o cexecuteA.o ioA.o admin.o makeworl.o navyA.o spew.o \
+newlogin.o update.o magicA.o npc.o miscA.o randeven.o dataA.o \
+tradeA.o $(GETOPT) check.o
+
+# GFILS are files needed to run a normal interactive game
+GFILS = commands.c cexecute.c forms.c io.c main.c move.c navy.c \
+magic.c misc.c reports.c data.c display.c extcmds.c trade.c check.c
+GOBJS = commands.o cexecuteG.o forms.o ioG.o main.o move.o navyG.o \
+magicG.o miscG.o reports.o dataG.o display.o extcmds.o tradeG.o \
+$(GETOPT) check.o
+
+# List of temporary C files
+DAFILS = cexecuteA.c ioA.c miscA.c navyA.c magicA.c dataA.c tradeA.c
+DGFILS = cexecuteG.c ioG.c miscG.c navyG.c magicG.c dataG.c tradeG.c
+
+#txt[0-4] are input help files. help[0-4] are output. HELPSCR is sed script.
+HELP=txt
+HELPOUT=help
+HELPSCR=sed
+
+HEADERS=header.h data.h newlogin.h patchlevel.h
+SUPT1=nations Makefile $(HELP)[0-5] README run man.pag rules
+SUPT2=execute messages news commerce CONQPS.INFO
+ALLFILS=$(SUPT1) $(HEADERS) $(AFILS) commands.c forms.c main.c move.c \
+reports.c display.c extcmds.c newhelp.c sort.c getopt.c \
+$(PSSRC) $(PSHEAD) $(PSDATA)
+
+all: $(ADMIN) $(GAME) $(SORT) $(PSPROG) helpfile
+ @echo YAY! make new_game to set up permissions, zero appropriate
+ @echo initial files, move $(GAME) and $(ADMIN) to
+ @echo $(EXEDIR), and set up the world.
+ @echo If a game is in progress, make install will just move $(GAME)
+ @echo and $(ADMIN) to $(EXEDIR).
+ @echo
+
+$(ADMIN): $(AOBJS)
+ @echo phew...
+ -$(RM) $(DAFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling administrative functions
+ $(CC) $(OPTFLG) -o $(ADMIN) $(AOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(ADMIN)
+
+$(GAME): $(GOBJS)
+ @echo phew...
+ -$(RM) $(DGFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling user interface
+ $(CC) $(OPTFLG) -o $(GAME) $(GOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(GAME)
+
+$(SORT): sort.c
+ $(CC) $(OPTFLG) -o $(SORT) sort.c
+# comment out the next line if debugging
+ strip $(SORT)
+
+clobber:
+ -$(RM) *.o $(HELPOUT)[0-5] $(PSPROG) $(SORT) insthelp helpfile $(NULL)
+ -$(RM) newhelp in$(GAME) in$(SORT) in$(ADMIN) in$(PSPROG) $(NULL)
+ -$(RM) $(HELPSCR).[12] lint[ag] conquer.doc $(GAME) $(ADMIN) $(NULL)
+
+clean:
+ $(RM) *.o lint[ag] conquer.doc $(NULL)
+
+in$(GAME): $(GAME)
+ -$(RM) $(EXEDIR)/$(GAME)
+ mv $(GAME) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(GAME)
+ touch $(GAME)
+ touch in$(GAME)
+
+in$(ADMIN): $(ADMIN)
+ -$(RM) $(EXEDIR)/$(ADMIN)
+ mv $(ADMIN) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(ADMIN)
+ touch $(ADMIN)
+ touch in$(ADMIN)
+
+in$(SORT): $(SORT)
+ -$(RM) $(EXEDIR)/$(SORT)
+ mv $(SORT) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(SORT)
+ touch $(SORT)
+ touch in$(SORT)
+
+in$(PSPROG): $(PSPROG)
+ -$(RM) $(EXEDIR)/$(PSPROG)
+ mv $(PSPROG) $(EXEDIR)
+ $(CP) $(PSDATA) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(PSPROG)
+ chmod 644 $(EXEDIR)/$(PSDATA)
+ touch $(PSPROG)
+ touch in$(PSPROG)
+
+install: in$(GAME) in$(ADMIN) in$(SORT) in$(PSPROG) insthelp instman
+ @echo ""
+ @echo "Installation complete"
+
+new_game: all insthelp
+ @echo Installing new game
+ -mkdir $(EXEDIR) $(NULL)
+ -mkdir $(DEFAULT) $(NULL)
+ -mkdir $(DEFAULT)/$(GAMEID) $(NULL)
+ chmod 755 $(EXEDIR)
+ chmod 750 $(DEFAULT)/$(GAMEID) $(DEFAULT)
+ $(CP) $(GAME) $(ADMIN) $(SORT) $(PSPROG) $(PSDATA) $(EXEDIR)
+ chmod 4755 $(EXEDIR)/$(GAME) $(EXEDIR)/$(ADMIN)
+ chmod 0755 $(EXEDIR)/$(SORT) $(EXEDIR)/$(PSPROG)
+ chmod 0644 $(EXEDIR)/$(PSDATA)
+ chmod 0600 nations
+ chmod 0700 run
+ $(CP) nations rules $(DEFAULT)/$(GAMEID)
+ $(CP) nations rules $(DEFAULT)
+ @echo now making the world
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -m
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -a
+
+insthelp: helpfile
+ @echo Installing helpfiles
+ -$(RM) $(DEFAULT)/$(HELPOUT)0
+ -$(LN) $(CURRENT)/$(HELPOUT)0 $(DEFAULT)/$(HELPOUT)0
+ -$(RM) $(DEFAULT)/$(HELPOUT)1
+ -$(LN) $(CURRENT)/$(HELPOUT)1 $(DEFAULT)/$(HELPOUT)1
+ -$(RM) $(DEFAULT)/$(HELPOUT)2
+ -$(LN) $(CURRENT)/$(HELPOUT)2 $(DEFAULT)/$(HELPOUT)2
+ -$(RM) $(DEFAULT)/$(HELPOUT)3
+ -$(LN) $(CURRENT)/$(HELPOUT)3 $(DEFAULT)/$(HELPOUT)3
+ -$(RM) $(DEFAULT)/$(HELPOUT)4
+ -$(LN) $(CURRENT)/$(HELPOUT)4 $(DEFAULT)/$(HELPOUT)4
+ -$(RM) $(DEFAULT)/$(HELPOUT)5
+ -$(LN) $(CURRENT)/$(HELPOUT)5 $(DEFAULT)/$(HELPOUT)5
+ touch insthelp
+
+instman:
+ @echo Installing man pages
+ $(CP) man.pag $(EXEDIR)
+
+helpfile: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ @echo Helpfiles built
+ touch helpfile
+
+$(HELPOUT)0: $(HELP)0 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)0
+ cat $(HELP)0 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)0
+
+$(HELPOUT)1: $(HELP)1 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)1
+ cat $(HELP)1 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)1
+
+$(HELPOUT)2: $(HELP)2 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)2
+ cat $(HELP)2 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)2
+
+$(HELPOUT)3: $(HELP)3 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)3
+ cat $(HELP)3 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)3
+
+$(HELPOUT)4: $(HELP)4 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)4
+ cat $(HELP)4 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)4
+
+$(HELPOUT)5: $(HELP)5 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)5
+ cat $(HELP)5 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)5
+
+$(HELPSCR).1: newhelp
+ newhelp
+
+$(HELPSCR).2: newhelp
+ newhelp
+
+newhelp: dataG.o newhelp.o
+ $(CC) $(OPTFLG) dataG.o newhelp.o -o newhelp
+ strip newhelp
+#
+# postscript map program
+PSOPTS = -DPSFILE=\"$(EXEDIR)/$(PSDATA)\" -D$(PSPAGE)
+#
+$(PSPROG): $(PSSRC) $(PSDATA) $(PSHEAD)
+ $(CC) $(OPTFLG) $(PSOPTS) $(PSSRC) -o $(PSPROG)
+# comment out the next line if debugging
+ strip $(PSPROG)
+
+lint:
+ lint $(LTFLG) $(CDEFS) -DCONQUER $(GFILS) > lintg
+ lint $(LTFLG) $(CDEFS) -DADMIN $(AFILS) > linta
+
+docs: conquer.doc
+
+conquer.doc: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ cat $(HELPOUT)? |sed -e "s/^DONE//g"|sed -e "s/^END//g" >conquer.doc
+
+cpio:
+ -$(RM) core
+ find . -name '*[CrpsEech]' -print | cpio -ocBv > cpiosv
+
+shar:
+ echo " lines words chars FILENAME" > MANIFEST
+ wc $(ALLFILS) >> MANIFEST
+ $(SHAR) $(SHARFLG) $(ALLFILS) MANIFEST
+
+.cA.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*A.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -c $*A.c ;\
+ $(RM) $*A.c )
+
+.cG.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*G.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DCONQUER -c $*G.c ;\
+ $(RM) $*G.c )
+
+.c.o: $<
+# compiles using both defines since they
+# are needed for the data.h definitions for
+# each file... but should not be needed for
+# the actual C source file being compiled
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -DCONQUER -c $*.c
+
+$(GOBJS): data.h header.h
+
+$(AOBJS): data.h header.h
+
+ioG.o: data.h header.h patchlevel.h io.c
+
+ioA.o: data.h header.h patchlevel.h io.c
+
+newlogin.o: data.h header.h newlogin.h patchlevel.h newlogin.c
+
+main.o: data.h header.h patchlevel.h main.c
+
+newhelp.o: data.h header.h patchlevel.h newhelp.c
+
+# Clear suffixes
+# Commented out for problems with newer versions of make
+#.SUFFIXES:
+
+# Suffixes for conquer files.
+#.SUFFIXES: .c .o .cA.o .cG.o A.o G.o
diff --git a/gpl-release/Makefile.txt b/gpl-release/Makefile.txt
new file mode 100644
index 0000000..e400fcd
--- /dev/null
+++ b/gpl-release/Makefile.txt
@@ -0,0 +1,361 @@
+#
+# Makefile - Build configuration and compilation rules
+#
+# This file is part of Conquer.
+# Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+# Copyright (C) 2025 Juan Manuel Méndez Rey (Vejeta) - Licensed under GPL v3 with permission from original authors
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+MAKE = /usr/bin/make
+CC = /usr/bin/gcc
+RM = /bin/rm -f
+
+# LN must be "ln -s" if source and default directories span disks
+LN = /bin/ln
+CP = /bin/cp
+NULL = 2>/dev/null
+
+# Flags to lint
+LTFLG = -h -lcurses
+
+# Options for the postscript map printing program.
+# The file 'conqps.ps' will be installed in the EXEDIR
+# directory which is determined below.
+#
+# To avoid building this program, remove $(PSPROG) from
+# both the 'all:' list and the 'install:' list
+PSPROG = conqps
+PSSRC = psmap.c
+PSHEAD = psmap.h
+PSDATA = psmap.ps
+# Default Pagesize Setting:
+# A4 for European page size.
+# LETTER for American page size.
+# OTHER for Local page size. [edit conqps.h]
+PSPAGE = LETTER
+
+# Options for shar program, SHARLIM is limit of each shar
+# file created in kilobytes and SHARNAM is the prefix for
+# SHARFILE name.
+# [This is for a public domain shar from USENET, I can send
+# copies if you wish - adb@bu-cs.bu.edu]
+SHAR = /usr/bin/shar
+SHARLIM = 50
+SHARNAM = shar.
+SHARFLG = -D -c -l$(SHARLIM) -o$(SHARNAM)
+
+# This should be installed by whomever you want to own the game.
+# I recommend "games" or "root".
+
+# uncomment the next line if you dont have getopt in your library
+# (eg you are on a pc, or a non unix system). getopt.c is a
+# public domain software, and has not been tested by the authors
+# of conquer. [not distributed with conquer V4]
+#GETOPT = getopt.o
+
+#
+# libraries for BSD systems:
+LIBRARIES = -lcurses -ltermcap -lcrypt
+#
+# libraries for SYSV systems:
+#LIBRARIES = -lcurses
+#
+# libraries for Xenix systems:
+#LIBRARIES = -ltermlib -ltcap -lcrypt
+
+# CURRENT is this directory. The directory where the source
+# and Makefile are located
+CURRENT = /home/conquer/src
+
+# DEFAULT is the directory where default nations & help files will be
+# stored. It is also the default directory = where players will play
+# if they do not use the -d option.
+DEFAULT = /home/conquer/lib
+
+# This directory is where the executables will be stored
+EXEDIR = /home/conquer/bin
+
+# Definitions used for compiling conquer
+CDEFS = -DDEFAULTDIR=\"$(DEFAULT)\" -DEXEDIR=\"$(EXEDIR)\"
+
+# Options flag used for normal compilation
+OPTFLG = -O
+
+# Options flag used for debugging purposes
+# [make sure to comment out 'strip' commands in install section]
+#OPTFLG = -DDEBUG -g
+
+# this is the name of the user executable
+# the user executable contains commands for the games players
+GAME = conquer
+# this is the name of the administrative executable
+# the administrative executable contains commands for the game super user
+ADMIN = conqrun
+# this is the name of the sorting program which conquer uses
+SORT = conqsort
+
+# GAME IDENTIFICATION
+#
+# Set this to some unique identifier for each game you wish
+# to create via 'make new_game'. It will make a subdirectory
+# $(GAMEID) to the DEFAULT data directory where it will store
+# data for the new game. [Leave it blank to create the default
+# game]
+GAMEID =
+
+# AFILS are files needed for game updating...
+AFILS = combat.c cexecute.c io.c admin.c makeworl.c navy.c spew.c \
+newlogin.c update.c magic.c npc.c misc.c randeven.c data.c trade.c check.c
+AOBJS = combat.o cexecuteA.o ioA.o admin.o makeworl.o navyA.o spew.o \
+newlogin.o update.o magicA.o npc.o miscA.o randeven.o dataA.o \
+tradeA.o $(GETOPT) check.o
+
+# GFILS are files needed to run a normal interactive game
+GFILS = commands.c cexecute.c forms.c io.c main.c move.c navy.c \
+magic.c misc.c reports.c data.c display.c extcmds.c trade.c check.c
+GOBJS = commands.o cexecuteG.o forms.o ioG.o main.o move.o navyG.o \
+magicG.o miscG.o reports.o dataG.o display.o extcmds.o tradeG.o \
+$(GETOPT) check.o
+
+# List of temporary C files
+DAFILS = cexecuteA.c ioA.c miscA.c navyA.c magicA.c dataA.c tradeA.c
+DGFILS = cexecuteG.c ioG.c miscG.c navyG.c magicG.c dataG.c tradeG.c
+
+#txt[0-4] are input help files. help[0-4] are output. HELPSCR is sed script.
+HELP=txt
+HELPOUT=help
+HELPSCR=sed
+
+HEADERS=header.h data.h newlogin.h patchlevel.h
+SUPT1=nations Makefile $(HELP)[0-5] README run man.pag rules
+SUPT2=execute messages news commerce CONQPS.INFO
+ALLFILS=$(SUPT1) $(HEADERS) $(AFILS) commands.c forms.c main.c move.c \
+reports.c display.c extcmds.c newhelp.c sort.c getopt.c \
+$(PSSRC) $(PSHEAD) $(PSDATA)
+
+all: $(ADMIN) $(GAME) $(SORT) $(PSPROG) helpfile
+ @echo YAY! make new_game to set up permissions, zero appropriate
+ @echo initial files, move $(GAME) and $(ADMIN) to
+ @echo $(EXEDIR), and set up the world.
+ @echo If a game is in progress, make install will just move $(GAME)
+ @echo and $(ADMIN) to $(EXEDIR).
+ @echo
+
+$(ADMIN): $(AOBJS)
+ @echo phew...
+ -$(RM) $(DAFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling administrative functions
+ $(CC) $(OPTFLG) -o $(ADMIN) $(AOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(ADMIN)
+
+$(GAME): $(GOBJS)
+ @echo phew...
+ -$(RM) $(DGFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling user interface
+ $(CC) $(OPTFLG) -o $(GAME) $(GOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(GAME)
+
+$(SORT): sort.c
+ $(CC) $(OPTFLG) -o $(SORT) sort.c
+# comment out the next line if debugging
+ strip $(SORT)
+
+clobber:
+ -$(RM) *.o $(HELPOUT)[0-5] $(PSPROG) $(SORT) insthelp helpfile $(NULL)
+ -$(RM) newhelp in$(GAME) in$(SORT) in$(ADMIN) in$(PSPROG) $(NULL)
+ -$(RM) $(HELPSCR).[12] lint[ag] conquer.doc $(GAME) $(ADMIN) $(NULL)
+
+clean:
+ $(RM) *.o lint[ag] conquer.doc $(NULL)
+
+in$(GAME): $(GAME)
+ -$(RM) $(EXEDIR)/$(GAME)
+ mv $(GAME) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(GAME)
+ touch $(GAME)
+ touch in$(GAME)
+
+in$(ADMIN): $(ADMIN)
+ -$(RM) $(EXEDIR)/$(ADMIN)
+ mv $(ADMIN) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(ADMIN)
+ touch $(ADMIN)
+ touch in$(ADMIN)
+
+in$(SORT): $(SORT)
+ -$(RM) $(EXEDIR)/$(SORT)
+ mv $(SORT) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(SORT)
+ touch $(SORT)
+ touch in$(SORT)
+
+in$(PSPROG): $(PSPROG)
+ -$(RM) $(EXEDIR)/$(PSPROG)
+ mv $(PSPROG) $(EXEDIR)
+ $(CP) $(PSDATA) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(PSPROG)
+ chmod 644 $(EXEDIR)/$(PSDATA)
+ touch $(PSPROG)
+ touch in$(PSPROG)
+
+install: in$(GAME) in$(ADMIN) in$(SORT) in$(PSPROG) insthelp instman
+ @echo ""
+ @echo "Installation complete"
+
+new_game: all insthelp
+ @echo Installing new game
+ -mkdir $(EXEDIR) $(NULL)
+ -mkdir $(DEFAULT) $(NULL)
+ -mkdir $(DEFAULT)/$(GAMEID) $(NULL)
+ chmod 755 $(EXEDIR)
+ chmod 750 $(DEFAULT)/$(GAMEID) $(DEFAULT)
+ $(CP) $(GAME) $(ADMIN) $(SORT) $(PSPROG) $(PSDATA) $(EXEDIR)
+ chmod 4755 $(EXEDIR)/$(GAME) $(EXEDIR)/$(ADMIN)
+ chmod 0755 $(EXEDIR)/$(SORT) $(EXEDIR)/$(PSPROG)
+ chmod 0644 $(EXEDIR)/$(PSDATA)
+ chmod 0600 nations
+ chmod 0700 run
+ $(CP) nations rules $(DEFAULT)/$(GAMEID)
+ $(CP) nations rules $(DEFAULT)
+ @echo now making the world
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -m
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -a
+
+insthelp: helpfile
+ @echo Installing helpfiles
+ -$(RM) $(DEFAULT)/$(HELPOUT)0
+ -$(LN) $(CURRENT)/$(HELPOUT)0 $(DEFAULT)/$(HELPOUT)0
+ -$(RM) $(DEFAULT)/$(HELPOUT)1
+ -$(LN) $(CURRENT)/$(HELPOUT)1 $(DEFAULT)/$(HELPOUT)1
+ -$(RM) $(DEFAULT)/$(HELPOUT)2
+ -$(LN) $(CURRENT)/$(HELPOUT)2 $(DEFAULT)/$(HELPOUT)2
+ -$(RM) $(DEFAULT)/$(HELPOUT)3
+ -$(LN) $(CURRENT)/$(HELPOUT)3 $(DEFAULT)/$(HELPOUT)3
+ -$(RM) $(DEFAULT)/$(HELPOUT)4
+ -$(LN) $(CURRENT)/$(HELPOUT)4 $(DEFAULT)/$(HELPOUT)4
+ -$(RM) $(DEFAULT)/$(HELPOUT)5
+ -$(LN) $(CURRENT)/$(HELPOUT)5 $(DEFAULT)/$(HELPOUT)5
+ touch insthelp
+
+instman:
+ @echo Installing man pages
+ $(CP) man.pag $(EXEDIR)
+
+helpfile: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ @echo Helpfiles built
+ touch helpfile
+
+$(HELPOUT)0: $(HELP)0 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)0
+ cat $(HELP)0 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)0
+
+$(HELPOUT)1: $(HELP)1 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)1
+ cat $(HELP)1 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)1
+
+$(HELPOUT)2: $(HELP)2 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)2
+ cat $(HELP)2 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)2
+
+$(HELPOUT)3: $(HELP)3 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)3
+ cat $(HELP)3 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)3
+
+$(HELPOUT)4: $(HELP)4 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)4
+ cat $(HELP)4 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)4
+
+$(HELPOUT)5: $(HELP)5 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)5
+ cat $(HELP)5 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)5
+
+$(HELPSCR).1: newhelp
+ newhelp
+
+$(HELPSCR).2: newhelp
+ newhelp
+
+newhelp: dataG.o newhelp.o
+ $(CC) $(OPTFLG) dataG.o newhelp.o -o newhelp
+ strip newhelp
+#
+# postscript map program
+PSOPTS = -DPSFILE=\"$(EXEDIR)/$(PSDATA)\" -D$(PSPAGE)
+#
+$(PSPROG): $(PSSRC) $(PSDATA) $(PSHEAD)
+ $(CC) $(OPTFLG) $(PSOPTS) $(PSSRC) -o $(PSPROG)
+# comment out the next line if debugging
+ strip $(PSPROG)
+
+lint:
+ lint $(LTFLG) $(CDEFS) -DCONQUER $(GFILS) > lintg
+ lint $(LTFLG) $(CDEFS) -DADMIN $(AFILS) > linta
+
+docs: conquer.doc
+
+conquer.doc: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ cat $(HELPOUT)? |sed -e "s/^DONE//g"|sed -e "s/^END//g" >conquer.doc
+
+cpio:
+ -$(RM) core
+ find . -name '*[CrpsEech]' -print | cpio -ocBv > cpiosv
+
+shar:
+ echo " lines words chars FILENAME" > MANIFEST
+ wc $(ALLFILS) >> MANIFEST
+ $(SHAR) $(SHARFLG) $(ALLFILS) MANIFEST
+
+.cA.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*A.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -c $*A.c ;\
+ $(RM) $*A.c )
+
+.cG.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*G.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DCONQUER -c $*G.c ;\
+ $(RM) $*G.c )
+
+.c.o: $<
+# compiles using both defines since they
+# are needed for the data.h definitions for
+# each file... but should not be needed for
+# the actual C source file being compiled
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -DCONQUER -c $*.c
+
+$(GOBJS): data.h header.h
+
+$(AOBJS): data.h header.h
+
+ioG.o: data.h header.h patchlevel.h io.c
+
+ioA.o: data.h header.h patchlevel.h io.c
+
+newlogin.o: data.h header.h newlogin.h patchlevel.h newlogin.c
+
+main.o: data.h header.h patchlevel.h main.c
+
+newhelp.o: data.h header.h patchlevel.h newhelp.c
+
+# Clear suffixes
+# Commented out for problems with newer versions of make
+#.SUFFIXES:
+
+# Suffixes for conquer files.
+#.SUFFIXES: .c .o .cA.o .cG.o A.o G.o
diff --git a/RELICENSING-PERMISSIONS.md b/gpl-release/RELICENSING-PERMISSIONS.md
similarity index 100%
rename from RELICENSING-PERMISSIONS.md
rename to gpl-release/RELICENSING-PERMISSIONS.md
diff --git a/WARNING.p11 b/gpl-release/WARNING.p11
similarity index 100%
rename from WARNING.p11
rename to gpl-release/WARNING.p11
diff --git a/admin.c b/gpl-release/admin.c
similarity index 100%
rename from admin.c
rename to gpl-release/admin.c
diff --git a/cexecute.c b/gpl-release/cexecute.c
similarity index 100%
rename from cexecute.c
rename to gpl-release/cexecute.c
diff --git a/check.c b/gpl-release/check.c
similarity index 100%
rename from check.c
rename to gpl-release/check.c
diff --git a/combat.c b/gpl-release/combat.c
similarity index 100%
rename from combat.c
rename to gpl-release/combat.c
diff --git a/commands.c b/gpl-release/commands.c
similarity index 100%
rename from commands.c
rename to gpl-release/commands.c
diff --git a/data.c b/gpl-release/data.c
similarity index 100%
rename from data.c
rename to gpl-release/data.c
diff --git a/data.h b/gpl-release/data.h
similarity index 100%
rename from data.h
rename to gpl-release/data.h
diff --git a/display.c b/gpl-release/display.c
similarity index 100%
rename from display.c
rename to gpl-release/display.c
diff --git a/extcmds.c b/gpl-release/extcmds.c
similarity index 100%
rename from extcmds.c
rename to gpl-release/extcmds.c
diff --git a/forms.c b/gpl-release/forms.c
similarity index 100%
rename from forms.c
rename to gpl-release/forms.c
diff --git a/header.h b/gpl-release/header.h
similarity index 100%
rename from header.h
rename to gpl-release/header.h
diff --git a/io.c b/gpl-release/io.c
similarity index 100%
rename from io.c
rename to gpl-release/io.c
diff --git a/magic.c b/gpl-release/magic.c
similarity index 100%
rename from magic.c
rename to gpl-release/magic.c
diff --git a/main.c b/gpl-release/main.c
similarity index 100%
rename from main.c
rename to gpl-release/main.c
diff --git a/makeworl.c b/gpl-release/makeworl.c
similarity index 100%
rename from makeworl.c
rename to gpl-release/makeworl.c
diff --git a/man.pag b/gpl-release/man.pag
similarity index 100%
rename from man.pag
rename to gpl-release/man.pag
diff --git a/misc.c b/gpl-release/misc.c
similarity index 100%
rename from misc.c
rename to gpl-release/misc.c
diff --git a/move.c b/gpl-release/move.c
similarity index 100%
rename from move.c
rename to gpl-release/move.c
diff --git a/nations b/gpl-release/nations
similarity index 100%
rename from nations
rename to gpl-release/nations
diff --git a/navy.c b/gpl-release/navy.c
similarity index 100%
rename from navy.c
rename to gpl-release/navy.c
diff --git a/newhelp.c b/gpl-release/newhelp.c
similarity index 100%
rename from newhelp.c
rename to gpl-release/newhelp.c
diff --git a/newlogin.c b/gpl-release/newlogin.c
similarity index 100%
rename from newlogin.c
rename to gpl-release/newlogin.c
diff --git a/newlogin.h b/gpl-release/newlogin.h
similarity index 100%
rename from newlogin.h
rename to gpl-release/newlogin.h
diff --git a/notes.v4 b/gpl-release/notes.v4
similarity index 100%
rename from notes.v4
rename to gpl-release/notes.v4
diff --git a/npc.c b/gpl-release/npc.c
similarity index 100%
rename from npc.c
rename to gpl-release/npc.c
diff --git a/patchlevel.h b/gpl-release/patchlevel.h
similarity index 100%
rename from patchlevel.h
rename to gpl-release/patchlevel.h
diff --git a/psmap.c b/gpl-release/psmap.c
similarity index 100%
rename from psmap.c
rename to gpl-release/psmap.c
diff --git a/psmap.h b/gpl-release/psmap.h
similarity index 100%
rename from psmap.h
rename to gpl-release/psmap.h
diff --git a/psmap.ps b/gpl-release/psmap.ps
similarity index 100%
rename from psmap.ps
rename to gpl-release/psmap.ps
diff --git a/randeven.c b/gpl-release/randeven.c
similarity index 100%
rename from randeven.c
rename to gpl-release/randeven.c
diff --git a/reports.c b/gpl-release/reports.c
similarity index 100%
rename from reports.c
rename to gpl-release/reports.c
diff --git a/rules b/gpl-release/rules
similarity index 100%
rename from rules
rename to gpl-release/rules
diff --git a/run b/gpl-release/run
similarity index 100%
rename from run
rename to gpl-release/run
diff --git a/sort.c b/gpl-release/sort.c
similarity index 100%
rename from sort.c
rename to gpl-release/sort.c
diff --git a/spew.c b/gpl-release/spew.c
similarity index 100%
rename from spew.c
rename to gpl-release/spew.c
diff --git a/trade.c b/gpl-release/trade.c
similarity index 100%
rename from trade.c
rename to gpl-release/trade.c
diff --git a/trade.h b/gpl-release/trade.h
similarity index 100%
rename from trade.h
rename to gpl-release/trade.h
diff --git a/txt0 b/gpl-release/txt0
similarity index 100%
rename from txt0
rename to gpl-release/txt0
diff --git a/txt1 b/gpl-release/txt1
similarity index 100%
rename from txt1
rename to gpl-release/txt1
diff --git a/txt2 b/gpl-release/txt2
similarity index 100%
rename from txt2
rename to gpl-release/txt2
diff --git a/txt3 b/gpl-release/txt3
similarity index 100%
rename from txt3
rename to gpl-release/txt3
diff --git a/txt4 b/gpl-release/txt4
similarity index 100%
rename from txt4
rename to gpl-release/txt4
diff --git a/txt5 b/gpl-release/txt5
similarity index 100%
rename from txt5
rename to gpl-release/txt5
diff --git a/update.c b/gpl-release/update.c
similarity index 100%
rename from update.c
rename to gpl-release/update.c
diff --git a/utilities/.gitignore b/gpl-release/utilities/.gitignore
similarity index 100%
rename from utilities/.gitignore
rename to gpl-release/utilities/.gitignore
diff --git a/utilities/.indent.pro b/gpl-release/utilities/.indent.pro
similarity index 100%
rename from utilities/.indent.pro
rename to gpl-release/utilities/.indent.pro
diff --git a/utilities/Makefile b/gpl-release/utilities/Makefile
similarity index 100%
rename from utilities/Makefile
rename to gpl-release/utilities/Makefile
diff --git a/utilities/README b/gpl-release/utilities/README
similarity index 100%
rename from utilities/README
rename to gpl-release/utilities/README
diff --git a/gpl-release/utilities/backup/Makefile.backup b/gpl-release/utilities/backup/Makefile.backup
new file mode 100644
index 0000000..d0a8535
--- /dev/null
+++ b/gpl-release/utilities/backup/Makefile.backup
@@ -0,0 +1,132 @@
+#
+SHELL=/bin/sh
+SHAR=/usr/bin/shar
+MAKE=/usr/bin/make
+
+#
+# Will most likely have to edit the location of the
+# X Libraries.
+#
+Libs_sun= -lpixrect
+Libs_x= -L/usr/lib -lX11
+
+WHICHconqrast: WHICHconqrast.o error.o WHICHstuff.o file.o util.o
+ cc $(CFLAGS) -o WHICHconqrast WHICHconqrast.o WHICHstuff.o file.o\
+ util.o error.o $(Libs_WHICH)
+
+error.o: error.c
+file.o: file.c
+util.o:util.c
+
+WHICHconqrast.o: conqrast.c WHICHconqrast.h file.h ../header.h
+ $(CC) $(CFLAGS) -c conqrast.c -DHEADERFILE=\"WHICHconqrast.h\"
+ mv conqrast.o WHICHconqrast.o
+
+WHICHstuff.o: WHICHstuff.c WHICHconqrast.h
+
+lint.WHICH:
+ lint -abchx -DHEADERFILE=\"WHICHconqrast.h\" \
+ conqrast.c WHICHstuff.c error.c file.c util.c $(Libs_WHICH)
+
+### don't delete this line!
+
+all: sunconqrast xconqrast
+
+lint: lint.sun lint.x
+
+lint.sun: makefile.sun
+ $(MAKE) $(MFLAGS) -f makefile.sun lint.sun
+
+lint.x: makefile.x
+ $(MAKE) $(MFLAGS) -f makefile.x lint.x
+
+sun sunconqrast: makefile.sun conqrast.c sunstuff.c sunconqrast.h file.c\
+ file.h util.c
+ $(MAKE) $(MFLAGS) -f makefile.sun sunconqrast
+
+makefile.sun : Makefile
+ sed -e '/^###/q' -e '/WHICH/s//sun/g' Makefile > makefile.sun
+
+x xconqrast: makefile.x conqrast.c xstuff.c xconqrast.h file.c file.h util.c
+ $(MAKE) $(MFLAGS) -f makefile.x xconqrast
+
+makefile.x : Makefile
+ sed -e '/^###/q' -e '/WHICH/s//x/g' Makefile > makefile.x
+
+shar.core: conqrast.c
+ shar -c -v conqrast.c > shar.core
+
+shar.sun: sunstuff.c sunconqrast.h
+ shar -c -v sunstuff.c sunconqrast.h > shar.sun
+
+shar.x: xstuff.c xconqrast.h
+ shar -c -v xstuff.c xconqrast.h > shar.x
+
+shar.general: Makefile README error.c file.c file.h util.c conqrast.man
+ shar -c -v Makefile README conqrast.man error.c file.c file.h util.c > shar.general
+
+shar: shar.general shar.sun shar.x shar.core
+
+checkpoint:
+ cp Makefile README *.[ch] *.man old
+ /bin/rm *.diff newfiles difffiles
+
+clean:
+ /bin/rm -f *.o *.diff patch shar.* *~ "#*" makefile.* newfiles difffiles
+
+diffs:
+ echo -n >patch
+ -for i in old/* ; do \
+ j=`basename $$i` ;\
+ if diff -c $$i $$j > $$j.diff ;\
+ then \
+ /bin/rm $$j.diff ;\
+ else \
+ cat $$j.diff >> patch ;\
+ wc $$j.diff ;\
+ fi ;\
+ done
+
+newfiles:
+ echo -n > newfiles
+ -for i in *.[ch1] ; do\
+ if test -f old/$$i ; then\
+ : ;\
+ else \
+ echo $$i >> newfiles ;\
+ fi ;\
+ done
+
+difffiles: newfiles diffs
+ echo -n > difffiles
+ -for i in *.diff ; do\
+ j=`basename $$i .diff` ;\
+ echo -n $$j ;\
+ is=`wc $$i |colrm 9`;\
+ js=`wc $$j |colrm 9`;\
+ echo " " $$js $$is ;\
+ if test $$is -gt $$js ; then \
+ echo is very new! ;\
+ echo $$j >> newfiles ;\
+ else \
+ echo is changed ;\
+ echo $$i >> difffiles ;\
+ fi ;\
+ done
+
+update: newfiles difffiles
+ -n=1;for i in `cat difffiles` `cat newfiles` ; do \
+ lines=`wc $$them $$i| tail -1 | colrm 9` ;\
+ echo $$them $$i $$lines ;\
+ if test $$lines -gt 800 ; then\
+ echo chop! ;\
+ $(SHAR) -c -v $$them > shar.$$n ;\
+ n=`expr $$n + 1` ;\
+ them="$$i" ;\
+ else \
+ them="$$them $$i" ;\
+ fi ;\
+ done ;\
+ $(SHAR) -c -v $$them > shar.$$n
+ /bin/rm newfiles difffiles
+
diff --git a/gpl-release/utilities/backup/conqrast.c.backup b/gpl-release/utilities/backup/conqrast.c.backup
new file mode 100644
index 0000000..1841507
--- /dev/null
+++ b/gpl-release/utilities/backup/conqrast.c.backup
@@ -0,0 +1,792 @@
+#include
+#include
+#include
+#include "../header.h"
+#include "file.h"
+#include HEADERFILE
+
+/*********************************************************************
+* *
+* This program draws a map of the conquer world on a bitmap system *
+* *
+* Written by Richard Caley July 1989 and hacked extensively *
+* thereafter. *
+* *
+* You may copy, distribute, modify or do what you will with this *
+* code so long as this message remains in it and so long as you do *
+* not charge for it, nor distribute the program without the source. *
+* *
+* There is a horrid hack for getpass - to make this read the *
+* password from standard in one has to disconnect from the control *
+* terminal. GAG! It should be possible to disconnect just the *
+* conquer from the control terminal . . . someday. *
+* *
+* See Readme for more details. *
+* *
+*********************************************************************/
+
+#define GAP (2) /* fudge factor - space above
+ * and below titles */
+
+#define total_height (height*mag+ (do_title?4*GAP+2*font_height(titlefont):0))
+ /* height of map and title bars */
+
+#define yoffset(place) ((place)+(do_title?font_height(titlefont)+GAP+GAP:0))
+ /* a y position */
+
+#define tracef if(trace) printf
+
+char *getpass();
+void error(), ioerror();
+char *passwd=NULL;
+char *nation=NULL;
+int turn;
+int trace=0;
+int bg=0;
+char conquer_version[100];
+
+#define conqrast_version "1.0"
+
+#ifndef conqrast_name
+# define conqrast_name "Some conqrast" /* this is redefined in the header */
+# define driver_version "unknown driver"
+#endif
+
+#define HEADER_TAG "Conquer Version" /* just before first line of map */
+#define HEADER_TAG_LENGTH (sizeof(HEADER_TAG)/sizeof(char)-1)
+
+extern struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *romanfont,*boldfont;
+ } fonts[];
+
+struct /* Maps from terrain to brightness */
+ {
+ char c;
+ int val; /* must be between 0 and 255 */
+ } values[] =
+ {
+ ' ', 256,
+ '~', 0,
+ '-', 64,
+ '%', 128,
+ '^', 192,
+ '#', 224,
+ '\0'
+ };
+
+char *mapnames[] =
+ {
+ "This should never happen",
+ "Altitude",
+ "Vegetation",
+ "Nation",
+ "Designation"
+ };
+
+#define num_mapnames (sizeof(mapnames)/sizeof(char *))
+
+/*********************************************************************
+* *
+* Font mapping information. Fonts used by the system have symbolic *
+* names so they can be referred to on the commend line. font_table *
+* records which fonts go with which name. *
+* *
+*********************************************************************/
+
+enum mapfont
+ {
+ f_nation,
+ f_designation,
+ f_title,
+ f_last
+ };
+
+struct
+ {
+ char *name;
+ font romanfont;
+ font boldfont;
+ } font_table[(unsigned)f_last+1] =
+ {
+ {"nation"},
+ {"designation"},
+ {"title"},
+ {NULL}
+ };
+
+#define MAXDITHER 4 /* don't touch this */
+
+short dit[1<= mag )
+ break;
+ else if (fonts[i].mag < mag )
+ {
+ if(bad_font(font_table[(unsigned)f].romanfont=
+ font_named(fonts[i].romanfont)))
+ error("Can't get font '%s' as %s font",
+ fonts[i].romanfont,font_table[(unsigned)f].name);
+ if ( font_table[(unsigned)f].boldfont==NULL && fonts[i].boldfont !=NULL)
+ if (bad_font(font_table[(unsigned)f].boldfont=
+ font_named(fonts[i].boldfont)))
+ error("Can't get font '%s' as bold %s font",
+ fonts[i].romanfont,font_table[(unsigned)f].name);
+ }
+ }
+ if(font_table[(unsigned)f].romanfont==NULL)
+ error("No font small enough for size %d %s",mag,font_table[(unsigned)f].name);
+ }
+
+ }
+
+/*********************************************************************
+* *
+* Set up a single font. if the name is in the table ( or is a prefix *
+* ) then insert the name into the font table. If the name begins *
+* with 'b' then sets the bold font. *
+* *
+*********************************************************************/
+
+void
+set_a_font(name,fontname)
+
+char *name;
+char *fontname;
+
+{
+ int i,bold=0,l;
+ font thefont;
+
+ if( name[0]=='b')
+ {
+ name++;
+ bold=1;
+ }
+
+ l=strlen(name);
+
+ for (i=0;i< (int)f_last;i++)
+ if (!strncmp(name,font_table[i].name,l))
+ break;
+
+ if ( i == (int)f_last)
+ error("Unknown font name '%s'",name);
+
+ thefont=font_named(fontname);
+
+ if ( bad_font(thefont) )
+ error("Can't get font '%s'",fontname);
+
+ if (bold)
+ font_table[i].boldfont=thefont;
+ else
+ font_table[i].romanfont=thefont;
+ }
+
+/*********************************************************************
+* *
+* scan over the header of the map. Returns the number of the map, or *
+* 0 if the map is bad. If `pipe' is != 0 then the input is a pipe *
+* and an eof implies a bad password. *
+* *
+* Tries to cope with DEBUG and none-DEBUG conquers *
+* *
+*********************************************************************/
+
+scan_header(f,pipe)
+
+FILE *f;
+int pipe;
+
+{
+ char line[1024];
+ char which[100];
+ static char who[100];
+ int mapid;
+
+ while ( fgets(line,1024,f) != NULL) /* scan to top of map */
+ {
+ if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
+ break;
+ }
+
+ if (feof(f))
+ {
+ if(pipe)
+ error("Password incorrect");
+ else
+ error("Unexpected end of map file");
+ }
+
+ if (sscanf(line,"Conquer Version %[0-9.] : %s Map %*s %*s %s on Turn %d",conquer_version,which,who,&turn)!=4)
+ error("Bad title line (wrong version?) '%s'",line);
+
+ for(mapid=1;mapid < num_mapnames;mapid++)
+ if(!strcmp(mapnames[mapid],which))
+ break;
+
+ if ( mapid==num_mapnames)
+ mapid= 0;
+ else if ( trace && !pipe)
+ printf("Found %s map\n", which);
+
+ if(!strcmp(who,"World"))
+ nation="god";
+ else
+ nation=who;
+
+ tracef("Nation is %s\n",nation);
+
+ return mapid;
+ }
+
+/*********************************************************************
+* *
+* Find maps in a file and store away a file pointer and offset for *
+* each *
+* *
+*********************************************************************/
+
+void
+process_map_file(name)
+
+char *name;
+
+{
+ int which;
+ FILE *f;
+ char line[1024];
+
+ tracef("Searching file %s\n",name);
+
+ if ((f=fopen(name,"r"))==NULL)
+ ioerror("Can't open map file '%s'",name);
+
+ while(1)
+ {
+ long top;
+
+ which=scan_header(f,0);
+
+ if(which==0)
+ error("Bad map file '%s'",name);
+
+ myopen(which,f);
+ top=ftell(f);
+ while(fgets(line,1024,f)!=NULL)
+ {
+ if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
+ break;
+ top=ftell(f);
+ }
+
+ if(feof(f))
+ break;
+
+ fseek(f,top,0);
+ }
+ }
+
+/*********************************************************************
+* *
+* Get a map. If the map was not in one of the files on the command *
+* line it runs conquer -p to get it. *
+* *
+* Which selects the map. *
+* Args are passed to conqrun. *
+* Tmpname is the name of a temporary file to use. This is *
+* deleted in this routine so you can reuse the name. *
+* *
+* All except `which' are ignored if the user has given a map *
+* file of the correct type as an argumant. *
+* *
+*********************************************************************/
+
+int
+get_map_file(which,args,tmpname)
+
+int which;
+char *args;
+char *tmpname;
+
+{
+ char command[100];
+ FILE *tmp;
+
+ if ( ! myisopen(which))
+ {
+ if (nation==NULL)
+ {
+ tracef("Assuming god\n");
+
+ nation="god";
+ }
+
+ tracef("Asking conquer for %s map\n",mapnames[which]);
+
+ if (passwd==NULL)
+ {
+ passwd=getpass("Enter conquer password: ");
+ }
+
+ tracef("Disconnecting ( HACK! ) bye bye\n");
+
+ disconnect(); /* disconnect from controling tty */
+ /* ( hack for getpass ) */
+
+ if (bg) /* go into background if asked */
+ {
+ tracef("Going into background\n");
+
+ background();
+ }
+
+ sprintf(command,"conquer -p %s > %s 2>/dev/null",args,tmpname);
+
+ if((tmp=popen(command,"w"))==NULL)
+ ioerror("can't run conquer");
+
+ if (fprintf(tmp,"%s\n%s\n%c\n",nation,passwd, which+'0')==EOF)
+ error("Couldn't get map. Conquer may be updating.\n");
+
+ pclose(tmp);
+
+ if((tmp=fopen(tmpname,"r"))==NULL)
+ ioerror("can't open %s",tmpname);
+
+ unlink(tmpname); /* delete it */
+
+ (void)scan_header(tmp,1);
+ myopen(which,tmp);
+ }
+
+ return which;
+ }
+
+/*ARGSUSED*/
+main(argc,argv)
+
+int argc;
+char *argv[];
+
+{
+ char line[1024];
+ char desline[1024];
+ char tmpname[20];
+ char args[100];
+ char *screen_name=get_default_screen_name();
+ screen_type screen=NULL;
+ int mapfile;
+ int destmapfile;
+ int mag=11;
+ bitmap pr;
+ int width,height;
+ extern char *myname;
+ int x,y,i,j,val;
+ char c;
+ char *mapname=NULL;
+ char *world=NULL;
+ int do_nations=0,barbarians=0,markbarbs=0;
+ int all=0,live=0,altitude=1;
+ int desig=0;
+ int do_title=1;
+ font titlefont;
+ int boldtitle=0; /* indicates that the title font should be
+ emboldened - ie `titlefont' is roman and
+ so _we_ must do the bold */
+
+
+ myname=argv[0];
+
+ strcpy(args,"");
+
+ while(*(++argv)!=NULL)
+ if (!strncmp(*argv,"-o",2))
+ {
+ mapname= *(++argv);
+ if ( is_screenname(mapname))
+ {
+ screen_name=mapname;
+ mapname=NULL;
+ }
+ }
+ else if (!strcmp(*argv,"-l"))
+ live++;
+ else if (!strcmp(*argv,"-D"))
+ sprintf(args,"%s -d %s",args,world= *(++argv));
+ else if (!strcmp(*argv,"-N"))
+ nation= *(++argv);
+ else if (!strcmp(*argv,"-bg"))
+ bg++;
+ else if (!strcmp(*argv,"-a"))
+ altitude=0;
+ else if (!strcmp(*argv,"-f"))
+ {
+ char *which= *(++argv), *fontname= *(++argv);
+ set_a_font(which,fontname);
+ }
+ else if (!strncmp(*argv,"-b",2))
+ {
+ barbarians++;
+ if ( (*argv)[2]=='a')
+ markbarbs++;
+ }
+ else if (!strcmp(*argv,"-m"))
+ mag=atoi(*(++argv));
+ else if (!strncmp(*argv,"-c",2))
+ {
+ c=(*argv)[2];
+ for (i=0;;i++)
+ {
+ if (values[i].c =='\0')
+ error("Unknown contour '%c'",c);
+ else if ( values[i].c == c)
+ {
+ values[i].val=atoi(*(++argv));
+ break;
+ }
+ }
+ }
+ else if (!strncmp(*argv,"-n",2))
+ {
+ do_nations++;
+ if ( (*argv)[2]=='a')
+ ++all;
+ }
+ else if (!strncmp(*argv,"-d",2))
+ {
+ desig++;
+ }
+ else if (!strcmp(*argv,"-h"))
+ help_message(myname);
+ else if (!strcmp(*argv,"-t"))
+ do_title=0;
+ else if (!strcmp(*argv,"-v"))
+ trace++;
+ else if ( (*argv)[0]=='-')
+ {
+ printf("Unknown option '%s'\n",*argv);
+ help_message(myname);
+ }
+ else
+ process_map_file(*argv);
+
+ if (do_nations) /* if we have to put in nations */
+ set_default_fonts(mag,f_nation);
+
+ if (desig)
+ {
+ if (all)
+ error("Only one of -d and -na allowed!");
+
+ set_default_fonts(mag,f_designation);
+ }
+
+ if (do_title)
+ {
+ set_default_fonts(mag+2,f_title);
+ if ( (titlefont=font_table[(unsigned)f_title].boldfont)==NULL)
+ {
+ boldtitle=1;
+ titlefont=font_table[(unsigned)f_title].romanfont;
+ }
+
+ }
+
+ screen=screen_named(screen_name);
+
+ sprintf(tmpname,"/tmp/conq%d",getpid());
+
+ mapfile=get_map_file(altitude?1:3, /* get a map */
+ args,tmpname);
+
+ if(mygets(line,1024,mapfile)==NULL)
+ error("empty map!");
+
+ width=strlen(line)-1; /* count height and width */
+
+ for(height=1;mygets(line,1024,mapfile)!=NULL;height++)
+ if(!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH)||
+ !strncmp(line,"reading",7))
+ break;
+
+ tracef("Size %d X %d, image %d X %d\n",width,height,width*mag,height*mag);
+
+ initialise_bitmaps();
+
+ if(live) /* if live do it on the screen */
+ {
+ if ((pr=get_screen_bitmap(screen))==(bitmap)NULL)
+ ioerror("Can't open screen %s",screen_name);
+ }
+ else /* otherwise in memory */
+ pr=create_bitmap(width*mag,total_height);
+
+ myrewind(mapfile);
+
+ if (altitude) /* if needed do altitude */
+ {
+ int xx,yy;
+ tracef("Drawing topography\n");
+
+ build_dither_matrix(MAXDITHER);
+
+ yy=yoffset(0);
+ for(y=0;y=val?1:0);
+ }
+ }
+ }
+
+ myclose(mapfile);
+ }
+
+ if(do_nations||desig) /* nations */
+ {
+ font nf, bnf;
+ font df;
+ int xx,yy;
+ char des,
+ current='\0'; /* keeps track of which nation we are in */
+ char last[1024]; /* ditto vertically for each column */
+
+ tracef("Drawing nations\n");
+
+ if (do_nations)
+ {
+ nf = font_table[(unsigned)f_nation].romanfont;
+ bnf = font_table[(unsigned)f_nation].boldfont;
+ }
+
+ if (desig)
+ {
+ df = font_table[(unsigned)f_designation].romanfont;
+ }
+
+ if (altitude) /* if no altitude this was gotten to */
+ /* count the size */
+ mapfile=get_map_file(3,args,tmpname);
+
+ destmapfile=get_map_file(4,args,tmpname);
+
+ yy=yoffset(mag);
+ for(y=0;y.
+ */
+
+#include
+#include
+#include
+#include "../header.h"
+#include "file.h"
+#include HEADERFILE
+
+/*********************************************************************
+* *
+* This program draws a map of the conquer world on a bitmap system *
+* *
+* Written by Richard Caley July 1989 and hacked extensively *
+* thereafter. *
+* *
+* You may copy, distribute, modify or do what you will with this *
+* code so long as this message remains in it and so long as you do *
+* not charge for it, nor distribute the program without the source. *
+* *
+* There is a horrid hack for getpass - to make this read the *
+* password from standard in one has to disconnect from the control *
+* terminal. GAG! It should be possible to disconnect just the *
+* conquer from the control terminal . . . someday. *
+* *
+* See Readme for more details. *
+* *
+*********************************************************************/
+
+#define GAP (2) /* fudge factor - space above
+ * and below titles */
+
+#define total_height (height*mag+ (do_title?4*GAP+2*font_height(titlefont):0))
+ /* height of map and title bars */
+
+#define yoffset(place) ((place)+(do_title?font_height(titlefont)+GAP+GAP:0))
+ /* a y position */
+
+#define tracef if(trace) printf
+
+char *getpass();
+void error(), ioerror();
+char *passwd=NULL;
+char *nation=NULL;
+int turn;
+int trace=0;
+int bg=0;
+char conquer_version[100];
+
+#define conqrast_version "1.0"
+
+#ifndef conqrast_name
+# define conqrast_name "Some conqrast" /* this is redefined in the header */
+# define driver_version "unknown driver"
+#endif
+
+#define HEADER_TAG "Conquer Version" /* just before first line of map */
+#define HEADER_TAG_LENGTH (sizeof(HEADER_TAG)/sizeof(char)-1)
+
+extern struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *romanfont,*boldfont;
+ } fonts[];
+
+struct /* Maps from terrain to brightness */
+ {
+ char c;
+ int val; /* must be between 0 and 255 */
+ } values[] =
+ {
+ ' ', 256,
+ '~', 0,
+ '-', 64,
+ '%', 128,
+ '^', 192,
+ '#', 224,
+ '\0'
+ };
+
+char *mapnames[] =
+ {
+ "This should never happen",
+ "Altitude",
+ "Vegetation",
+ "Nation",
+ "Designation"
+ };
+
+#define num_mapnames (sizeof(mapnames)/sizeof(char *))
+
+/*********************************************************************
+* *
+* Font mapping information. Fonts used by the system have symbolic *
+* names so they can be referred to on the commend line. font_table *
+* records which fonts go with which name. *
+* *
+*********************************************************************/
+
+enum mapfont
+ {
+ f_nation,
+ f_designation,
+ f_title,
+ f_last
+ };
+
+struct
+ {
+ char *name;
+ font romanfont;
+ font boldfont;
+ } font_table[(unsigned)f_last+1] =
+ {
+ {"nation"},
+ {"designation"},
+ {"title"},
+ {NULL}
+ };
+
+#define MAXDITHER 4 /* don't touch this */
+
+short dit[1<= mag )
+ break;
+ else if (fonts[i].mag < mag )
+ {
+ if(bad_font(font_table[(unsigned)f].romanfont=
+ font_named(fonts[i].romanfont)))
+ error("Can't get font '%s' as %s font",
+ fonts[i].romanfont,font_table[(unsigned)f].name);
+ if ( font_table[(unsigned)f].boldfont==NULL && fonts[i].boldfont !=NULL)
+ if (bad_font(font_table[(unsigned)f].boldfont=
+ font_named(fonts[i].boldfont)))
+ error("Can't get font '%s' as bold %s font",
+ fonts[i].romanfont,font_table[(unsigned)f].name);
+ }
+ }
+ if(font_table[(unsigned)f].romanfont==NULL)
+ error("No font small enough for size %d %s",mag,font_table[(unsigned)f].name);
+ }
+
+ }
+
+/*********************************************************************
+* *
+* Set up a single font. if the name is in the table ( or is a prefix *
+* ) then insert the name into the font table. If the name begins *
+* with 'b' then sets the bold font. *
+* *
+*********************************************************************/
+
+void
+set_a_font(name,fontname)
+
+char *name;
+char *fontname;
+
+{
+ int i,bold=0,l;
+ font thefont;
+
+ if( name[0]=='b')
+ {
+ name++;
+ bold=1;
+ }
+
+ l=strlen(name);
+
+ for (i=0;i< (int)f_last;i++)
+ if (!strncmp(name,font_table[i].name,l))
+ break;
+
+ if ( i == (int)f_last)
+ error("Unknown font name '%s'",name);
+
+ thefont=font_named(fontname);
+
+ if ( bad_font(thefont) )
+ error("Can't get font '%s'",fontname);
+
+ if (bold)
+ font_table[i].boldfont=thefont;
+ else
+ font_table[i].romanfont=thefont;
+ }
+
+/*********************************************************************
+* *
+* scan over the header of the map. Returns the number of the map, or *
+* 0 if the map is bad. If `pipe' is != 0 then the input is a pipe *
+* and an eof implies a bad password. *
+* *
+* Tries to cope with DEBUG and none-DEBUG conquers *
+* *
+*********************************************************************/
+
+scan_header(f,pipe)
+
+FILE *f;
+int pipe;
+
+{
+ char line[1024];
+ char which[100];
+ static char who[100];
+ int mapid;
+
+ while ( fgets(line,1024,f) != NULL) /* scan to top of map */
+ {
+ if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
+ break;
+ }
+
+ if (feof(f))
+ {
+ if(pipe)
+ error("Password incorrect");
+ else
+ error("Unexpected end of map file");
+ }
+
+ if (sscanf(line,"Conquer Version %[0-9.] : %s Map %*s %*s %s on Turn %d",conquer_version,which,who,&turn)!=4)
+ error("Bad title line (wrong version?) '%s'",line);
+
+ for(mapid=1;mapid < num_mapnames;mapid++)
+ if(!strcmp(mapnames[mapid],which))
+ break;
+
+ if ( mapid==num_mapnames)
+ mapid= 0;
+ else if ( trace && !pipe)
+ printf("Found %s map\n", which);
+
+ if(!strcmp(who,"World"))
+ nation="god";
+ else
+ nation=who;
+
+ tracef("Nation is %s\n",nation);
+
+ return mapid;
+ }
+
+/*********************************************************************
+* *
+* Find maps in a file and store away a file pointer and offset for *
+* each *
+* *
+*********************************************************************/
+
+void
+process_map_file(name)
+
+char *name;
+
+{
+ int which;
+ FILE *f;
+ char line[1024];
+
+ tracef("Searching file %s\n",name);
+
+ if ((f=fopen(name,"r"))==NULL)
+ ioerror("Can't open map file '%s'",name);
+
+ while(1)
+ {
+ long top;
+
+ which=scan_header(f,0);
+
+ if(which==0)
+ error("Bad map file '%s'",name);
+
+ myopen(which,f);
+ top=ftell(f);
+ while(fgets(line,1024,f)!=NULL)
+ {
+ if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
+ break;
+ top=ftell(f);
+ }
+
+ if(feof(f))
+ break;
+
+ fseek(f,top,0);
+ }
+ }
+
+/*********************************************************************
+* *
+* Get a map. If the map was not in one of the files on the command *
+* line it runs conquer -p to get it. *
+* *
+* Which selects the map. *
+* Args are passed to conqrun. *
+* Tmpname is the name of a temporary file to use. This is *
+* deleted in this routine so you can reuse the name. *
+* *
+* All except `which' are ignored if the user has given a map *
+* file of the correct type as an argumant. *
+* *
+*********************************************************************/
+
+int
+get_map_file(which,args,tmpname)
+
+int which;
+char *args;
+char *tmpname;
+
+{
+ char command[100];
+ FILE *tmp;
+
+ if ( ! myisopen(which))
+ {
+ if (nation==NULL)
+ {
+ tracef("Assuming god\n");
+
+ nation="god";
+ }
+
+ tracef("Asking conquer for %s map\n",mapnames[which]);
+
+ if (passwd==NULL)
+ {
+ passwd=getpass("Enter conquer password: ");
+ }
+
+ tracef("Disconnecting ( HACK! ) bye bye\n");
+
+ disconnect(); /* disconnect from controling tty */
+ /* ( hack for getpass ) */
+
+ if (bg) /* go into background if asked */
+ {
+ tracef("Going into background\n");
+
+ background();
+ }
+
+ sprintf(command,"conquer -p %s > %s 2>/dev/null",args,tmpname);
+
+ if((tmp=popen(command,"w"))==NULL)
+ ioerror("can't run conquer");
+
+ if (fprintf(tmp,"%s\n%s\n%c\n",nation,passwd, which+'0')==EOF)
+ error("Couldn't get map. Conquer may be updating.\n");
+
+ pclose(tmp);
+
+ if((tmp=fopen(tmpname,"r"))==NULL)
+ ioerror("can't open %s",tmpname);
+
+ unlink(tmpname); /* delete it */
+
+ (void)scan_header(tmp,1);
+ myopen(which,tmp);
+ }
+
+ return which;
+ }
+
+/*ARGSUSED*/
+main(argc,argv)
+
+int argc;
+char *argv[];
+
+{
+ char line[1024];
+ char desline[1024];
+ char tmpname[20];
+ char args[100];
+ char *screen_name=get_default_screen_name();
+ screen_type screen=NULL;
+ int mapfile;
+ int destmapfile;
+ int mag=11;
+ bitmap pr;
+ int width,height;
+ extern char *myname;
+ int x,y,i,j,val;
+ char c;
+ char *mapname=NULL;
+ char *world=NULL;
+ int do_nations=0,barbarians=0,markbarbs=0;
+ int all=0,live=0,altitude=1;
+ int desig=0;
+ int do_title=1;
+ font titlefont;
+ int boldtitle=0; /* indicates that the title font should be
+ emboldened - ie `titlefont' is roman and
+ so _we_ must do the bold */
+
+
+ myname=argv[0];
+
+ strcpy(args,"");
+
+ while(*(++argv)!=NULL)
+ if (!strncmp(*argv,"-o",2))
+ {
+ mapname= *(++argv);
+ if ( is_screenname(mapname))
+ {
+ screen_name=mapname;
+ mapname=NULL;
+ }
+ }
+ else if (!strcmp(*argv,"-l"))
+ live++;
+ else if (!strcmp(*argv,"-D"))
+ sprintf(args,"%s -d %s",args,world= *(++argv));
+ else if (!strcmp(*argv,"-N"))
+ nation= *(++argv);
+ else if (!strcmp(*argv,"-bg"))
+ bg++;
+ else if (!strcmp(*argv,"-a"))
+ altitude=0;
+ else if (!strcmp(*argv,"-f"))
+ {
+ char *which= *(++argv), *fontname= *(++argv);
+ set_a_font(which,fontname);
+ }
+ else if (!strncmp(*argv,"-b",2))
+ {
+ barbarians++;
+ if ( (*argv)[2]=='a')
+ markbarbs++;
+ }
+ else if (!strcmp(*argv,"-m"))
+ mag=atoi(*(++argv));
+ else if (!strncmp(*argv,"-c",2))
+ {
+ c=(*argv)[2];
+ for (i=0;;i++)
+ {
+ if (values[i].c =='\0')
+ error("Unknown contour '%c'",c);
+ else if ( values[i].c == c)
+ {
+ values[i].val=atoi(*(++argv));
+ break;
+ }
+ }
+ }
+ else if (!strncmp(*argv,"-n",2))
+ {
+ do_nations++;
+ if ( (*argv)[2]=='a')
+ ++all;
+ }
+ else if (!strncmp(*argv,"-d",2))
+ {
+ desig++;
+ }
+ else if (!strcmp(*argv,"-h"))
+ help_message(myname);
+ else if (!strcmp(*argv,"-t"))
+ do_title=0;
+ else if (!strcmp(*argv,"-v"))
+ trace++;
+ else if ( (*argv)[0]=='-')
+ {
+ printf("Unknown option '%s'\n",*argv);
+ help_message(myname);
+ }
+ else
+ process_map_file(*argv);
+
+ if (do_nations) /* if we have to put in nations */
+ set_default_fonts(mag,f_nation);
+
+ if (desig)
+ {
+ if (all)
+ error("Only one of -d and -na allowed!");
+
+ set_default_fonts(mag,f_designation);
+ }
+
+ if (do_title)
+ {
+ set_default_fonts(mag+2,f_title);
+ if ( (titlefont=font_table[(unsigned)f_title].boldfont)==NULL)
+ {
+ boldtitle=1;
+ titlefont=font_table[(unsigned)f_title].romanfont;
+ }
+
+ }
+
+ screen=screen_named(screen_name);
+
+ sprintf(tmpname,"/tmp/conq%d",getpid());
+
+ mapfile=get_map_file(altitude?1:3, /* get a map */
+ args,tmpname);
+
+ if(mygets(line,1024,mapfile)==NULL)
+ error("empty map!");
+
+ width=strlen(line)-1; /* count height and width */
+
+ for(height=1;mygets(line,1024,mapfile)!=NULL;height++)
+ if(!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH)||
+ !strncmp(line,"reading",7))
+ break;
+
+ tracef("Size %d X %d, image %d X %d\n",width,height,width*mag,height*mag);
+
+ initialise_bitmaps();
+
+ if(live) /* if live do it on the screen */
+ {
+ if ((pr=get_screen_bitmap(screen))==(bitmap)NULL)
+ ioerror("Can't open screen %s",screen_name);
+ }
+ else /* otherwise in memory */
+ pr=create_bitmap(width*mag,total_height);
+
+ myrewind(mapfile);
+
+ if (altitude) /* if needed do altitude */
+ {
+ int xx,yy;
+ tracef("Drawing topography\n");
+
+ build_dither_matrix(MAXDITHER);
+
+ yy=yoffset(0);
+ for(y=0;y=val?1:0);
+ }
+ }
+ }
+
+ myclose(mapfile);
+ }
+
+ if(do_nations||desig) /* nations */
+ {
+ font nf, bnf;
+ font df;
+ int xx,yy;
+ char des,
+ current='\0'; /* keeps track of which nation we are in */
+ char last[1024]; /* ditto vertically for each column */
+
+ tracef("Drawing nations\n");
+
+ if (do_nations)
+ {
+ nf = font_table[(unsigned)f_nation].romanfont;
+ bnf = font_table[(unsigned)f_nation].boldfont;
+ }
+
+ if (desig)
+ {
+ df = font_table[(unsigned)f_designation].romanfont;
+ }
+
+ if (altitude) /* if no altitude this was gotten to */
+ /* count the size */
+ mapfile=get_map_file(3,args,tmpname);
+
+ destmapfile=get_map_file(4,args,tmpname);
+
+ yy=yoffset(mag);
+ for(y=0;y
+#include
+#include
+
+/* int errno; */
+/* char *sys_errlist[]; */
+
+char *myname="Someone";
+
+/*VARARGS1*/
+void
+ioerror(str,arg1,arg2,arg3)
+
+char *str;
+int arg1, arg2, arg3;
+
+{
+fprintf(stderr,"%s: ",myname);
+fprintf(stderr,str,arg1,arg2,arg3);
+fprintf(stderr," - %s\n",sys_errlist[errno]);
+exit(1);
+}
+
+/*VARARGS1*/
+void
+error(str,arg1,arg2,arg3)
+
+char *str;
+int arg1, arg2, arg3;
+
+{
+fprintf(stderr,"%s: ",myname);
+fprintf(stderr,str,arg1,arg2,arg3);
+fputc('\n',stderr);
+exit(1);
+}
+
diff --git a/gpl-release/utilities/backup/error.c.bak b/gpl-release/utilities/backup/error.c.bak
new file mode 100644
index 0000000..c6ce34f
--- /dev/null
+++ b/gpl-release/utilities/backup/error.c.bak
@@ -0,0 +1,58 @@
+/*
+ * error.c - Game functionality module
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+
+/* int errno; */
+/* char *sys_errlist[]; */
+
+char *myname="Someone";
+
+/*VARARGS1*/
+void
+ioerror(str,arg1,arg2,arg3)
+
+char *str;
+int arg1, arg2, arg3;
+
+{
+fprintf(stderr,"%s: ",myname);
+fprintf(stderr,str,arg1,arg2,arg3);
+fprintf(stderr," - %s\n",sys_errlist[errno]);
+exit(1);
+}
+
+/*VARARGS1*/
+void
+error(str,arg1,arg2,arg3)
+
+char *str;
+int arg1, arg2, arg3;
+
+{
+fprintf(stderr,"%s: ",myname);
+fprintf(stderr,str,arg1,arg2,arg3);
+fputc('\n',stderr);
+exit(1);
+}
+
diff --git a/gpl-release/utilities/backup/file.c.backup b/gpl-release/utilities/backup/file.c.backup
new file mode 100644
index 0000000..0f9e948
--- /dev/null
+++ b/gpl-release/utilities/backup/file.c.backup
@@ -0,0 +1,90 @@
+#include
+#include "file.h"
+
+/*********************************************************************
+* *
+* All the my* routines mimic stdio routines but manipulate struct *
+* file's The point is that we can read from and otherwise manipulate *
+* more than one place in a file ( for more than one map ). *
+* *
+*********************************************************************/
+
+/*********************************************************************
+* *
+* struct file's play the roll of FILE *'s *
+* *
+*********************************************************************/
+
+#define MAX_FILES 10
+
+static struct file
+ {
+ FILE *fd; /* which file */
+ long offset, /* where are we reading from now */
+ top; /* where is the notional start */
+ } file_table[MAX_FILES];
+
+
+void
+myopen(which,file)
+
+int which;
+FILE *file;
+
+{
+file_table[which].fd=file;
+file_table[which].offset=file_table[which].top=ftell(file);
+}
+
+myisopen(which)
+
+int which;
+
+{
+return file_table[which].fd != NULL;
+}
+
+char *
+mygets(buffer,num,which)
+
+char *buffer;
+int num;
+int which;
+{
+ fseek(file_table[which].fd,file_table[which].offset,0);
+
+ buffer=fgets(buffer,num,file_table[which].fd);
+
+ file_table[which].offset=ftell(file_table[which].fd);
+
+ return buffer;
+ }
+
+void
+myrewind(which)
+
+int which;
+
+{
+ fseek(file_table[which].fd,file_table[which].top,0);
+ file_table[which].offset=file_table[which].top;
+ }
+
+void
+myclose(which)
+
+int which;
+
+{
+ int i;
+
+ for(i=0;i.
+ */
+
+#include
+#include "file.h"
+
+/*********************************************************************
+* *
+* All the my* routines mimic stdio routines but manipulate struct *
+* file's The point is that we can read from and otherwise manipulate *
+* more than one place in a file ( for more than one map ). *
+* *
+*********************************************************************/
+
+/*********************************************************************
+* *
+* struct file's play the roll of FILE *'s *
+* *
+*********************************************************************/
+
+#define MAX_FILES 10
+
+static struct file
+ {
+ FILE *fd; /* which file */
+ long offset, /* where are we reading from now */
+ top; /* where is the notional start */
+ } file_table[MAX_FILES];
+
+
+void
+myopen(which,file)
+
+int which;
+FILE *file;
+
+{
+file_table[which].fd=file;
+file_table[which].offset=file_table[which].top=ftell(file);
+}
+
+myisopen(which)
+
+int which;
+
+{
+return file_table[which].fd != NULL;
+}
+
+char *
+mygets(buffer,num,which)
+
+char *buffer;
+int num;
+int which;
+{
+ fseek(file_table[which].fd,file_table[which].offset,0);
+
+ buffer=fgets(buffer,num,file_table[which].fd);
+
+ file_table[which].offset=ftell(file_table[which].fd);
+
+ return buffer;
+ }
+
+void
+myrewind(which)
+
+int which;
+
+{
+ fseek(file_table[which].fd,file_table[which].top,0);
+ file_table[which].offset=file_table[which].top;
+ }
+
+void
+myclose(which)
+
+int which;
+
+{
+ int i;
+
+ for(i=0;i
+
+typedef struct pixrect * bitmap;
+typedef char * screen_type;
+typedef struct pixfont * font;
+
+#define initialise_bitmaps() /* EMPTY */
+#define finish_bitmaps() /* EMPTY */
+
+#define is_screenname(mapname) (!strncmp(mapname,"/dev/",5))
+#define get_default_screen_name() "/dev/fb"
+#define screen_named(name) (name)
+#define get_screen_bitmap(screen) (pr_open(screen))
+#define create_bitmap(width,height) (mem_create(width,height,1))
+#define destroy_bitmap(bitmap) pr_close(bitmap)
+#define font_named(name) pf_open(name)
+#define bad_font(font) ((font)==NULL)
+#define font_height(font) ((font->pf_defaultsize).y)
+#define font_width(font) ((font->pf_defaultsize).x)
+#define font_baseline(font) (0-(font->pf_char)['A'].pc_home.y+1)
+
+#define BLACK PIX_SET
+#define WHITE PIX_CLR
+#define DRAW_BLACK (PIX_DST|PIX_SRC)
+#define DRAW_WHITE (PIX_DST&PIX_NOT(PIX_SRC))
+
+#define set_bit(bitmap,x,y,val) pr_put(bitmap,x,y,val)
+#define draw_line(bitmap,x1,y1,x2,y2,colour) pr_vector(bitmap,x1,y1,x2,y2,colour,0)
diff --git a/gpl-release/utilities/backup/sunconqrast.h.bak b/gpl-release/utilities/backup/sunconqrast.h.bak
new file mode 100644
index 0000000..c4f9e22
--- /dev/null
+++ b/gpl-release/utilities/backup/sunconqrast.h.bak
@@ -0,0 +1,52 @@
+/*
+ * sunconqrast.h - Header file with definitions and prototypes
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#define driver_version "1"
+#define conqrast_name "Sunconqrast"
+
+#include
+
+typedef struct pixrect * bitmap;
+typedef char * screen_type;
+typedef struct pixfont * font;
+
+#define initialise_bitmaps() /* EMPTY */
+#define finish_bitmaps() /* EMPTY */
+
+#define is_screenname(mapname) (!strncmp(mapname,"/dev/",5))
+#define get_default_screen_name() "/dev/fb"
+#define screen_named(name) (name)
+#define get_screen_bitmap(screen) (pr_open(screen))
+#define create_bitmap(width,height) (mem_create(width,height,1))
+#define destroy_bitmap(bitmap) pr_close(bitmap)
+#define font_named(name) pf_open(name)
+#define bad_font(font) ((font)==NULL)
+#define font_height(font) ((font->pf_defaultsize).y)
+#define font_width(font) ((font->pf_defaultsize).x)
+#define font_baseline(font) (0-(font->pf_char)['A'].pc_home.y+1)
+
+#define BLACK PIX_SET
+#define WHITE PIX_CLR
+#define DRAW_BLACK (PIX_DST|PIX_SRC)
+#define DRAW_WHITE (PIX_DST&PIX_NOT(PIX_SRC))
+
+#define set_bit(bitmap,x,y,val) pr_put(bitmap,x,y,val)
+#define draw_line(bitmap,x1,y1,x2,y2,colour) pr_vector(bitmap,x1,y1,x2,y2,colour,0)
diff --git a/gpl-release/utilities/backup/sunstuff.c.backup b/gpl-release/utilities/backup/sunstuff.c.backup
new file mode 100644
index 0000000..f8a5921
--- /dev/null
+++ b/gpl-release/utilities/backup/sunstuff.c.backup
@@ -0,0 +1,93 @@
+#include
+#include "sunconqrast.h"
+
+struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *font,*bold;
+ } fonts[] =
+ {
+ 9, "/usr/lib/fonts/fixedwidthfonts/screen.r.7", NULL,
+ 11, "/usr/lib/fonts/fixedwidthfonts/cour.r.10",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.10",
+ 12, "/usr/lib/fonts/fixedwidthfonts/cour.r.12",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.12",
+ 14, "/usr/lib/fonts/fixedwidthfonts/cour.r.14",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.14",
+ 16, "/usr/lib/fonts/fixedwidthfonts/cour.r.16",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.16",
+ 18, "/usr/lib/fonts/fixedwidthfonts/cour.r.18",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.18",
+ 22, "/usr/lib/fonts/fixedwidthfonts/cour.r.24",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.24",
+ 999999, NULL
+ };
+
+static int encoding_type = RT_STANDARD ;
+
+int
+argument_parse(argv)
+
+char *argv[];
+
+{
+if ( !strcmp(*argv,"-compact"))
+ {
+ encoding_type = RT_BYTE_ENCODED ;
+ return 1;
+ }
+else
+ return 0;
+}
+
+/*ARGSUSED*/
+int
+write_bitmap(bm,file,width,height)
+
+bitmap bm;
+char *file;
+int width,height;
+
+{
+ FILE *f;
+
+ if ((f=fopen(file,"w"))==NULL)
+ ioerror("Can't open output file %s",file);
+
+ return pr_dump( bm, f, RMT_NONE, encoding_type,0);
+ }
+
+
+
+void
+display_bitmap(bm,x,y,w,h)
+
+bitmap bm;
+int x,y,w,h;
+
+{
+ struct pixrect *screen=pr_open("/dev/fb");
+
+ pr_rop(screen,x,y,w,h,PIX_SRC,bm,0,0);
+
+ }
+
+bitmap_text(pr,x,y,colour,pf,str)
+
+bitmap pr;
+int x,y;
+int colour;
+font pf;
+char *str;
+
+{
+ struct pr_prpos pos;
+
+ pos.pos.x=x;
+ pos.pos.y=y;
+ pos.pr=pr;
+
+ pf_text(pos,colour,pf,str);
+ }
+
diff --git a/gpl-release/utilities/backup/sunstuff.c.bak b/gpl-release/utilities/backup/sunstuff.c.bak
new file mode 100644
index 0000000..bf86175
--- /dev/null
+++ b/gpl-release/utilities/backup/sunstuff.c.bak
@@ -0,0 +1,114 @@
+/*
+ * sunstuff.c - Game functionality module
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include "sunconqrast.h"
+
+struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *font,*bold;
+ } fonts[] =
+ {
+ 9, "/usr/lib/fonts/fixedwidthfonts/screen.r.7", NULL,
+ 11, "/usr/lib/fonts/fixedwidthfonts/cour.r.10",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.10",
+ 12, "/usr/lib/fonts/fixedwidthfonts/cour.r.12",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.12",
+ 14, "/usr/lib/fonts/fixedwidthfonts/cour.r.14",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.14",
+ 16, "/usr/lib/fonts/fixedwidthfonts/cour.r.16",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.16",
+ 18, "/usr/lib/fonts/fixedwidthfonts/cour.r.18",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.18",
+ 22, "/usr/lib/fonts/fixedwidthfonts/cour.r.24",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.24",
+ 999999, NULL
+ };
+
+static int encoding_type = RT_STANDARD ;
+
+int
+argument_parse(argv)
+
+char *argv[];
+
+{
+if ( !strcmp(*argv,"-compact"))
+ {
+ encoding_type = RT_BYTE_ENCODED ;
+ return 1;
+ }
+else
+ return 0;
+}
+
+/*ARGSUSED*/
+int
+write_bitmap(bm,file,width,height)
+
+bitmap bm;
+char *file;
+int width,height;
+
+{
+ FILE *f;
+
+ if ((f=fopen(file,"w"))==NULL)
+ ioerror("Can't open output file %s",file);
+
+ return pr_dump( bm, f, RMT_NONE, encoding_type,0);
+ }
+
+
+
+void
+display_bitmap(bm,x,y,w,h)
+
+bitmap bm;
+int x,y,w,h;
+
+{
+ struct pixrect *screen=pr_open("/dev/fb");
+
+ pr_rop(screen,x,y,w,h,PIX_SRC,bm,0,0);
+
+ }
+
+bitmap_text(pr,x,y,colour,pf,str)
+
+bitmap pr;
+int x,y;
+int colour;
+font pf;
+char *str;
+
+{
+ struct pr_prpos pos;
+
+ pos.pos.x=x;
+ pos.pos.y=y;
+ pos.pr=pr;
+
+ pf_text(pos,colour,pf,str);
+ }
+
diff --git a/gpl-release/utilities/backup/util.c.backup b/gpl-release/utilities/backup/util.c.backup
new file mode 100644
index 0000000..54c7548
--- /dev/null
+++ b/gpl-release/utilities/backup/util.c.backup
@@ -0,0 +1,112 @@
+#include
+#include
+#include
+
+/*********************************************************************
+* *
+* various utility bits split off to try and get conqrast.c down to a *
+* reasonable size *
+* *
+*********************************************************************/
+
+
+/*********************************************************************
+* *
+* routine to build the dither matrix used to shade *
+* *
+*********************************************************************/
+
+#define MAXDITHER 4 /* don't touch this */
+
+short dit[1<\n",me);
+ printf("\t\t-N \n");
+ printf("\t\t-D \n");
+ printf("\t\t-c \n");
+ printf("\t\t-f \n");
+ printf("\t\t-d -n{a} -b{a} -m -a -bg -l -t -v\n");
+ exit(1);
+ }
+
diff --git a/gpl-release/utilities/backup/util.c.bak b/gpl-release/utilities/backup/util.c.bak
new file mode 100644
index 0000000..7681da2
--- /dev/null
+++ b/gpl-release/utilities/backup/util.c.bak
@@ -0,0 +1,133 @@
+/*
+ * util.c - Game functionality module
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+
+/*********************************************************************
+* *
+* various utility bits split off to try and get conqrast.c down to a *
+* reasonable size *
+* *
+*********************************************************************/
+
+
+/*********************************************************************
+* *
+* routine to build the dither matrix used to shade *
+* *
+*********************************************************************/
+
+#define MAXDITHER 4 /* don't touch this */
+
+short dit[1<\n",me);
+ printf("\t\t-N \n");
+ printf("\t\t-D \n");
+ printf("\t\t-c \n");
+ printf("\t\t-f \n");
+ printf("\t\t-d -n{a} -b{a} -m -a -bg -l -t -v\n");
+ exit(1);
+ }
+
diff --git a/gpl-release/utilities/backup/xconqrast.h.backup b/gpl-release/utilities/backup/xconqrast.h.backup
new file mode 100644
index 0000000..adb4744
--- /dev/null
+++ b/gpl-release/utilities/backup/xconqrast.h.backup
@@ -0,0 +1,37 @@
+
+/* header for X */
+
+#define driver_version "preliminary"
+#define conqrast_name "Xconqrast"
+
+#include
+
+typedef Drawable bitmap ;
+typedef Display *screen_type;
+typedef char *font; /* this needs doing */
+
+#define is_screenname(name) (index(name,':')!=NULL) /* I think */
+#define get_default_screen_name() NULL /* I have no idea */
+
+screen_type screen_named();
+
+bitmap get_screen_bitmap();
+bitmap create_bitmap();
+
+#define destroy_bitmap(bm) /* I don't know how to */
+#define font_named(name) (name) /* ditto */
+#define bad_font(font) ((font)==NULL) /* ??? */
+#define font_height(font) (0) /* ??? */
+#define font_width(font) (0) /* ??? */
+#define font_baseline(font) (0) /* ??? */
+
+#define BLACK (1)
+#define WHITE (0) /* guessing */
+#define DRAW_BLACK (1) /* ?? */
+#define DRAW_WHITE (2)
+
+void set_bit();
+
+#define draw_line(bitmap,x1,y1,x2,y2,colour) /* again no idea! */
+
+
diff --git a/gpl-release/utilities/backup/xconqrast.h.bak b/gpl-release/utilities/backup/xconqrast.h.bak
new file mode 100644
index 0000000..41e926b
--- /dev/null
+++ b/gpl-release/utilities/backup/xconqrast.h.bak
@@ -0,0 +1,55 @@
+/*
+ * xconqrast.h - Header file with definitions and prototypes
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#define driver_version "preliminary"
+#define conqrast_name "Xconqrast"
+
+#include
+
+typedef Drawable bitmap ;
+typedef Display *screen_type;
+typedef char *font; /* this needs doing */
+
+#define is_screenname(name) (index(name,':')!=NULL) /* I think */
+#define get_default_screen_name() NULL /* I have no idea */
+
+screen_type screen_named();
+
+bitmap get_screen_bitmap();
+bitmap create_bitmap();
+
+#define destroy_bitmap(bm) /* I don't know how to */
+#define font_named(name) (name) /* ditto */
+#define bad_font(font) ((font)==NULL) /* ??? */
+#define font_height(font) (0) /* ??? */
+#define font_width(font) (0) /* ??? */
+#define font_baseline(font) (0) /* ??? */
+
+#define BLACK (1)
+#define WHITE (0) /* guessing */
+#define DRAW_BLACK (1) /* ?? */
+#define DRAW_WHITE (2)
+
+void set_bit();
+
+#define draw_line(bitmap,x1,y1,x2,y2,colour) /* again no idea! */
+
+
diff --git a/gpl-release/utilities/backup/xstuff.c.backup b/gpl-release/utilities/backup/xstuff.c.backup
new file mode 100644
index 0000000..2e61455
--- /dev/null
+++ b/gpl-release/utilities/backup/xstuff.c.backup
@@ -0,0 +1,154 @@
+#include
+#include "xconqrast.h"
+
+/* utilities for X */
+
+Display *display;
+Drawable root;
+int screen;
+GC gc;
+short greyscale;
+
+struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *font,*bold;
+ } fonts[] = /* copied from the sun driver! need replacing */
+ {
+ 9, "/usr/lib/fonts/fixedwidthfonts/screen.r.7", NULL,
+ 11, "/usr/lib/fonts/fixedwidthfonts/cour.r.10",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.10",
+ 12, "/usr/lib/fonts/fixedwidthfonts/cour.r.12",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.12",
+ 14, "/usr/lib/fonts/fixedwidthfonts/cour.r.14",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.14",
+ 16, "/usr/lib/fonts/fixedwidthfonts/cour.r.16",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.16",
+ 18, "/usr/lib/fonts/fixedwidthfonts/cour.r.18",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.18",
+ 22, "/usr/lib/fonts/fixedwidthfonts/cour.r.24",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.24",
+ 999999, NULL
+ };
+
+int
+argument_parse(argv)
+
+char *argv[];
+
+{
+return 0;
+}
+
+void
+initialise_bitmaps()
+
+
+
+
+{
+ }
+
+screen_type
+screen_named(name)
+
+char *name;
+
+{
+int sc;
+
+if ((display=XOpenDisplay(name)) == NULL)
+ error("No X server!");
+
+root=XDefaultRootWindow(display);
+sc=XDefaultScreen(display);
+gc=XDefaultGC(display,sc);
+
+return display;
+}
+
+bitmap
+get_screen_bitmap(screen)
+
+screen_type screen;
+
+{
+int sc;
+return root;
+}
+
+bitmap
+create_bitmap(width,height)
+
+int width,height;
+
+{
+int depth=1;
+
+if ( depth != 1 )
+ greyscale=1;
+
+return XCreatePixmap(display,root,width,height,depth);
+}
+
+void
+set_bit(bm,x,y,val)
+
+bitmap bm;
+int x,y;
+int val;
+
+{
+
+if (!greyscale )
+ {
+ XSetForeground(display,gc,(unsigned long)val);
+ XDrawPoint(display,bm,gc,x,y);
+ }
+else
+ if (val)
+ XDrawPoint(display,bm,gc,x,y);
+}
+
+void
+display_bitmap( bm,x,y,width,height)
+
+bitmap bm;
+int x,y,width,height;
+
+{
+XCopyArea(display,bm,root,gc,0,0,width,height,x,y);
+ }
+
+int
+write_bitmap(bm,file,width,height)
+
+bitmap bm;
+char *file;
+int width,height;
+{
+
+return XWriteBitmapFile(display,file,bm,width,height,-1,-1);
+ }
+
+
+void
+finish_bitmaps()
+
+{
+XCloseDisplay(display);
+}
+
+bitmap_text(bm,x,y,colour,pf,str)
+
+bitmap bm;
+int x,y;
+int colour;
+font pf;
+char *str;
+
+{
+ /* ??? */
+ }
+
diff --git a/gpl-release/utilities/backup/xstuff.c.bak b/gpl-release/utilities/backup/xstuff.c.bak
new file mode 100644
index 0000000..f8eb7a8
--- /dev/null
+++ b/gpl-release/utilities/backup/xstuff.c.bak
@@ -0,0 +1,175 @@
+/*
+ * xstuff.c - Game functionality module
+ *
+ * This file is part of Conquer.
+ * Originally Copyright (C) 1988-1989 by Edward M. Barlow and Adam Bryant
+ * Copyright (C) 2024 [Your Name] - Licensed under GPL v3 with permission from original authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include "xconqrast.h"
+
+/* utilities for X */
+
+Display *display;
+Drawable root;
+int screen;
+GC gc;
+short greyscale;
+
+struct /* maps from size of map to the font */
+ /* to use */
+ { /* if size > mag use font */
+ int mag;
+ char *font,*bold;
+ } fonts[] = /* copied from the sun driver! need replacing */
+ {
+ 9, "/usr/lib/fonts/fixedwidthfonts/screen.r.7", NULL,
+ 11, "/usr/lib/fonts/fixedwidthfonts/cour.r.10",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.10",
+ 12, "/usr/lib/fonts/fixedwidthfonts/cour.r.12",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.12",
+ 14, "/usr/lib/fonts/fixedwidthfonts/cour.r.14",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.14",
+ 16, "/usr/lib/fonts/fixedwidthfonts/cour.r.16",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.16",
+ 18, "/usr/lib/fonts/fixedwidthfonts/cour.r.18",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.18",
+ 22, "/usr/lib/fonts/fixedwidthfonts/cour.r.24",
+ "/usr/lib/fonts/fixedwidthfonts/cour.b.24",
+ 999999, NULL
+ };
+
+int
+argument_parse(argv)
+
+char *argv[];
+
+{
+return 0;
+}
+
+void
+initialise_bitmaps()
+
+
+
+
+{
+ }
+
+screen_type
+screen_named(name)
+
+char *name;
+
+{
+int sc;
+
+if ((display=XOpenDisplay(name)) == NULL)
+ error("No X server!");
+
+root=XDefaultRootWindow(display);
+sc=XDefaultScreen(display);
+gc=XDefaultGC(display,sc);
+
+return display;
+}
+
+bitmap
+get_screen_bitmap(screen)
+
+screen_type screen;
+
+{
+int sc;
+return root;
+}
+
+bitmap
+create_bitmap(width,height)
+
+int width,height;
+
+{
+int depth=1;
+
+if ( depth != 1 )
+ greyscale=1;
+
+return XCreatePixmap(display,root,width,height,depth);
+}
+
+void
+set_bit(bm,x,y,val)
+
+bitmap bm;
+int x,y;
+int val;
+
+{
+
+if (!greyscale )
+ {
+ XSetForeground(display,gc,(unsigned long)val);
+ XDrawPoint(display,bm,gc,x,y);
+ }
+else
+ if (val)
+ XDrawPoint(display,bm,gc,x,y);
+}
+
+void
+display_bitmap( bm,x,y,width,height)
+
+bitmap bm;
+int x,y,width,height;
+
+{
+XCopyArea(display,bm,root,gc,0,0,width,height,x,y);
+ }
+
+int
+write_bitmap(bm,file,width,height)
+
+bitmap bm;
+char *file;
+int width,height;
+{
+
+return XWriteBitmapFile(display,file,bm,width,height,-1,-1);
+ }
+
+
+void
+finish_bitmaps()
+
+{
+XCloseDisplay(display);
+}
+
+bitmap_text(bm,x,y,colour,pf,str)
+
+bitmap bm;
+int x,y;
+int colour;
+font pf;
+char *str;
+
+{
+ /* ??? */
+ }
+
diff --git a/utilities/conqrast.c b/gpl-release/utilities/conqrast.c
similarity index 100%
rename from utilities/conqrast.c
rename to gpl-release/utilities/conqrast.c
diff --git a/utilities/conqrast.man b/gpl-release/utilities/conqrast.man
similarity index 100%
rename from utilities/conqrast.man
rename to gpl-release/utilities/conqrast.man
diff --git a/utilities/error.c b/gpl-release/utilities/error.c
similarity index 100%
rename from utilities/error.c
rename to gpl-release/utilities/error.c
diff --git a/utilities/file.c b/gpl-release/utilities/file.c
similarity index 100%
rename from utilities/file.c
rename to gpl-release/utilities/file.c
diff --git a/utilities/file.h b/gpl-release/utilities/file.h
similarity index 100%
rename from utilities/file.h
rename to gpl-release/utilities/file.h
diff --git a/utilities/sunconqrast.h b/gpl-release/utilities/sunconqrast.h
similarity index 100%
rename from utilities/sunconqrast.h
rename to gpl-release/utilities/sunconqrast.h
diff --git a/utilities/sunstuff.c b/gpl-release/utilities/sunstuff.c
similarity index 100%
rename from utilities/sunstuff.c
rename to gpl-release/utilities/sunstuff.c
diff --git a/utilities/util.c b/gpl-release/utilities/util.c
similarity index 100%
rename from utilities/util.c
rename to gpl-release/utilities/util.c
diff --git a/utilities/xconqrast.h b/gpl-release/utilities/xconqrast.h
similarity index 100%
rename from utilities/xconqrast.h
rename to gpl-release/utilities/xconqrast.h
diff --git a/utilities/xstuff.c b/gpl-release/utilities/xstuff.c
similarity index 100%
rename from utilities/xstuff.c
rename to gpl-release/utilities/xstuff.c
diff --git a/original/CONQPS.INFO b/original/CONQPS.INFO
new file mode 100644
index 0000000..5a52f57
--- /dev/null
+++ b/original/CONQPS.INFO
@@ -0,0 +1,88 @@
+
+
+ Description
+
+The conqps program translates maps from conquer to postscript suitable for
+printing on a postscript printer. Conqps can act as a filter, or you
+can give filenames to it. There is a lot of options to customise the output.
+But the only option you should remember is the h option, which gives
+a brief desription of all the options. If you are anxious to try it out
+just type 'conquer -p | conqps >psmap' which should give you a file called
+psmap, which can be sent to a postscript printer. There is a limitation of how
+big the maps may be, this lies in the postscript language. But at our
+site I have been able to print 256x256 maps (I haven't tried bigger) on
+a LaserWriter II.
+
+ Options
+
+ There is a lot of options, but you don't need to know all of them. Some
+ options were put in to let advanced users get more control over the output.
+ Valid options are 'cfghlLnopstuvWXY'. They do the following:
+
+ c Turns off printing of coordinates around the edge of the map.
+
+ f fontname Sets the font to 'fontname', you can use any font that is in your
+ printer. Default is Times-Roman. The program also looks for
+ the environment variable CONQ_PSFONT. The f option overrides
+ both the default and the environment variable.
+
+ g Turns off printing of the grid at the unknown parts of the map.
+
+ h Shows a brief description of the options and some defaults.
+
+ l If you print larger maps it's possible to exhaust the memory of your
+ printer. This option uses a feature in the Apple LaserWriter which
+ conserves memory, but gives you a smaller map. This option is not
+ fully tested, and should probably not be used.
+
+ n Normally the map is centered around the parts of the world you know.
+ This option turns off this feature, and lets the program do as it
+ damn well pleases with your map :-)
+
+ o x,y If you want to print just a small part of a bigger map use this
+ option. It makes conqps just to produce one page centered around
+ coordinates x,y.
+
+ p type Sets the type of paper you have in the printer. Possible values
+ today are: A4 (European standard) LETTER (American standard) or
+ OTHER (should be local standard). You shouldn't have to use this
+ option since the person who maintains conquer at your site should
+ have set the right papersize as default (This is done in the
+ Makefile).
+
+ s size Sets the size of each square of the map. This is useful to get
+ more map printed on fewer pages, but it will be smaller.
+ Default value is 9.
+
+ t string Conqps tries to guess a nice title to the map for you. Normally
+ this is something like 'Designation Map for Nation Midkemia on
+ Turn 2' (this title is actually provided from the conquer program).
+ If however you would like to have your own title shown, just use
+ the t option, which replaces the default title with string.
+
+ u Normally conqps put small pictures in some of your squares instead of
+ just letters. This option forces conqps not to do this, but instead
+ print the letters.
+
+ v Puts conqps in verbose mode. For example you will be told how big the map
+ is and how big it will be on the printer.
+
+ L,W,X,Y If none of the paper types fits your needs you can alter the size
+ directly with these options. All these options use one postscript
+ point (1/72 inch) as their unit. L sets the length of the page.
+ W sets the width. X sets the x coordinate for the leftmost viewable
+ pixel on the output, and Y sets the y coordinate. These options
+ are normally never used, instead you should experiment with
+ the p option.
+
+ Bugs
+
+ Hopefully no.
+
+
+ Comments
+
+ If you have any comments or ideas mail them to d8forma@dtek.chalmers.se .
+
+ MaF
+
diff --git a/original/MANIFEST b/original/MANIFEST
new file mode 100644
index 0000000..0b7091d
--- /dev/null
+++ b/original/MANIFEST
@@ -0,0 +1,45 @@
+ File Name Archive # Description
+-----------------------------------------------------------
+ MANIFEST 1 This shipping list
+ Makefile 14
+ README 1
+ admin.c 9
+ cexecute.c 14
+ check.c 9
+ combat.c 4
+ commands.c 6
+ data.c 13
+ data.h 8
+ display.c 11
+ extcmds.c 2
+ forms.c 13
+ header.h 13
+ io.c 4
+ magic.c 8
+ main.c 10
+ makeworl.c 9
+ man.pag 14
+ misc.c 3
+ move.c 7
+ nations 6
+ navy.c 3
+ newhelp.c 12
+ newlogin.c 7
+ newlogin.h 9
+ notes.v4 2
+ npc.c 5
+ patchlevel.h 1
+ randeven.c 11
+ reports.c 10
+ rules 12
+ run 4
+ sort.c 14
+ spew.c 12
+ trade.c 12
+ txt0 13
+ txt1 5
+ txt2 6
+ txt3 14
+ txt4 7
+ txt5 11
+ update.c 1
diff --git a/original/Makefile b/original/Makefile
new file mode 100644
index 0000000..95c7c17
--- /dev/null
+++ b/original/Makefile
@@ -0,0 +1,359 @@
+# conquer: Copyright (c) 1989 by Edward M Barlow
+#
+# BY CHANGING THIS FILE, YOU AGREE TO ABIDE BY THE LIMITATIONS STATED IN
+# THE LIMITED USE CONTRACT CONTAINED IN THE FILE "header.h"
+#
+# Make sure to set your desired configuration by
+# editing the file "header.h".
+#
+# This makefile has been modified to allow compilation using
+# a parallelized make program. It has been used successfully
+# on an Encore Multimax parallel computer with both 4 and
+# 6 cpus.
+#
+# It should pose no problems for non parallel makes.
+#
+# Please report any problems to adb@bucsf.bu.edu
+# or adb@bu-cs.bu.edu
+#
+# Conquer news mailing list: conquer-news-request@bu-cs.bu.edu.
+#
+MAKE = /usr/bin/make
+CC = /usr/bin/gcc
+RM = /bin/rm -f
+
+# LN must be "ln -s" if source and default directories span disks
+LN = /bin/ln
+CP = /bin/cp
+NULL = 2>/dev/null
+
+# Flags to lint
+LTFLG = -h -lcurses
+
+# Options for the postscript map printing program.
+# The file 'conqps.ps' will be installed in the EXEDIR
+# directory which is determined below.
+#
+# To avoid building this program, remove $(PSPROG) from
+# both the 'all:' list and the 'install:' list
+PSPROG = conqps
+PSSRC = psmap.c
+PSHEAD = psmap.h
+PSDATA = psmap.ps
+# Default Pagesize Setting:
+# A4 for European page size.
+# LETTER for American page size.
+# OTHER for Local page size. [edit conqps.h]
+PSPAGE = LETTER
+
+# Options for shar program, SHARLIM is limit of each shar
+# file created in kilobytes and SHARNAM is the prefix for
+# SHARFILE name.
+# [This is for a public domain shar from USENET, I can send
+# copies if you wish - adb@bu-cs.bu.edu]
+SHAR = /usr/bin/shar
+SHARLIM = 50
+SHARNAM = shar.
+SHARFLG = -D -c -l$(SHARLIM) -o$(SHARNAM)
+
+# This should be installed by whomever you want to own the game.
+# I recommend "games" or "root".
+
+# uncomment the next line if you dont have getopt in your library
+# (eg you are on a pc, or a non unix system). getopt.c is a
+# public domain software, and has not been tested by the authors
+# of conquer. [not distributed with conquer V4]
+#GETOPT = getopt.o
+
+#
+# libraries for BSD systems:
+LIBRARIES = -lcurses -ltermcap -lcrypt
+#
+# libraries for SYSV systems:
+#LIBRARIES = -lcurses
+#
+# libraries for Xenix systems:
+#LIBRARIES = -ltermlib -ltcap -lcrypt
+
+# CURRENT is this directory. The directory where the source
+# and Makefile are located
+CURRENT = /home/conquer/src
+
+# DEFAULT is the directory where default nations & help files will be
+# stored. It is also the default directory = where players will play
+# if they do not use the -d option.
+DEFAULT = /home/conquer/lib
+
+# This directory is where the executables will be stored
+EXEDIR = /home/conquer/bin
+
+# Definitions used for compiling conquer
+CDEFS = -DDEFAULTDIR=\"$(DEFAULT)\" -DEXEDIR=\"$(EXEDIR)\"
+
+# Options flag used for normal compilation
+OPTFLG = -O
+
+# Options flag used for debugging purposes
+# [make sure to comment out 'strip' commands in install section]
+#OPTFLG = -DDEBUG -g
+
+# this is the name of the user executable
+# the user executable contains commands for the games players
+GAME = conquer
+# this is the name of the administrative executable
+# the administrative executable contains commands for the game super user
+ADMIN = conqrun
+# this is the name of the sorting program which conquer uses
+SORT = conqsort
+
+# GAME IDENTIFICATION
+#
+# Set this to some unique identifier for each game you wish
+# to create via 'make new_game'. It will make a subdirectory
+# $(GAMEID) to the DEFAULT data directory where it will store
+# data for the new game. [Leave it blank to create the default
+# game]
+GAMEID =
+
+# AFILS are files needed for game updating...
+AFILS = combat.c cexecute.c io.c admin.c makeworl.c navy.c spew.c \
+newlogin.c update.c magic.c npc.c misc.c randeven.c data.c trade.c check.c
+AOBJS = combat.o cexecuteA.o ioA.o admin.o makeworl.o navyA.o spew.o \
+newlogin.o update.o magicA.o npc.o miscA.o randeven.o dataA.o \
+tradeA.o $(GETOPT) check.o
+
+# GFILS are files needed to run a normal interactive game
+GFILS = commands.c cexecute.c forms.c io.c main.c move.c navy.c \
+magic.c misc.c reports.c data.c display.c extcmds.c trade.c check.c
+GOBJS = commands.o cexecuteG.o forms.o ioG.o main.o move.o navyG.o \
+magicG.o miscG.o reports.o dataG.o display.o extcmds.o tradeG.o \
+$(GETOPT) check.o
+
+# List of temporary C files
+DAFILS = cexecuteA.c ioA.c miscA.c navyA.c magicA.c dataA.c tradeA.c
+DGFILS = cexecuteG.c ioG.c miscG.c navyG.c magicG.c dataG.c tradeG.c
+
+#txt[0-4] are input help files. help[0-4] are output. HELPSCR is sed script.
+HELP=txt
+HELPOUT=help
+HELPSCR=sed
+
+HEADERS=header.h data.h newlogin.h patchlevel.h
+SUPT1=nations Makefile $(HELP)[0-5] README run man.pag rules
+SUPT2=execute messages news commerce CONQPS.INFO
+ALLFILS=$(SUPT1) $(HEADERS) $(AFILS) commands.c forms.c main.c move.c \
+reports.c display.c extcmds.c newhelp.c sort.c getopt.c \
+$(PSSRC) $(PSHEAD) $(PSDATA)
+
+all: $(ADMIN) $(GAME) $(SORT) $(PSPROG) helpfile
+ @echo YAY! make new_game to set up permissions, zero appropriate
+ @echo initial files, move $(GAME) and $(ADMIN) to
+ @echo $(EXEDIR), and set up the world.
+ @echo If a game is in progress, make install will just move $(GAME)
+ @echo and $(ADMIN) to $(EXEDIR).
+ @echo
+
+$(ADMIN): $(AOBJS)
+ @echo phew...
+ -$(RM) $(DAFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling administrative functions
+ $(CC) $(OPTFLG) -o $(ADMIN) $(AOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(ADMIN)
+
+$(GAME): $(GOBJS)
+ @echo phew...
+ -$(RM) $(DGFILS) $(NULL)
+ @echo if the next command does not work you might also need -ltermcap
+ @echo === compiling user interface
+ $(CC) $(OPTFLG) -o $(GAME) $(GOBJS) $(LIBRARIES)
+# comment out the next line during debugging
+ strip $(GAME)
+
+$(SORT): sort.c
+ $(CC) $(OPTFLG) -o $(SORT) sort.c
+# comment out the next line if debugging
+ strip $(SORT)
+
+clobber:
+ -$(RM) *.o $(HELPOUT)[0-5] $(PSPROG) $(SORT) insthelp helpfile $(NULL)
+ -$(RM) newhelp in$(GAME) in$(SORT) in$(ADMIN) in$(PSPROG) $(NULL)
+ -$(RM) $(HELPSCR).[12] lint[ag] conquer.doc $(GAME) $(ADMIN) $(NULL)
+
+clean:
+ $(RM) *.o lint[ag] conquer.doc $(NULL)
+
+in$(GAME): $(GAME)
+ -$(RM) $(EXEDIR)/$(GAME)
+ mv $(GAME) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(GAME)
+ touch $(GAME)
+ touch in$(GAME)
+
+in$(ADMIN): $(ADMIN)
+ -$(RM) $(EXEDIR)/$(ADMIN)
+ mv $(ADMIN) $(EXEDIR)
+ chmod 4751 $(EXEDIR)/$(ADMIN)
+ touch $(ADMIN)
+ touch in$(ADMIN)
+
+in$(SORT): $(SORT)
+ -$(RM) $(EXEDIR)/$(SORT)
+ mv $(SORT) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(SORT)
+ touch $(SORT)
+ touch in$(SORT)
+
+in$(PSPROG): $(PSPROG)
+ -$(RM) $(EXEDIR)/$(PSPROG)
+ mv $(PSPROG) $(EXEDIR)
+ $(CP) $(PSDATA) $(EXEDIR)
+ chmod 751 $(EXEDIR)/$(PSPROG)
+ chmod 644 $(EXEDIR)/$(PSDATA)
+ touch $(PSPROG)
+ touch in$(PSPROG)
+
+install: in$(GAME) in$(ADMIN) in$(SORT) in$(PSPROG) insthelp instman
+ @echo ""
+ @echo "Installation complete"
+
+new_game: all insthelp
+ @echo Installing new game
+ -mkdir $(EXEDIR) $(NULL)
+ -mkdir $(DEFAULT) $(NULL)
+ -mkdir $(DEFAULT)/$(GAMEID) $(NULL)
+ chmod 755 $(EXEDIR)
+ chmod 750 $(DEFAULT)/$(GAMEID) $(DEFAULT)
+ $(CP) $(GAME) $(ADMIN) $(SORT) $(PSPROG) $(PSDATA) $(EXEDIR)
+ chmod 4755 $(EXEDIR)/$(GAME) $(EXEDIR)/$(ADMIN)
+ chmod 0755 $(EXEDIR)/$(SORT) $(EXEDIR)/$(PSPROG)
+ chmod 0644 $(EXEDIR)/$(PSDATA)
+ chmod 0600 nations
+ chmod 0700 run
+ $(CP) nations rules $(DEFAULT)/$(GAMEID)
+ $(CP) nations rules $(DEFAULT)
+ @echo now making the world
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -m
+ $(EXEDIR)/$(ADMIN) -d "$(GAMEID)" -a
+
+insthelp: helpfile
+ @echo Installing helpfiles
+ -$(RM) $(DEFAULT)/$(HELPOUT)0
+ -$(LN) $(CURRENT)/$(HELPOUT)0 $(DEFAULT)/$(HELPOUT)0
+ -$(RM) $(DEFAULT)/$(HELPOUT)1
+ -$(LN) $(CURRENT)/$(HELPOUT)1 $(DEFAULT)/$(HELPOUT)1
+ -$(RM) $(DEFAULT)/$(HELPOUT)2
+ -$(LN) $(CURRENT)/$(HELPOUT)2 $(DEFAULT)/$(HELPOUT)2
+ -$(RM) $(DEFAULT)/$(HELPOUT)3
+ -$(LN) $(CURRENT)/$(HELPOUT)3 $(DEFAULT)/$(HELPOUT)3
+ -$(RM) $(DEFAULT)/$(HELPOUT)4
+ -$(LN) $(CURRENT)/$(HELPOUT)4 $(DEFAULT)/$(HELPOUT)4
+ -$(RM) $(DEFAULT)/$(HELPOUT)5
+ -$(LN) $(CURRENT)/$(HELPOUT)5 $(DEFAULT)/$(HELPOUT)5
+ touch insthelp
+
+instman:
+ @echo Installing man pages
+ $(CP) man.pag $(EXEDIR)
+
+helpfile: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ @echo Helpfiles built
+ touch helpfile
+
+$(HELPOUT)0: $(HELP)0 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)0
+ cat $(HELP)0 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)0
+
+$(HELPOUT)1: $(HELP)1 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)1
+ cat $(HELP)1 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)1
+
+$(HELPOUT)2: $(HELP)2 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)2
+ cat $(HELP)2 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)2
+
+$(HELPOUT)3: $(HELP)3 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)3
+ cat $(HELP)3 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)3
+
+$(HELPOUT)4: $(HELP)4 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)4
+ cat $(HELP)4 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)4
+
+$(HELPOUT)5: $(HELP)5 $(HELPSCR).1 $(HELPSCR).2
+ @echo building $(HELPOUT)5
+ cat $(HELP)5 | sed -f $(HELPSCR).1 | sed -f $(HELPSCR).2 > $(HELPOUT)5
+
+$(HELPSCR).1: newhelp
+ newhelp
+
+$(HELPSCR).2: newhelp
+ newhelp
+
+newhelp: dataG.o newhelp.o
+ $(CC) $(OPTFLG) dataG.o newhelp.o -o newhelp
+ strip newhelp
+#
+# postscript map program
+PSOPTS = -DPSFILE=\"$(EXEDIR)/$(PSDATA)\" -D$(PSPAGE)
+#
+$(PSPROG): $(PSSRC) $(PSDATA) $(PSHEAD)
+ $(CC) $(OPTFLG) $(PSOPTS) $(PSSRC) -o $(PSPROG)
+# comment out the next line if debugging
+ strip $(PSPROG)
+
+lint:
+ lint $(LTFLG) $(CDEFS) -DCONQUER $(GFILS) > lintg
+ lint $(LTFLG) $(CDEFS) -DADMIN $(AFILS) > linta
+
+docs: conquer.doc
+
+conquer.doc: $(HELPOUT)0 $(HELPOUT)1 $(HELPOUT)2 $(HELPOUT)3 $(HELPOUT)4 $(HELPOUT)5
+ cat $(HELPOUT)? |sed -e "s/^DONE//g"|sed -e "s/^END//g" >conquer.doc
+
+cpio:
+ -$(RM) core
+ find . -name '*[CrpsEech]' -print | cpio -ocBv > cpiosv
+
+shar:
+ echo " lines words chars FILENAME" > MANIFEST
+ wc $(ALLFILS) >> MANIFEST
+ $(SHAR) $(SHARFLG) $(ALLFILS) MANIFEST
+
+.cA.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*A.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -c $*A.c ;\
+ $(RM) $*A.c )
+
+.cG.o: $<
+ ( trap "" 0 1 2 3 4 ; $(LN) $*.c $*G.c ;\
+ $(CC) $(OPTFLG) $(CDEFS) -DCONQUER -c $*G.c ;\
+ $(RM) $*G.c )
+
+.c.o: $<
+# compiles using both defines since they
+# are needed for the data.h definitions for
+# each file... but should not be needed for
+# the actual C source file being compiled
+ $(CC) $(OPTFLG) $(CDEFS) -DADMIN -DCONQUER -c $*.c
+
+$(GOBJS): data.h header.h
+
+$(AOBJS): data.h header.h
+
+ioG.o: data.h header.h patchlevel.h io.c
+
+ioA.o: data.h header.h patchlevel.h io.c
+
+newlogin.o: data.h header.h newlogin.h patchlevel.h newlogin.c
+
+main.o: data.h header.h patchlevel.h main.c
+
+newhelp.o: data.h header.h patchlevel.h newhelp.c
+
+# Clear suffixes
+.SUFFIXES:
+
+# Suffixes for conquer files.
+.SUFFIXES: A.o G.o .c .h .o
diff --git a/original/README b/original/README
new file mode 100644
index 0000000..2d137a6
--- /dev/null
+++ b/original/README
@@ -0,0 +1,202 @@
+ *********************************************************
+ * README FILE FOR THE INSTALLER OF CONQUER *
+ *********************************************************
+
+What you have here is a copyrighted release 4 version version of CONQUER.
+I make no guaranties to the sanity or style of this code, but do believe
+that it should work as documented. I have included numerous bugfixes
+from previous releases posting, and have added numerous enhancements.
+The file notes.v4 details changes between v3.5 and v4, bugs and other things.
+
+I have no current email address... Too bad. I will post a patch to THIS FILE
+when i get a new email address. The hazards of switching jobs. Adam Bryant
+has volunteered to take mail for the summer of 1989 at "arpa!bu-cs.bu.edu!adb"
+or "adb@bu-cs.bu.edu". He is the co-author of the game... so send comments to
+him. We like feedback on the game. Comments and feature requests are very
+useful to me as they are my primary method of deciding what to next add to the
+code. Your interest is appreciated.
+
+A mailing list for conquer has been set up to provide a platform for conquer
+discussion, and location for conquer test patch releases. The mailing list is
+"conquer-news@bu-cs.bu.edu" and addition to or deletions from the mailing
+list may be sent to "conquer-news-request@bu-cs.bu.edu".
+
+NOTE: My new phone number is 212-679-1439. My work has no arpanet. If anybody
+knows of a cheap (free??) way of getting an arpanet login I NEED ONE. I
+basically can make no more changes to Conquer until I can get a network port,
+and since i am "volunteering" my time for this project, I am not about to
+spend millions of dollars to buy one... I can get a modem for my PC if
+somebody will help me get a port somewhere. -ED-
+
+Included in this file are the following:
+ 1) A Brief Description of Conquer
+ 2) Installation (unpacking) Instructions
+ 3) Configuration Instructions
+ 4) Compilation Instructions
+ 5) Administration instructions
+ 6) Changes in this version
+
+This version should not be redistributed without the permission of Edward
+Barlow or Adam Bryant ( please read the copyright note in header.h ).
+
+Again, any comments or bug reports would be greatly appreciated.
+
+-----------------------------------------------------------
+I A Brief Description of Conquer
+-----------------------------------------------------------
+A complete description of Conquer v4 is contained in "man.page" and
+"conquer.docs". "conquer.docs" is created from the files txt[0-5] which are
+customized from data in the header files. These txt[] files are then
+converted int help[0-5] files, which contain configuration data. "make docs"
+will create this file from current data. Note conquer.doc IS NOT created
+program is compiled. I have tried to make the documentation as good as
+possible, but I guarantee that I have missed a lot. Consider this a feature
+and enjoy any (hopefully pleasant) suprises you get.
+-----------------------------------------------------------
+II Installation (unpacking) Instructions
+-----------------------------------------------------------
+This program came in several shell archive scripts. They can can be unpacked
+by using "sh filename". If you are reading this, you know this.
+
+If you suspect missing files, please check the MANIFEST.
+-----------------------------------------------------------
+III Configuration
+-----------------------------------------------------------
+THE FOLLOWING FILES SHOULD BE MODIFIED TO REFLECT YOUR ENVIRONMENT
+AND THE TYPE OF GAME YOU WISH TO PLAY. THE GAME WILL NOT RUN UNLESS
+YOU MODIFY THESE FILES APPROPRIATELY.
+
+header.h modify as per instructions
+Makefile modify as per instructions
+
+I have tried to comment this stuff appropriately.
+
+The options specified in these files will be reflected
+in the conquer.docs and help files when the program is compiled.
+
+You will probably also want to take a look at the "rules*" file. This
+contains the grammar rules for the random mail messages generated by
+NPC's. You may wish to insert some local people's names, or think of
+some really juicy insults. The format of the file should be obvious;
+basically %FOO declares a class FOO and one of the things inside that
+class will be selected randomly. Obviously, %MAIN is the top level which
+then calls on the subclasses to construct sentences.
+
+-----------------------------------------------------------
+IV Compilation Instructions
+-----------------------------------------------------------
+This program should be easy to compile. After header.h and Makefile have
+been edited properly, you may type 'make' to compile conquer, and
+'make new_game' to build and install a new game.
+
+Note: Sometimes curses does not include termcap or termlib. If all the
+ '.c' files get compiled, but do not link together, and
+ unreferenced symbol errors occur, try adding "-ltermcap" after
+ the "-lcurses" line in the makefile.
+
+Note2: With some versions of 'make' the SHELL environment variable is
+ read to determine under what shell jobs should be spawned. The
+ Makefile for conquer was written with '/bin/sh' in mind, so if
+ any "command not found" errors appear, doing a:
+ setenv SHELL /bin/sh
+ before typing 'make', might alleviate the problem.
+
+-----------------------------------------------------------
+V administration instructions
+-----------------------------------------------------------
+Now that you have compiled it, this is how you administer/set up/run the game.
+I recommend following these instructions once yourself in a mock game
+(ie. no other players) for a few turns to get things straight. Then you
+can add other players.
+
+The command line format for the administration commands is
+
+ conqrun [-maxp -dDIR -rSCENARIO]\n",argv[0]);
+ -m make a world
+ -a add new player
+ -x execute program
+ -d DIR to use play different game
+ -r SCENARIO read map while making a new world
+ uses SCENARIO.ele, SCENARIO.veg, & SCENARIO.nat
+
+Also, some useful god functions are provided through the conquer program
+through logging in as 'god' with 'conquer -n god'.
+
+Conquer now supports two layers of game administration: the god of
+conquer, as defined by the LOGIN define in header.h, may allow each
+world to have an administrator or demi-god. This demi-god will be able
+to perform updates and other god functions for this world only. This
+feature allows for multiple worlds, each governed by a different god.
+During the creation of a world, god will be prompted for the name of the
+demi-god for the new world. Just hitting return will mean that god will
+himself act as the demi-god for this world.
+
+Unlike godship, the demi-god for a world may be changed during the
+running of a game, without recompilation of conquer. This is done using
+the 'c'hange menu when logged in as god.
+
+In addition the the conqrun command, the makefile helps you as follows:
+
+make: Compiles the code.
+make clobber: Clobber everything but the source (destroys executables)
+make clean: Clean up objects (does not destroy executables)
+make new_game: Create a new game, make world, add players...
+make install: Install game in appropriate directory
+make docs: Creates documentation from help file
+
+Finally, I have included an 'at' script that permits automatic updating.
+run: read this shell script, it permits you to run the update
+ automatically. It needs to be modified for time to update.
+
+The command line for the conquer executable can be found by reading
+the help files.
+
+Again, prior to the compile, you should have followed the instructions
+in the Makefile and in header.h.
+
+You can administrate world either via "make new_game" or via:
+ this will make your world.
+ This also sets up npc nations as per the nations file
+ npc stats can be adjusted by editing nations
+ prior to making the world. Non player nations have
+ the same password as god.
+or this will make your world by using scenarios.
+ Basically, the scenarios include a nation file and
+ three map files (elevation, vegetation, and nation
+ setup). Look at the rome scenario included in the game.
+ [ this scenario is not finished yet ]
+
+You can add ( 0 or more ) players via
+ which should be self explanatory. This wont work if
+ the world is filled, as it would be if a scenario was
+ read in and the SCENARIO.ntn file filled the world.
+ This is because the program wont find spots to place
+ your players. Adjust the nations file for your
+ scenario to set up players. When they log in, they
+ will be asked for a new password.
+
+
+Once you log in as a player or as god, you can get help by
+typing '?'. Play around with the commands and get your syntax right.
+
+Try logging in as either a player or non player nation (they use the super
+user password) and noticing any differences.
+
+IMPORTANT NOTE ON PLAY BALANCE:
+The world is not created equal. Some players may start in very bad
+positions. You can either start them over (destroy that nation in the
+change nation command and create a new one), or modify the surrounding
+terain appropriately (god can use the redesignate command to change
+elevation and vegetation).
+
+Now move around on the map and learn where the players are positioned.
+If there is a problem (they are surrounded by water...), use the
+redesignate command to change elevation or vegetation. In the worst
+case, god can destroy a nation with 'c', the change nation command.
+Once you think the game will be fair, it is time to allow players to
+proceed.
+
+Now you are all set -- play via
+
+
+and update with via an script similar to "run"
diff --git a/original/WARNING.p11 b/original/WARNING.p11
new file mode 100644
index 0000000..a3803ba
--- /dev/null
+++ b/original/WARNING.p11
@@ -0,0 +1,13 @@
+*** Warning:
+
+This patch contains the "CHECKUSER" option which will make the data file
+incompatible with previous versions of 4.x data files. If you wish to use
+this patch with 4.10 data files -=DO NOT=- compile with the CHECKUSER option
+enabled.
+
+-spide
+ mcy1580@ultb.isc.rit.edu
+ mcy1580@ritvax.isc.rit.edu
+
+-adam
+ adb@cs.bu.edu
diff --git a/original/admin.c b/original/admin.c
new file mode 100644
index 0000000..ba01fc4
--- /dev/null
+++ b/original/admin.c
@@ -0,0 +1,658 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+/*Declarations*/
+char *getpass();
+struct s_sector **sct;
+struct s_nation ntn[NTOTAL]; /* player nation stats */
+struct s_world world;
+/*is sector occupied by an army?*/
+char **occ;
+short **movecost;
+long startgold=0;
+
+/*offset of upper left hand corner*/
+short xoffset=0,yoffset=0;
+/*current cursor postion (relative to 00 in upper corner)*/
+/* position is 2*x,y*/
+short xcurs=0,ycurs=0;
+/*display state*/
+short dismode=2;
+/* nation id of owner*/
+short country=0;
+struct s_nation *curntn;
+extern char datadir[];
+#ifdef REMAKE
+int remake=FALSE;
+#endif /*REMAKE*/
+
+FILE *fexe, *fopen();
+
+void
+main(argc,argv)
+int argc;
+char **argv;
+{
+ int geteuid(), getuid(), setuid(), realuser, l;
+ register int i,j;
+ char *name;
+#ifndef __STDC__
+ void srand();
+#endif
+ int getopt();
+ long time();
+ /* mflag = make world, a=add player, x=execute, p=print */
+ /* rflag = make world from read in files */
+ int mflag, aflag, xflag, rflag;
+ char string[FILELTH];
+ extern char *optarg;
+ char defaultdir[BIGLTH],cq_opts[BIGLTH];
+ struct passwd *getpwnam(), *pwent;
+
+ umask (MASK);
+ mflag = aflag = xflag = rflag = 0;
+ srand((unsigned) time((long *) 0));
+ strcpy(datadir,"");
+ strcpy(cq_opts,"");
+ name = string;
+ *name = 0;
+
+ /* check conquer options */
+ if (getenv(ENVIRON_OPTS)!=NULL) {
+ strncpy(cq_opts, getenv(ENVIRON_OPTS), BIGLTH);
+ }
+ if (cq_opts[0] != '\0') {
+ l = strlen(cq_opts);
+ for(i=0; i\n");
+ exit(FAIL);
+ }
+ if (i\n",cq_opts[i]);
+ exit(FAIL);
+ break;
+ }
+ }
+ }
+
+ /* process the command line arguments */
+ while((i=getopt(argc,argv,"maxr:d:"))!=EOF) switch(i){
+ /* process the command line arguments */
+ case 'm': /* make a new world*/
+ mflag++;
+ break;
+ case 'a': /* anyone with password can add player*/
+ aflag++;
+ break;
+ case 'x': /* execute (update) program*/
+ xflag++;
+ break;
+ case 'r': /* read map file */
+ rflag++;
+ if(strlen(optarg) > NAMELTH){
+ fprintf(stderr,"ERROR: MAPFILE STEM LONGER THAN %d\n",NAMELTH);
+ exit(FAIL);
+ }
+ strcpy(scenario, optarg);
+ break;
+ case 'd':
+ strcpy(datadir, optarg);
+ break;
+ case '?': /* print out command line arguments */
+ printf("Command line format: %s [-max -dDIR -rSCENARIO]\n",argv[0]);
+ printf("\t-m make a world\n");
+ printf("\t-a add new player\n");
+ printf("\t-x execute (update) program\n");
+ printf("\t-d DIR to use play different game\n");
+ /* printf("\t-r SCENARIO read map while making a new world\n\t\t\tuses SCENARIO.ele, SCENARIO.veg, & SCENARIO.nat\n"); */
+ exit(SUCCESS);
+ };
+
+ realuser = getuid();
+ /* may now replace user identity */
+ (void) setuid (geteuid ()) ;
+
+ /* set proper defaultdir */
+ if (datadir[0] != '/') {
+ if (strlen(datadir) > 0) {
+ sprintf(defaultdir, "%s/%s", DEFAULTDIR, datadir);
+ } else {
+ strcpy(defaultdir,DEFAULTDIR);
+ strcpy(datadir,"[default]");
+ }
+ } else {
+ strcpy(defaultdir,datadir);
+ }
+
+ /* now that we have parsed the args, we can got to the
+ * dir where the files are kept and do some work.
+ */
+ if (chdir(defaultdir)) {
+ printf("unable to change dir to %s\n",defaultdir);
+ exit(FAIL);
+ }
+ if((mflag)||(rflag)) {
+#ifdef REMAKE
+ /* check if datafile currently exists*/
+ if(access(datafile,00) == 0) {
+ /* read in the data*/
+ readdata();
+ verifydata( __FILE__, __LINE__ );
+
+ /* verify ability to remake the world */
+ if ((realuser != (getpwnam(LOGIN))->pw_uid ) &&
+ ((pwent=getpwnam(ntn[0].leader)) == NULL ||
+ realuser != pwent->pw_uid )) {
+ printf("Sorry -- you can not create a world\n");
+ printf("you need to be logged in as %s",LOGIN);
+ if (strcmp(LOGIN, ntn[0].leader)!=0) {
+ printf(" or %s",ntn[0].leader);
+ }
+ printf(".\n");
+ exit(FAIL);
+ }
+ remake=TRUE;
+ printf("************* WARNING!!!! *******************\n\n");
+ printf(" There is already a game in progress.\n\n");
+ printf("*********************************************\n\n");
+ printf("Do you wish to destroy the current game? ");
+ scanf("%s",string);
+ if (strcmp(string,"yes")!=0 && strcmp(string,"y")!=0) {
+ printf("Okay... the world is left intact\n");
+ exit(FAIL);
+ }
+ printf("Are you absolutely certain? ");
+ scanf("%s",string);
+ if (strcmp(string,"yes")!=0 && strcmp(string,"y")!=0) {
+ printf("Okay... the world is left intact\n");
+ exit(FAIL);
+ }
+ printf("The re-destruction of the world has begun...\n");
+ sleep(1);
+ }
+#else
+ /* check for god permissions */
+ if(realuser!=(getpwnam(LOGIN))->pw_uid) {
+ printf("Sorry -- you can not create a world\n");
+ printf("you need to be logged in as %s.\n",LOGIN);
+ exit(FAIL);
+ }
+
+ /* check if datafile already exists*/
+ if(access(datafile,00) == 0) {
+ printf("ABORTING: File %s exists\n",datafile);
+ printf("\tthis means that a game is in progress. To proceed, you must remove \n");
+ printf("\tthe existing data file. This will, of course, destroy that game.\n\n");
+ exit(FAIL);
+ }
+#endif /* REMAKE */
+
+ makeworld(rflag);
+ sprintf(string,"%sup",isonfile);
+ unlink(string);
+ exit(SUCCESS);
+ }
+
+ /* read data*/
+ readdata();
+ verifydata( __FILE__, __LINE__ );
+
+ if (aflag) { /* a new player */
+ sprintf(string,"%sup",isonfile);
+ if(check_lock(string,FALSE)==TRUE) {
+ printf("Conquer is updating\n");
+ printf("Please try again later.\n");
+ exit(FAIL);
+ }
+
+ sprintf(string,"%s0",isonfile);
+ if(check_lock(string,FALSE)==TRUE) {
+ printf("God is currently logged in.\n");
+ printf("Please try again later.\n");
+ exit(FAIL);
+ }
+
+ printf("\n********************************************");
+ printf("\n* PREPARING TO ADD NEW PLAYERS *");
+ printf("\n********************************************\n");
+ if( TURN > LASTADD ){
+ printf("more than %d turns have passed since game start!\n", LASTADD);
+ printf("permission of game administrator required\n");
+ if(strncmp(crypt(getpass("\nwhat is conquer super user password:"),SALT),ntn[0].passwd,PASSLTH)!=0)
+ {
+ printf("sorry...\n");
+ exit(FAIL);
+ }
+ }
+ /* prevent more than one addition */
+ sprintf(string,"%sadd",isonfile);
+ if(check_lock(string,TRUE)==TRUE) {
+ printf("Someone else is adding\n");
+ printf("Please try again later.\n");
+ exit(FAIL);
+ }
+
+ /* disable interrupts */
+ signal(SIGINT,SIG_IGN);
+ signal(SIGQUIT,SIG_IGN);
+ newlogin(realuser);
+ unlink(string);
+ exit(SUCCESS);
+ }
+
+#ifdef OGOD
+ if ((realuser != (getpwnam(LOGIN)->pw_uid) ) &&
+ ((pwent=getpwnam(ntn[0].leader)) == NULL ||
+ realuser != pwent->pw_uid )) {
+ printf("Sorry -- you can not administrate conquer\n");
+ printf("you need to be logged in as %s",LOGIN);
+ if (strcmp(LOGIN, ntn[0].leader)!=0) {
+ printf(" or %s",ntn[0].leader);
+ }
+ printf("\n");
+ exit(FAIL);
+ }
+#endif /* OGOD */
+
+ if (xflag) { /* update the game */
+#ifndef OGOD
+ if ((realuser != (getpwnam(LOGIN))->pw_uid ) &&
+ ((pwent=getpwnam(ntn[0].leader)) == NULL ||
+ realuser != pwent->pw_uid )) {
+ printf("sorry -- your uid is invalid for updating\n");
+ printf("you need to be logged in as %s",LOGIN);
+ if (strcmp(LOGIN, ntn[0].leader)!=0) {
+ printf(" or %s",ntn[0].leader);
+ }
+ printf("\n");
+ exit(FAIL);
+ }
+#endif /* OGOD */
+#ifdef RUNSTOP
+ /* check if any players are on */
+ for (i=0;i %s", timefile);
+ system(string);
+#endif /* TIMELOG */
+ exit(SUCCESS);
+ }
+ printf("error: must specify an option\n");
+
+ /* print out command line arguments */
+ printf("Command line format: %s [-max -dDIR]\n",argv[0]);
+ printf("\t-a add new player\n");
+ printf("\t-d DIR to use play different game\n");
+ printf("\t-m make a world\n");
+ printf("\t-x execute (update) program\n");
+ exit(SUCCESS);
+}
+
+/* if parameter == 0 do for all nations */
+void
+att_setup(cntry)
+int cntry;
+{
+ int nat;
+ for( nat= 0; natactive )) continue;
+ WORLDNTN++;
+ WORLDJEWELS+=curntn->jewels;
+ if(curntn->tgold>0) WORLDGOLD+=curntn->tgold;
+ WORLDMETAL+=curntn->metals;
+ WORLDFOOD+=curntn->tfood;
+ WORLDSCORE+=curntn->score;
+ WORLDCIV+=curntn->tciv;
+ WORLDSCT+=curntn->tsctrs;
+ WORLDMIL+=curntn->tmil;
+ }
+ if (WORLDGOLD==0) WORLDGOLD=1;
+
+ /* count the number of sectors */
+ for(country=1;countryeatrate<25) curntn->eatrate=25;
+ if( TURN!= 1) { /* remember eatrate is scaled by 25 */
+ switch(SEASON(TURN)) {
+ case WINTER: /* 7 food/person for each eatrate */
+ temp = 180L * curntn->tfood/(curntn->eatrate+25L);
+ break;
+ case SPRING: /* 6 food/person for each eatrate */
+ temp = 204L * curntn->tfood/(curntn->eatrate+25L);
+ break;
+ case SUMMER: /* 5 food/person for each eatrate */
+ temp = 250L * curntn->tfood/(curntn->eatrate+25L);
+ break;
+ case FALL: /* 4 food/person for each eatrate */
+ temp = 312L * curntn->tfood/(curntn->eatrate+25L);
+ break;
+ }
+ if(curntn->tciv>0) x = curntn->eatrate/2 + temp/curntn->tciv;
+ else x = 25;
+ if( x < MAXTGVAL ) curntn->eatrate = (char)x;
+ else curntn->eatrate=MAXTGVAL;
+ if ( curntn->eatrate < 25 ) curntn->eatrate=25;
+
+ } else {
+ cityfolk = 10; /* Aproximate steady state */
+ }
+
+ if( 30 <= 1+ngrain+ncities ) curntn->spoilrate=1;
+ else curntn->spoilrate = 30-ngrain-ncities;
+ if( curntn->tfood > curntn->tciv * 10 )
+ curntn->spoilrate = 30;
+
+ /* get number of mercenaries */
+ mercs=0;
+ for(armynum=0;armynumtmil>0 && curntn->tciv>0) temp=(1000*curntn->tmil)/curntn->tciv+(1000*mercs)/curntn->tmil;
+ else temp=0;
+ curntn->terror = min( temp/5, MAXTGVAL );
+
+ temp = (5*townfolk/2+5*cityfolk) + roads*5;
+ curntn->communications = min( temp,2*MAXTGVAL );
+
+ temp=1000*curntn->score/WORLDSCORE + 1000*curntn->tmil/WORLDMIL;
+ curntn->power = min(temp/5,MAXTGVAL);
+
+ /* calculate national wealth */
+ temp = curntn->tgold;
+ if(temp<0) temp=0;
+ temp = (long)(1000.0*temp/WORLDGOLD + 1000.0*curntn->jewels/WORLDJEWELS + 1000.0*curntn->metals/WORLDMETAL) + cityfolk*5/3 + townfolk*5/6;
+ if (temp >= curntn->wealth) {
+ curntn->wealth = min( temp/10,MAXTGVAL );
+ } else {
+ curntn->wealth -= (curntn->wealth - temp)/4;
+ }
+
+ if( TURN!= 1) {
+ curntn->reputation += rand()%8-3;
+ curntn->reputation = min( curntn->reputation,MAXTGVAL );
+
+ temp = (curntn->prestige + curntn->power + curntn->wealth) / 3;
+ curntn->prestige = min( temp,MAXTGVAL );
+
+ if(curntn->tciv>0) temp = foodpts*10 / curntn->tciv;
+ else temp = 0;
+ curntn->farm_ability = min( temp,MAXTGVAL );
+ }
+
+ /* calcualte mining ability */
+ temp = (minepts/3 + cityfolk/2 + townfolk/2 + blksmths);
+ if( magic(country,MINER) )
+ temp += 15;
+ if( magic(country,STEEL) )
+ temp += 15;
+ if (temp >= curntn->mine_ability) {
+ curntn->mine_ability = min( temp,MAXTGVAL );
+ } else {
+ curntn->mine_ability -= (curntn->mine_ability - temp)/4;
+ }
+
+ /* calculate knowledge */
+ temp = cityfolk/2 + townfolk/6 + scholars/2;
+ curntn->knowledge = min( temp,MAXTGVAL );
+
+ /* find national popularity */
+ temp = (curntn->wealth + 10*P_EATRATE + clerics + curntn->popularity)/2;
+ curntn->popularity = min( temp,MAXTGVAL );
+
+ if(magic(country,SLAVER)) curntn->terror+=PWR_NA;
+ if(magic(country,RELIGION)) curntn->popularity+=PWR_NA;
+ if(magic(country,URBAN)) {
+ if(curntn->popularity > PWR_NA)
+ curntn->popularity-=PWR_NA;
+ else curntn->popularity=0;
+ }
+ if(magic(country,DEMOCRACY)) {
+ curntn->eatrate += 25;
+ if(curntn->terror > PWR_NA)
+ curntn->terror-=PWR_NA;
+ else curntn->terror=0;
+ if (curntn->charity < 15) {
+ /* it creeps up */
+ curntn->charity+=2;
+ }
+ }
+ if(magic(country,KNOWALL)) curntn->knowledge+=PWR_NA;
+ if(magic(country,ARCHITECT)){
+ if(curntn->spoilrate>=PWR_NA)
+ curntn->spoilrate-=PWR_NA;
+ else curntn->spoilrate=1;
+ }
+ if(magic(country,ROADS)) curntn->communications+=50;
+ if(magic(country,DESTROYER)) curntn->terror+=PWR_NA;
+ if(magic(country,ROADS)) curntn->terror+=PWR_NA;
+ if(magic(country,VAMPIRE)) curntn->terror+=PWR_NA;
+
+ switch(curntn->class){
+ case C_NPC: curntn->popularity+=CLA_NA;
+ curntn->terror+=CLA_NA; break;
+ case C_KING: curntn->popularity+=CLA_NA; break;
+ case C_TRADER: curntn->wealth+=CLA_NA;
+ curntn->popularity+=CLA_NA;
+ curntn->prestige+=CLA_NA/3; break;
+ case C_EMPEROR: curntn->wealth+=CLA_NA;
+ curntn->popularity+=CLA_NA;
+ curntn->prestige+=CLA_NA/3; break;
+ case C_WIZARD: curntn->knowledge+=CLA_NA; break;
+ case C_PRIEST: curntn->popularity+=CLA_NA; break;
+ case C_PIRATE: curntn->terror+=CLA_NA; break;
+ /* for warlord remember it is recursive */
+ case C_WARLORD: curntn->prestige+=CLA_NA*2/3; break;
+ case C_DEMON: curntn->terror+=CLA_NA; break;
+ case C_DRAGON: curntn->terror+=CLA_NA; break;
+ case C_SHADOW: curntn->terror+=CLA_NA; break;
+ }
+
+ curntn->prestige = min( curntn->prestige, MAXTGVAL );
+ curntn->popularity = min( curntn->popularity, MAXTGVAL );
+ curntn->power = min( curntn->power, MAXTGVAL );
+ curntn->communications = min( curntn->communications, 2*MAXTGVAL);
+ curntn->wealth = min( curntn->wealth, MAXTGVAL );
+ curntn->eatrate = min( curntn->eatrate, MAXTGVAL );
+ curntn->knowledge = min( curntn->knowledge, MAXTGVAL );
+ curntn->farm_ability = min( curntn->farm_ability, MAXTGVAL );
+ curntn->mine_ability = min( curntn->mine_ability, MAXTGVAL );
+ curntn->terror = min( curntn->terror, MAXTGVAL );
+ curntn->reputation = min( curntn->reputation, MAXTGVAL );
+ }
+}
+
+/* calculates a nations bonuses due to trade goods */
+void
+att_bonus()
+{
+ short x,y,nation,good;
+ struct s_sector *sptr;
+ printf("working on exotic trade goods\n");
+ for(x=0;xowner;
+ curntn = &ntn[nation];
+
+ if( !tg_ok( nation, sptr) ) continue;
+
+ good = sptr->tradegood;
+
+ if(( *(tg_stype+good)== sptr->designation )
+ ||(( *(tg_stype+good)== DTOWN )&&(sptr->designation==DCITY))
+ ||(( *(tg_stype+good)== DTOWN )&&(sptr->designation==DCAPITOL))
+ ||(( *(tg_stype+good)== DCITY )&&(sptr->designation==DCAPITOL))
+ ||(( *(tg_stype+good)== DUNIVERSITY )&&(sptr->designation==DCITY))
+ ||(( *(tg_stype+good)== DUNIVERSITY )&&(sptr->designation==DCAPITOL))
+ ||( *(tg_stype+good)== 'x' ))
+ if( good <= END_POPULARITY ) {
+ curntn->popularity += ( *(tg_value+good) - '0');
+ curntn->popularity = min( MAXTGVAL, curntn->popularity );
+ } else if( good <= END_COMMUNICATION ) {
+ if(curntn->communications + (*(tg_value+good) - '0')<2*MAXTGVAL)
+ curntn->communications += (*(tg_value+good) - '0');
+ else curntn->communications = 2*MAXTGVAL;
+ } else if( good <= END_EATRATE ) { /* eatrate scaled already */
+ /* no tradegoods for eatrate */
+ curntn->eatrate = min( MAXTGVAL, curntn->eatrate );
+ } else if( good <= END_SPOILRATE ) {
+ if(curntn->spoilrate > (*(tg_value+good) - '0'))
+ curntn->spoilrate -= (*(tg_value+good)-'0');
+ else curntn->spoilrate = 1;
+ } else if( good <= END_KNOWLEDGE ) {
+ if(curntn->knowledge + (*(tg_value+good)-'0') < MAXTGVAL)
+ curntn->knowledge += (*(tg_value+good) - '0');
+ else curntn->knowledge = MAXTGVAL;
+ } else if( good <= END_FARM ) {
+ if(curntn->farm_ability + (*(tg_value+good) - '0') < MAXTGVAL)
+ curntn->farm_ability += (*(tg_value+good)-'0');
+ else curntn->farm_ability = MAXTGVAL;
+ } else if( good <= END_SPELL ) {
+ curntn->spellpts += sptr->people/1000 +1;
+ } else if( good <= END_TERROR ) {
+ if(curntn->terror + (*(tg_value+good)-'0')< MAXTGVAL)
+ curntn->terror += (*(tg_value+good)-'0');
+ else curntn->terror = MAXTGVAL;
+ }
+ }
+}
diff --git a/original/cexecute.c b/original/cexecute.c
new file mode 100644
index 0000000..8fdc946
--- /dev/null
+++ b/original/cexecute.c
@@ -0,0 +1,327 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+/*EXECUTE THE PROGRAM*/
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+extern long startgold;
+extern short country;
+extern FILE *fexe, *fnews;
+extern char fison[];
+
+#ifdef CONQUER
+extern int roads_this_turn;
+extern int terror_adj;
+#endif
+
+int
+execute(isupdate)
+int isupdate; /* 0 if not update, 1 if update */
+{
+ FILE *fp, *fopen();
+ int cmd,savectry;
+ char comment[LINELTH];
+ char temp[LINELTH];
+ long longvar,long2var;
+ int armynum;
+ short int x,y;
+ int execed=0;
+ int done=FALSE;
+ char line[BIGLTH];
+
+ /* initialize startgold */
+ if( isupdate==0) startgold = curntn->tgold;
+
+ /* initialize i_people */
+ for(x=0;x= 32K */
+ sct[x][y].i_people = sct[x][y].people/256;
+ else
+ sct[x][y].i_people = -1;
+
+ /*open exefile file*/
+ sprintf(line,"%s%d",exefile,country);
+ if ((fp=fopen(line,"r"))==NULL) {
+ /*THIS MEANS THAT THE NATION HAS NOT MOVED YET*/
+ return(0);
+ }
+ savectry=country;
+
+ /*read in file*/
+ if(fgets(line,80,fp)==NULL) done=TRUE;
+ while(done==FALSE) {
+ /*read and parse a new line*/
+ /*CODE IF YOU USE LONG VAR IS L_*/
+ if( line[0] == 'L' && line[1] == '_' ) {
+ sscanf(line,"%s %d %hd %ld %ld %hd %s",
+ temp,&cmd,&country,&longvar,&long2var,&y,comment);
+ } else {
+ sscanf(line,"%s %d %hd %d %hd %hd %s",
+ temp,&cmd,&country,&armynum,&x,&y,comment);
+ }
+ curntn = &ntn[country];
+
+ execed=1;
+ switch(cmd){
+ case XASTAT: /*Aadjstat*/
+ if(x>0) P_ASTAT=x;
+ break;
+ case XAMEN: /*Aadjmen*/
+ armynum= (int) longvar;
+ P_ASOLD= (int) long2var;
+ P_ATYPE= y;
+ break;
+ case XBRIBE: /* nation has been bribed */
+ if(!isupdate) break; /* only work on update */
+ ntn[y].tgold += longvar;
+#ifdef DEBUG
+ fprintf(stderr,"DEBUG: BRIBE BY %s of %s\n",ntn[country].name,ntn[y].name);
+#endif /* DEBUG */
+ /* x represents chance of successful bribe */
+ if(npctype(curntn->active)==npctype(ntn[y].active))
+ x = 50;
+ else if(isneutral(ntn[y].active)) x=30;
+ else if(npctype(ntn[y].active)==ISOLATIONIST) x=15;
+ else x = 20;
+ if(curntn->race==ntn[y].race) x+= 20;
+ if( rand()%100 < x){
+#ifdef DEBUG
+ fprintf(stderr,"DEBUG: BRIBE IS SUCCESS\n");
+#endif /* DEBUG */
+ ntn[y].dstatus[country]--;
+ }
+ break;
+ case XALOC: /*Aadjloc*/
+ P_AXLOC=x;
+ P_AYLOC=y;
+ break;
+ case MSETA: /*Aadjmerc*/
+#ifdef CONQUER
+ mercgot+=armynum;
+#endif
+#ifdef ADMIN
+ MERCMEN-=armynum;
+#endif
+ break;
+ case MSETB: /*Aadjdisb*/
+ /* only allow raising of merc bonus */
+ if (x>MERCATT)
+ MERCATT=(MERCMEN*MERCATT+armynum*x)/(MERCMEN+armynum);
+ if (y>MERCDEF)
+ MERCDEF=(MERCMEN*MERCDEF+armynum*y)/(MERCMEN+armynum);
+ MERCMEN+=armynum;
+ break;
+ case XNLOC: /*nadjloc*/
+ curntn->nvy[armynum].xloc=x;
+ curntn->nvy[armynum].yloc=y;
+ break;
+ case XNACREW:
+ curntn->nvy[armynum].crew=x;
+ curntn->nvy[armynum].armynum=y;
+ break;
+ case XNAMER: /*nadjmer*/
+ curntn->nvy[armynum].merchant=x;
+ break;
+ case XNAWAR: /*nadjwar*/
+ curntn->nvy[armynum].warships=x;
+ break;
+ case XNAGAL: /*nadjgal*/
+ curntn->nvy[armynum].galleys=x;
+ break;
+ case XNAHOLD: /*nadjhld*/
+ curntn->nvy[armynum].people=(unsigned char)y;
+ curntn->nvy[armynum].armynum=(unsigned char)x;
+ break;
+ case XECNAME: /*Nadjname*/
+ strcpy(curntn->name,comment);
+ break;
+ case XECPAS: /*Nadjpas*/
+ strncpy(curntn->passwd,comment,PASSLTH);
+ break;
+ case NPOP: /* set various nation attributes */
+#ifdef CONQUER
+ terror_adj++;
+#endif /* CONQUER */
+ curntn->popularity = armynum;
+ curntn->terror = x;
+ curntn->reputation = y;
+ break;
+ case NTAX: /* set nations tax rate */
+#ifdef ADMIN
+ if (ispc(curntn->active) && !ispc(x)) {
+ fprintf(fnews, "1.\tNation %s is now being run by the computer.\n", curntn->name);
+ }
+ if (ispc(x) && !ispc(curntn->active)) {
+ fprintf(fnews, "1.\tNation %s is no longer being run by the computer.\n", curntn->name);
+ }
+#endif /*ADMIN*/
+ curntn->tax_rate = armynum;
+ curntn->active = x;
+ curntn->charity = y;
+ break;
+ case EDSPL: /*Edecspl*/
+ curntn->spellpts-=armynum;
+ break;
+ case XSADES: /*Sadjdes*/
+ if((sct[x][y].owner!=country)&&(country!=0)) {
+ fprintf(stderr,"ERROR: <%s> redesignate sector %d,%d that is not owned\n",curntn->name,x,y);
+ break;
+ }
+
+ sct[x][y].designation=comment[0];
+ if(sct[x][y].designation==DCAPITOL){
+ curntn->capx=x;
+ curntn->capy=y;
+ }
+#ifdef CONQUER
+ if (sct[x][y].designation==DROAD)
+ roads_this_turn++;
+#endif
+ break;
+ case XSACIV: /*Sadjciv*/
+ /* if for some reason you dont own it, put people
+ back into your capitol */
+ if((sct[x][y].owner!=country)&&(country!=0)) {
+ sct[curntn->capx][curntn->capy].people+=armynum;
+ break;
+ }
+ sct[x][y].people=armynum;
+ break;
+ case XSACIV3: /*Sadjciv3 - incremental people adjust */
+ /* if you dont own it, put people in your capitol */
+ if((sct[x][y].owner!=country)&&(country!=0)) {
+ sct[curntn->capx][curntn->capy].people+=armynum;
+ }
+ else
+ {
+ sct[x][y].people+=armynum;
+ }
+ break;
+ case XSIFORT: /*Sincfort*/
+ sct[x][y].fortress++;
+ break;
+ case XNAGOLD: /*Nadjgold:*/
+ curntn->tgold = longvar;
+ break;
+ case XAMOV:
+ P_AMOVE=x;
+ break;
+ case XNMOV:
+ curntn->nvy[armynum].smove=x;
+ break;
+ case XSAOWN:
+ /* if not own it, and if people there, problem */
+ if((sct[x][y].owner!=country)
+ &&( country!=0)
+ &&( sct[x][y].owner!=0 )
+ &&( sct[x][y].people>0 )
+ &&( magic(country,SLAVER)==FALSE )
+ &&( ntn[sct[x][y].owner].race != curntn->race)){
+ sct[ntn[sct[x][y].owner].capx][ntn[sct[x][y].owner].capy].people+= sct[x][y].people;
+ sct[x][y].people=0;
+ fprintf(stderr,"ERROR: <%s> taking sector %d %d but civilians exist of other race - puting them in their capitol\n",curntn->name,x,y);
+ }
+ if(curntn->popularitypopularity++;
+ sct[x][y].owner=country;
+ break;
+ case EDADJ:
+ curntn->dstatus[armynum]=x;
+ break;
+ case XNARGOLD:
+ curntn->jewels = longvar;
+ break;
+ case XNAMETAL:
+ curntn->metals = longvar;
+ break;
+ case INCAPLUS:
+ curntn->aplus++;
+ break;
+ case INCDPLUS:
+ curntn->dplus++;
+ break;
+ case DESTRY:
+ sct[ntn[armynum].capx][ntn[armynum].capy].owner=savectry;
+ country=armynum;
+ if (isupdate) destroy(country);
+ country=savectry;
+ break;
+ case CHG_MGK:
+ curntn->powers|=long2var;
+ if(curntn->powers!=longvar){
+ printf("\nERROR ON MAGIC READ country=%d %ld != %ld (or of %ld)",country,longvar,curntn->powers,long2var);
+ getchar();
+ }
+ for(armynum=0;armynum<=MAXPOWER;armynum++) {
+ longvar = 1L << armynum;
+ if (longvar & long2var)
+ exenewmgk(longvar);
+ }
+ long2var=0;
+ break;
+ }
+ if(fgets(line,80,fp)==NULL) done=TRUE;
+ }
+ fclose(fp);
+ /*return 1 if it did something*/
+ country=savectry;
+ curntn = &ntn[country];
+ if(execed==1) return(1);
+ else return(0);
+}
+#ifdef CONQUER
+void
+hangup()
+{
+ char line[LINELTH];
+
+ if(country==0) writedata();
+ else {
+ fprintf(fexe,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n",
+ XNAGOLD ,country,curntn->tgold,"null");
+ fprintf(fexe,"L_NMETAL\t%d \t%d \t%ld \t0 \t0 \t%s\n",
+ XNAMETAL ,country,curntn->metals,"null");
+ fprintf(fexe,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n",
+ XNARGOLD ,country,curntn->jewels,"null");
+ }
+ /*close file*/
+ fclose(fexe);
+
+ /* remove any existing mail reading/writing file */
+ if (mailok!=DONEMAIL) {
+ extern char tmp_mail_name[];
+ unlink(tmp_mail_name);
+ }
+
+ /* remove the lock file */
+ unlink(fison);
+ sprintf(line,"%s%hd.tmp",msgfile,country);
+ unlink(line);
+
+ /*send a message to God*/
+ if(mailopen( 0 )!=(-1)) {
+ fprintf(fm,"WARNING: Nation %s hungup on me.\n",curntn->name);
+ mailclose(0);
+ }
+
+ /* exit program */
+ exit(FAIL);
+}
+#endif /* CONQUER */
diff --git a/original/check.c b/original/check.c
new file mode 100644
index 0000000..6a5ff48
--- /dev/null
+++ b/original/check.c
@@ -0,0 +1,254 @@
+/* Conquer: Copyright (c) 1988 by Edward M Barlow */
+/* check.c contains checking and debugging functions */
+
+#include
+#include
+#ifndef FILELOCK
+#include
+#include
+#endif
+#include "header.h"
+#include "data.h"
+
+void
+verify_ntn( __file__, __line__ )
+char __file__[];
+int __line__;
+{
+ register struct s_nation *nptr;
+ register int i;
+ register int country;
+ int j, k;
+ struct army *a;
+
+ for( country = 0; country < NTOTAL; country++ ) {
+ nptr = &ntn[country];
+
+ if(country !=0 && nptr->active == 0) continue;
+ if( nptr->metals < 0.0 ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] metal = %ld\n",
+ __file__, __line__, country, nptr->metals );
+ nptr->metals = 0.0;
+ }
+
+ if( nptr->jewels < 0 ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] jewels = %ld\n",
+ __file__, __line__, country, nptr->jewels );
+ nptr->jewels = 0.0;
+ }
+
+ for( i = 0; i < MAXARM; i++ ) {
+ a = &nptr->arm[i];
+ if( a->sold < 0 ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] army[%d] sold = %d\n",
+ __file__, __line__, country, i, a->sold );
+ a->sold = 0;
+ }
+ if( a->sold==0 ) continue;
+ if( a->xloc >= MAPX ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] army[%d] xlocation = %d\n",
+ __file__, __line__, country, i, a->xloc );
+ a->xloc = 0;
+ }
+ if( a->yloc >= MAPY ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] army[%d] ylocation = %d\n",
+ __file__, __line__, country, i, a->yloc );
+ a->yloc = 0;
+ }
+ if( a->stat == ONBOARD) {
+ if (a->smove != 0) {
+ fprintf( stderr, "file %s: line %d: nation[%d] army[%d] onboard move = %d\n",
+ __file__, __line__, country, i, a->smove );
+ a->smove = 0;
+ }
+ k = 0;
+ for (j = 0; j < MAXNAVY; j++) {
+ if (nptr->nvy[j].warships == 0
+ && nptr->nvy[j].merchant == 0
+ && nptr->nvy[j].galleys == 0)
+ continue;
+ if (nptr->nvy[j].armynum == i) {
+ k = 1;
+ }
+ }
+ if (k == 0) {
+ fprintf(stderr, "files %s: line %d: nation[%d] army[%d] onboard nothing\n",
+ __file__,__line__,country,i);
+ a->stat = DEFEND;
+ }
+ }
+ if( a->stat != ONBOARD && sct[a->xloc][a->yloc].altitude==WATER ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] army[%d] loc=%d,%d (water) men=%d\n",
+ __file__,__line__,country,i,a->xloc,a->yloc,a->sold);
+ a->sold = 0;
+ }
+ } /* for */
+
+ for( i = 0; i < MAXNAVY; i++ ) {
+ if (nptr->nvy[i].warships == 0
+ && nptr->nvy[i].merchant == 0
+ && nptr->nvy[i].galleys == 0)
+ continue;
+ if (nptr->nvy[i].armynum != MAXARM) {
+ a = &(nptr->arm[nptr->nvy[i].armynum]);
+ if (a->sold == 0 || a->stat != ONBOARD) {
+ fprintf(stderr, "file %s: line %d: nation[%d] navy[%d] carrying invalid troop\n",
+ __file__,__line__,country,i);
+ nptr->nvy[i].armynum = MAXARM;
+ }
+ }
+ } /* for */
+
+ for( i = 0; i < NTOTAL; i++ ) {
+ if( ntn[i].active >= NPC_PEASANT ) {
+ if ( nptr->dstatus[i] != WAR ) {
+ nptr->dstatus[i] = WAR;
+ }
+ if ( ntn[i].dstatus[country] != WAR ) {
+ ntn[i].dstatus[country] = WAR;
+ }
+ } if( nptr->dstatus[i] > JIHAD ) {
+ fprintf( stderr, "file %s: line %d: nation[%d] diplomatic status with %d = %d\n",
+ __file__, __line__, country, i, nptr->dstatus[i] );
+ nptr->dstatus[i] = WAR;
+ }
+ } /* for */
+ } /* for */
+} /* verify_ntn() */
+
+void
+verify_sct( __file__, __line__ )
+char __file__[];
+int __line__;
+{
+ register struct s_sector *sptr;
+ register int x, y;
+
+ for( x = 0; x < MAPX; x++ ) {
+ for( y = 0; y < MAPY; y++ ) {
+ sptr = &sct[x][y];
+
+ if(sptr->tradegood>TG_none) {
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].tradegood = %d (invalid)\n", __file__, __line__, x, y, sptr->tradegood );
+ sptr->tradegood=TG_none;
+ }
+ if(( sptr->metal != 0 )
+ &&(( sptr->tradegood>END_MINE)
+ ||(sptr->tradegood<=END_NORMAL))) {
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].metal = %d with no tradegood\n", __file__, __line__, x, y, sptr->metal );
+ sptr->metal = 0;
+ }
+
+ if(( sptr->jewels != 0 )
+ &&((sptr->tradegood>END_WEALTH)
+ ||(sptr->tradegood<=END_MINE))) {
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].jewels = %d with no tradegood\n", __file__, __line__, x, y, sptr->jewels );
+ sptr->jewels = 0;
+ }
+
+ if( sptr->people > ABSMAXPEOPLE )
+ sptr->people = ABSMAXPEOPLE;
+
+ if( sptr->people < 0 ) {
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].people = %d\n", __file__, __line__, x, y, sptr->people );
+ if( sptr->people < -1*ABSMAXPEOPLE )
+ sptr->people = ABSMAXPEOPLE;
+ else sptr->people = 0;
+ }
+
+ if( sptr->owner != 0 && sptr->altitude == WATER ) {
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].owner = %s (a water sector)\n",__file__,__line__, x, y, ntn[sptr->owner].name );
+ sptr->owner = 0;
+ }
+ if( sptr->fortress > 12 ){
+ fprintf( stderr, "file %s: line %d: sct[%d][%d].fortress = %d \n",__file__,__line__, x, y, sptr->fortress );
+ sptr->fortress = 12;
+ }
+ } /* for */
+ } /* for */
+} /* verify_sct() */
+
+void
+verifydata( __file__, __line__ )
+char __file__[];
+int __line__;
+{
+ /* check for invalid values */
+ verify_ntn( __file__, __line__ );
+ verify_sct( __file__, __line__ );
+}/* verifydata() */
+
+#ifdef DEBUG
+void
+checkout(file,line)
+int line;
+char *file;
+{
+ fprintf(stderr,"file %s line %d\n",file,line);
+ verifydata(file,line);
+}
+#endif /* DEBUG */
+
+#include
+#ifdef FILELOCK
+#ifdef LOCKF
+# include
+# define do_lock(fd) lockf(fd,F_TLOCK,0)
+#else
+# include
+# include
+# define do_lock(fd) flock(fd,LOCK_EX|LOCK_NB)
+#endif
+#endif /* FILELOCK */
+
+/*
+ * check_lock() -- routine to check if a file is locked.
+ * - returns true if a lock is active false is not.
+ * - setting keeplock to true means leaves lock active
+ * if it is not already active.
+ */
+int
+check_lock(filename,keeplock)
+ char *filename;
+ int keeplock;
+{
+ int hold=FALSE;
+#ifdef FILELOCK
+ int fd;
+
+ if ((fd=open(filename,O_WRONLY|O_CREAT,0600))!=(-1)) {
+ if(do_lock(fd)==(-1)) {
+ hold=TRUE;
+ }
+ /* remove lock after checking */
+ if(keeplock==FALSE && hold==FALSE) {
+ close(fd);
+ unlink(filename);
+ }
+ } else {
+ printf("error opening lock file <%s>\n",filename);
+ exit(FAIL);
+ }
+#else
+ struct stat fst;
+
+ if( stat( filename, &fst ) == 0 ) {
+ long now;
+ now = time(0);
+ if (now - fst.st_mtime < TIME_DEAD*3) {
+ hold=TRUE;
+ } else {
+ /* remove useless file */
+ unlink(filename);
+ }
+ }
+ if (hold==FALSE && keeplock==TRUE) {
+ /* create lock file */
+ if(open(filename,O_CREAT,0600)==(-1)) {
+ printf("error opening lock file <%s>\n",filename);
+ exit(FAIL);
+ }
+ }
+#endif /* FILELOCK */
+ return(hold);
+}
diff --git a/original/combat.c b/original/combat.c
new file mode 100644
index 0000000..933a9df
--- /dev/null
+++ b/original/combat.c
@@ -0,0 +1,1377 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+#define MGKNUM 32 /* number of units possible in battle */
+#define ATKR 2
+#define DFND 1
+#define NTRL 0
+#define WIMP 3
+
+extern FILE *fpmsg;
+extern FILE *fnews;
+extern short country;
+
+short retreatside; /* ATKR, DFND, or none (0) */
+short retreatx; /* retreat x square */
+short retreaty; /* retreat y square */
+
+int unit[MGKNUM]; /*armynum*/
+int owner[MGKNUM]; /*owner*/
+int side[MGKNUM]; /*see definitions->1=units 2=unit*/
+long troops[MGKNUM]; /*starting troops in army */
+int xspot,yspot; /*location of battles*/
+int anation; /*nation attacking in this fight*/
+int dnation; /*one nation defending in this fight*/
+int count=0; /*number of armies or navies in sector*/
+
+/* indicators of naval or army combat */
+#define COMBAT_X 0
+#define COMBAT_A 1
+#define COMBAT_N 2
+#define FOUGHT_A 4
+#define FOUGHT_N 8
+
+/************************************************************************/
+/* COMBAT() run all combat on the map */
+/* for each sector, determine if armies in with attack mode */
+/************************************************************************/
+void
+combat()
+{
+ register int i,j;
+ char **fought; /* SET: if already fought in sctr */
+ int temp,ctry;
+ int initialized=FALSE; /* TRUE if arrays initialized */
+ short armynum,nvynum;
+ int valid;
+ struct s_nation *nptr;
+ struct army *aptr;
+
+ fought = (char **) m2alloc(MAPX,MAPY,sizeof(char));
+
+ printf("Run Combat Routines\n");
+ fprintf(fnews,"4\tBATTLE SUMMARY STATISTICS\n");
+ /*for each nation, if in attack mode run a check*/
+
+ /* no sectors have been fought in yet */
+ for(i=0;i0;ctry--) if(isactive(ntn[ctry].active)) {
+
+ nptr = &ntn[ctry];
+
+ /*army combat*/
+ for(j=0;jarm[j];
+ if((aptr->sold>0)
+ &&(aptr->stat>=ATTACK)
+ &&(aptr->stat<=SORTIE||aptr->stat>=NUMSTATUS)
+ &&(!(fought[aptr->xloc][aptr->yloc]&COMBAT_A))){
+
+ /* someone can initiate combat in xspot,yspot */
+ xspot=aptr->xloc;
+ yspot=aptr->yloc;
+ fought[xspot][yspot]|=COMBAT_A;
+
+ /*initialize matrix*/
+ if( !initialized ) {
+ for(temp=0;temp0)
+ &&(ASTAT!=SCOUT)
+ &&(AXLOC==xspot)
+ &&(AYLOC==yspot)
+ &&(countdstatus[country]>HOSTILE)) {
+ valid=TRUE;
+ if( sct[xspot][yspot].owner==ctry ) {
+ dnation=ctry;
+ anation=country;
+ } else if(( rand()%2==0 )
+ ||( sct[xspot][yspot].owner==country )){
+ anation=ctry;
+ dnation=country;
+ } else {
+ dnation=ctry;
+ anation=country;
+ }
+ }
+ unit[count]=armynum;
+ owner[count]=country;
+ count++;
+ }
+
+ if(valid==TRUE) {
+ fight();
+ initialized=FALSE;
+ }
+ }
+ }
+
+ /*navy combat*/
+ for(j=0;jnvy[j].warships!=0)
+ &&(!(fought[nptr->nvy[j].xloc][nptr->nvy[j].yloc]&COMBAT_N))) {
+
+ xspot=nptr->nvy[j].xloc;
+ yspot=nptr->nvy[j].yloc;
+ fought[xspot][yspot]|=COMBAT_N;
+
+ /*initialize matrix*/
+ if( !initialized ){
+ for(temp=0;tempdstatus[country]>HOSTILE)){
+ valid=TRUE;
+ anation=ctry;
+ dnation=country;
+ }
+ unit[count]=nvynum;
+ owner[count]=country;
+ count++;
+ }
+ if(valid==TRUE) {
+ navalcbt();
+ initialized=FALSE;
+ }
+ }
+ }
+ free(fought);
+ printf("\nall army and navy attacks completed\n");
+}
+
+/* macro for owner, accounts for runaway indicator */
+#define UOWNER(x) ((owner[(x)]<(-1))?(-owner[(x)]-1):(owner[(x)]))
+/************************************************************************/
+/* FIGHT() - fight an individual battle given the three */
+/* matricies global to this module */
+/************************************************************************/
+void
+fight()
+{
+ int roll,strength,fortdam=FALSE;
+ int odds; /* odds (asold/dsold) times 100 */
+ int done;
+ int i,j,k;
+ long asold=0,dsold=0; /*a's and d's total soldiers*/
+ float astr=0,dstr=0; /*a's and d's relative strength*/
+ long Aloss,Dloss; /*a's and d's total losses*/
+ int PAloss,PDloss; /*percent a and d loss*/
+ long loss;
+ int abonus=0,dbonus=0; /* bonus aggregate */
+ long vampire=0; /* # non vamps deaded */
+ short nvamps=0; /* number of vampire armies */
+
+ /* determine who is attacker & who is on defenders side?*/
+ for(j=0;jHOSTILE)) side[j]=ATKR;
+ else if((ntn[owner[j]].dstatus[anation]==ALLIED)&&(ntn[owner[j]].dstatus[dnation]>HOSTILE)) side[j]=ATKR;
+ }
+
+ /*calculate number of troops and assign statuses */
+ asold=0;
+ dsold=0;
+ for(i=0;i(-1)) {
+ /* record troops for all units in sector */
+ troops[i]=ntn[owner[i]].arm[unit[i]].sold;
+
+ if(((ntn[owner[i]].arm[unit[i]].unittyp == A_MERCENARY)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp == A_ORC)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp == A_GOBLIN))
+ &&( ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS )
+ &&( rand()%100<15 )) {
+ if( ispc(ntn[owner[i]].active)) {
+ if (mailopen( owner[i] )!=(-1)) {
+ fprintf(fm,"Message to %s from Conquer\n\n",ntn[owner[i]].name);
+ fprintf(fm," Your %s Army %d Refuses to Fight\n",
+ unittype[ntn[owner[i]].arm[unit[i]].unittyp],
+ unit[i]);
+ mailclose(owner[i]);
+ }
+ }
+ retreatside = side[i];
+ fdxyretreat();
+ if((retreatx==xspot)&&(retreaty==yspot)){
+ /* move to capitol & kill 30% */
+ ntn[owner[i]].arm[unit[i]].xloc=ntn[owner[i]].capx;
+ ntn[owner[i]].arm[unit[i]].yloc=ntn[owner[i]].capy;
+ ntn[owner[i]].arm[unit[i]].sold*=7;
+ ntn[owner[i]].arm[unit[i]].sold/=10;
+ } else {
+ /* retreat normally and kill 20% */
+ ntn[owner[i]].arm[unit[i]].sold*=8;
+ ntn[owner[i]].arm[unit[i]].sold/=10;
+ retreat( i );
+ }
+ owner[i]=(-1-owner[i]);
+ continue;
+ }
+ else if(side[i]==ATKR){
+ if ((ntn[owner[i]].arm[unit[i]].stat >= ATTACK)
+ &&(ntn[owner[i]].arm[unit[i]].stat <= SORTIE
+ ||ntn[owner[i]].arm[unit[i]].stat >= NUMSTATUS)) {
+ asold += ntn[owner[i]].arm[unit[i]].sold;
+ } else {
+ side[i]=NTRL;
+ }
+ /* sortie 20% bonus in odds */
+ if(ntn[owner[i]].arm[unit[i]].stat==SORTIE)
+ asold += ntn[owner[i]].arm[unit[i]].sold/5;
+ } else if(side[i]==DFND){
+ if(ntn[owner[i]].arm[unit[i]].stat!=RULE) {
+ dsold += ntn[owner[i]].arm[unit[i]].sold;
+ }
+ }
+ if((magic(owner[i],VAMPIRE)==TRUE) &&
+ (ntn[owner[i]].arm[unit[i]].unittyp==A_ZOMBIE)) nvamps++;
+ }
+
+ if(asold<=0) {
+ printf("\nCombat aborted due to lack of attackers.\n");
+ return;
+ }
+ if( asold > dsold*100) odds=10000;
+ else if( dsold > asold*100 ) odds=1;
+ else odds = (asold*100)/dsold;
+
+ /* mercenaries/orcs/goblins might run away */
+ for(i=0;i(-1)) {
+ if(((( odds > 200 )&&(side[i]==DFND))
+ ||(( odds < 100 )&&(side[i]==ATKR)))
+ &&((ntn[owner[i]].arm[unit[i]].unittyp == A_MERCENARY)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp == A_ORC)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp == A_GOBLIN))
+ &&(ntn[owner[i]].arm[unit[i]].stat < NUMSTATUS)
+ &&( rand()%100<30 )) {
+ if( ispc(ntn[owner[i]].active)) {
+ if(mailopen( owner[i] )!=(-1)) {
+ fprintf(fm,"Message to %s from Conquer\n\n",ntn[owner[i]].name);
+ fprintf(fm," Your %s Army %d Runs Away\n",
+ unittype[ntn[owner[i]].arm[unit[i]].unittyp],
+ unit[i]);
+ mailclose(owner[i]);
+ }
+ }
+ retreatside = side[i];
+ if( side[i] == ATKR ) asold-= troops[i];
+ if( side[i] == DFND ) dsold-= troops[i];
+ fdxyretreat();
+ if((retreatx==xspot)&&(retreaty==yspot)){
+ /* move to capitol & kill 75% */
+ ntn[owner[i]].arm[unit[i]].xloc=ntn[owner[i]].capx;
+ ntn[owner[i]].arm[unit[i]].yloc=ntn[owner[i]].capy;
+ ntn[owner[i]].arm[unit[i]].sold/=4;
+ } else {
+ /* retreat normally and kill 50% */
+ ntn[owner[i]].arm[unit[i]].sold/=2;
+ retreat( i );
+ }
+ owner[i]=(-1-owner[i]);
+ continue;
+ }
+ }
+ retreatside=0;
+ if( asold<=0 ) {
+ printf("Exit from battle due to lack of attackers\n");
+ return;
+ }
+
+ /* CALCULATE AVERAGE COMBAT BONUS */
+ abonus=0;
+ dbonus=0;
+ for(i=0;i(-1)) {
+ if(side[i]==ATKR)
+ abonus += cbonus(i)*troops[i];
+ else if(side[i]==DFND && ntn[owner[i]].arm[unit[i]].stat!=RULE)
+ dbonus += cbonus(i)*troops[i];
+ }
+
+ /*archer bonus if not in fort vs knights/cavalry*/
+ j=0;
+ k=0;
+ for(i=0;i(-1))
+ if(ISCITY(sct[xspot][yspot].designation)){
+ if((ntn[owner[i]].arm[unit[i]].unittyp == A_CAVALRY)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp == A_KNIGHT))
+ if(side[i]==ATKR) j+=troops[i];
+ else if(side[i]==DFND) k+=troops[i];
+ }
+
+ for(i=0;i(-1)) {
+ if(j>0) abonus += (15 * j * troops[i]) / asold;
+ if(k>0 && dsold>0) dbonus += (15 * k * troops[i]) / dsold;
+ }
+
+ abonus/=asold;
+ if (dsold>0) dbonus/=dsold;
+
+ /*CALCULATED BONUSES TO WHOLE COMBAT*/
+ for(i=0;i(-1)) {
+ if(fort_val(&sct[xspot][yspot]) != 0){
+ /*Catapults add +1%/20 men defending castle (max +10%)*/
+ if((ntn[owner[i]].arm[unit[i]].unittyp == A_CATAPULT)
+ &&(side[i]==DFND))
+ dbonus += max((troops[i]/20),10);
+ /*Catapults add +1%/40 men attacking castle (max +10%)*/
+ else if((ntn[owner[i]].arm[unit[i]].unittyp == A_CATAPULT)
+ &&(side[i]==ATKR)) {
+ strength = max((troops[i]/40),10);
+ abonus += strength;
+ /* possible damage 20% chance */
+ if(rand()%100<2*strength) {
+ fortdam=TRUE;
+ sct[xspot][yspot].fortress--;
+ if(sct[xspot][yspot].fortress == 0)
+ sct[xspot][yspot].designation = DRUIN;
+ }
+ }
+ /*Siege_engines add +1%/20 men when attacking fortress*/
+ else if((ntn[owner[i]].arm[unit[i]].unittyp == A_SIEGE)
+ &&(side[i]==ATKR)) {
+ strength = max((troops[i]/20),30);
+ abonus += strength;
+ /* possible damage 15% chance */
+ if(rand()%100 dstr*100) odds=10000;
+ else if( dstr > astr*100 ) odds=1;
+ else odds = (astr*100)/dstr;
+
+ /* calculate loss for an even battle */
+ PDloss = MAXLOSS * roll / 100;
+ PAloss = MAXLOSS * (100 - roll) / 100;
+
+ /* adjust for odds */
+ if( odds == 1 ) {
+ PDloss=0;
+ PAloss=200;
+ } else if( odds == 10000 ) {
+ PAloss=0;
+ PDloss=200;
+ } else if(odds > 100) {
+ PDloss += (odds / 12 - 8); /* 8.33% for higher odds */
+ PAloss -= (odds / 16 - 6); /* 6.25% for lower odds */
+ if(PAloss<(100-roll)/20)
+ PAloss=(100-roll)/20; /* can't get too small */
+ } else {
+ PAloss += ( 800 / odds - 8); /* 8% for higher odds */
+ PDloss -= ( 600 / odds - 6); /* 6% for lower odds */
+ if(PDloss 0 ){
+ PDloss *= 120;
+ PAloss *= 120;
+ PDloss /= 100;
+ PAloss /= 100;
+ }
+
+ retreatside = 0;
+
+ if((PDloss > 2* PAloss)
+ &&(odds>150)
+ &&(((PDloss>=50)&&(rand()%4==0))
+ ||(rand()%8))) retreatside=DFND;
+
+ if((PAloss > 2* PDloss)
+ &&(odds<150)
+ &&(((PAloss>=50)&&(rand()%2==0))
+ ||(rand()%6))) retreatside=ATKR;
+
+ if(retreatside!=0) {
+ fdxyretreat();
+ /* no legal retreat route */
+ if((retreatside!=0) && (retreatx== xspot)
+ && (retreaty== yspot)){
+ if(retreatside==ATKR) PAloss+=15;
+ else if(retreatside==DFND) PDloss+=15;
+#ifdef DEBUG
+ printf("side %d (%d %d) can't retreat...+15%% loss\n",retreatside,retreatx,retreaty);
+#endif /* DEBUG */
+ retreatside = 0;
+ }
+#ifdef DEBUG
+ else printf("retreat side %d to %d %d\n",retreatside,retreatx,retreaty);
+#endif /* DEBUG */
+ }
+
+ if(PAloss>100) PAloss = 100;
+ if(PDloss>100) PDloss = 100;
+
+ Aloss = Dloss = 0;
+ for(i=0;i(-1)){
+ if(side[i]==ATKR){
+ if( ntn[owner[i]].arm[unit[i]].unittyp >= MINLEADER) {
+ if((rand()%100) < PAloss){ /* kill it */
+ for(j=0;j 0)
+ &&(sct[xspot][yspot].owner==country)
+ &&((ntn[owner[i]].arm[unit[i]].unittyp==A_ARCHER)
+ ||(ntn[owner[i]].arm[unit[i]].unittyp==A_CATAPULT)))
+ loss /= 4;
+ /*army can't have less than 25 men in it*/
+ if(troops[i]-loss<25)
+ loss=troops[i];
+if( loss>troops[i] ) {
+printf("I AM VERY CONFUSED - PLEASE HELP... combat.c\n");
+}
+ Aloss+=loss;
+ ntn[owner[i]].arm[unit[i]].sold-=loss;
+ if((ntn[owner[i]].arm[unit[i]].unittyp==A_MILITIA)&&(retreatside==ATKR)) {
+ sct[ntn[owner[i]].arm[unit[i]].xloc][ntn[owner[i]].arm[unit[i]].yloc].people += ntn[owner[i]].arm[unit[i]].sold;
+ ntn[owner[i]].arm[unit[i]].sold=0;
+ }
+ }
+ } else if(side[i]==DFND){
+ if( ntn[owner[i]].arm[unit[i]].unittyp >= MINLEADER) {
+ if((ntn[owner[i]].arm[unit[i]].stat!=RULE
+ ||PDloss>=80)&&((rand()%100) < PDloss)){ /* kill it */
+ for(j=0;j0)&&(magic(owner[i],VAMPIRE)==FALSE)
+ &&(ntn[owner[i]].arm[unit[i]].unittyp!=A_ZOMBIE)
+ &&(ntn[owner[i]].arm[unit[i]].unittyp(-1)){
+ done=FALSE;
+ for(i=0;i79) {
+ k = 30;
+ fprintf(fnews,",\n4.\t ");
+ } else fprintf(fnews,", ");
+ if(loss==ATKR)
+ fprintf(fnews,"attacker %s",ntn[UOWNER(j)].name);
+ else if(loss==DFND)
+ fprintf(fnews,"defender %s",ntn[UOWNER(j)].name);
+ else if(loss==WIMP)
+ fprintf(fnews,"retreater %s",ntn[UOWNER(j)].name);
+ }
+ }
+ }
+ fprintf(fnews,"\n");
+ if(nvamps>0){
+ for(i=0;i(-1)){
+ if((magic(owner[i],VAMPIRE)==TRUE)
+ &&(ntn[owner[i]].arm[unit[i]].unittyp==A_ZOMBIE)
+ &&(ntn[owner[i]].arm[unit[i]].sold > 0))
+ ntn[owner[i]].arm[unit[i]].sold+=vampire/nvamps;
+ }
+ }
+
+ /*who is in the battle; but don't send to scared armies */
+ for(j=0;j(-1)){
+ done=FALSE;
+
+ /*first time your nation appears done=FALSE*/
+ for(i=0;i= MINLEADER)
+ &&( ntn[UOWNER(k)].arm[unit[k]].sold == 0))
+ fprintf(fm," (killed)\n");
+ else if((ntn[UOWNER(k)].arm[unit[k]].unittyp == A_MILITIA)
+ &&( ntn[UOWNER(k)].arm[unit[k]].sold == 0))
+ fprintf(fm," (disbanded)\n");
+ else fputc('\n',fm);
+ }
+
+ fprintf(fm,"attacking soldiers=%ld -> percent loss %d%%\n",asold,PAloss);
+ fprintf(fm,"defending soldiers=%ld -> percent loss %d%%\n",dsold,PDloss);
+ fprintf(fm,"ODDS=%d => adjusted to %d to 100; Die Roll is %d\n",odds*(100+dbonus)/(100+abonus),odds,roll);
+ fprintf(fm,"RESULT: Attackers lose %ld men, Defenders lose %ld men\n",Aloss, Dloss);
+ if(fortdam==TRUE) fprintf(fm,"Fortifications damaged during the attack\n");
+ if(retreatside==ATKR){
+ if(Aloss=NUMSTATUS) armbonus+=20; /* army group */
+ if(side[num]==DFND){
+
+ if(sct[xspot][yspot].altitude==MOUNTAIN) armbonus+=20;
+ else if(sct[xspot][yspot].altitude==HILL) armbonus+=10;
+
+ if(sct[xspot][yspot].vegetation==JUNGLE) armbonus+=20;
+ else if(sct[xspot][yspot].vegetation==FOREST) armbonus+=15;
+ else if(sct[xspot][yspot].vegetation==WOOD) armbonus+=10;
+
+ if(ATYPE==A_MERCENARY) armbonus += MERCDEF;
+ else armbonus += ntn[UOWNER(num)].dplus;
+
+ if(ASTAT==MAGDEF) armbonus+=30;
+ else if(ASTAT==SORTIE) armbonus-=30;
+ else if(ASTAT==SIEGED) armbonus-=20;
+
+ if((sct[xspot][yspot].owner==country)
+ &&(ASTAT==GARRISON||ASTAT==MILITIA||ASTAT==SIEGED)){
+ if(ATYPE == A_ZOMBIE) /* don't utilize walls well */
+ armbonus += fort_val(&sct[xspot][yspot])/2;
+ else armbonus += fort_val(&sct[xspot][yspot]);
+ }
+ }
+ else if(side[num]==ATKR) {
+ if( (fort_val(&sct[xspot][yspot]) > 0)
+ &&( magic(country,SAPPER)==TRUE)) armbonus += 10;
+
+ if(ATYPE == A_MERCENARY) armbonus += MERCATT;
+ else armbonus += ntn[UOWNER(num)].aplus;
+ if(ASTAT==MAGATT) armbonus += 30;
+ if(ASTAT==SORTIE && (fort_val(&sct[xspot][yspot]) > 0)
+ && sct[xspot][yspot].owner==country) {
+ armbonus += 10;
+ if((ATYPE==A_DRAGOON)||(ATYPE==A_LEGION)
+ ||(ATYPE==A_PHALANX)) {
+ /* bonus for organization or riding cavalry */
+ armbonus += 5;
+ } else if ((ATYPE==A_LT_CAV)||(ATYPE==A_CAVALRY)) {
+ /* bonus for mounted sortie */
+ armbonus += 10;
+ } else if (avian(ATYPE)||ATYPE==A_ELEPHANT||ATYPE==A_KNIGHT) {
+ /* bonus for mounted or flying sortie */
+ armbonus += 15;
+ }
+ if ((ATYPE>=MINMONSTER)||(ATYPE<=MAXMONSTER)) {
+ /* bonus for monsters (scare factor) */
+ armbonus += 5;
+ }
+ }
+ }
+
+ /*army status is important*/
+ if(ASTAT==MARCH) armbonus-=40;
+
+ /*if a fortress*/
+ if(fort_val(&sct[xspot][yspot]) > 0){
+ /*Cavalry and Knights get -20%*/
+ if((ATYPE == A_CAVALRY) ||(ATYPE == A_KNIGHT)) armbonus -= 20;
+ /*Archers gain pluses*/
+ else if((ATYPE == A_ARCHER)&&(sct[xspot][yspot].owner==country))
+ armbonus += 15;
+ else if(ATYPE == A_ARCHER) armbonus += 5;
+ }
+
+ if(side[num]==ATKR) armbonus+= *(unitattack+(ATYPE%UTYPE));
+ else armbonus+= *(unitdefend+(ATYPE%UTYPE));
+
+ /*Phalanx and Legionaires need certain numbers of troops*/
+ if((ATYPE==A_PHALANX)||(ATYPE==A_LEGION)) {
+ if(ASOLD>1000){ armbonus+=20;
+ } else if(ASOLD>500) armbonus+=10;
+ }
+
+ return(armbonus);
+}
+
+void
+fdxyretreat() /* finds retreat location */
+{
+ int x,y,nation=(-1);
+ int xsctr= xspot;
+ int ysctr= yspot;
+
+ retreatx=xsctr;
+ retreaty=ysctr;
+
+ if((sct[xsctr][ysctr].designation==DTOWN)
+ ||(sct[xsctr][ysctr].designation==DCAPITOL)
+ ||(sct[xsctr][ysctr].designation==DCITY)){
+ retreatside=0;
+ return;
+ }
+
+ if(retreatside == ATKR) nation=anation;
+ else nation=dnation;
+
+ for(x= xsctr-1; x<=xsctr+1; x++)
+ for(y= ysctr-1; y<=ysctr+1; y++) if(ONMAP(x,y)){
+ if(tofood( &sct[x][y],
+ sct[x][y].owner == country ? country : 0)==0) continue;
+ if(((sct[x][y].owner == nation)
+ ||(ntn[sct[x][y].owner].dstatus[nation] < NEUTRAL))
+ ||(solds_in_sector( x, y, sct[x][y].owner) == 0)){
+ retreatx=x;
+ retreaty=y;
+#ifdef DEBUG
+ printf("armies in %d %d retreat to %d %d\n",xsctr,ysctr,x,y);
+#endif /* DEBUG */
+ return;
+ }
+ }
+}
+
+void
+retreat(unitnum)
+int unitnum; /* if -1 then normal, else retreat only unit ismerc */
+{
+ int cnum;
+
+ if(retreatside == 0) return;
+
+ for(cnum=0;cnum(-1)){
+ if( unitnum != (-1) ) cnum=unitnum;
+ if(side[cnum] == retreatside){
+ if ((ntn[owner[cnum]].arm[unit[cnum]].unittyp==A_MARINES)||
+ (ntn[owner[cnum]].arm[unit[cnum]].unittyp==A_SAILOR)){
+ ntn[owner[cnum]].arm[unit[cnum]].sold *= 85;
+ ntn[owner[cnum]].arm[unit[cnum]].sold /= 100;
+ } else {
+ ntn[owner[cnum]].arm[unit[cnum]].xloc = retreatx;
+ ntn[owner[cnum]].arm[unit[cnum]].yloc = retreaty;
+ }
+ }
+ if( unitnum != (-1) ) return;
+ }
+}
+
+
+/*SUBROUTINE TO RUN NAVAL COMBAT ON ALL SHIPS */
+/* quick define for easier reading */
+#define QWAR 1
+#define QGAL 2
+#define QMER 3
+/* just like fight, this takes array of owner,side,unit and calculates */
+/* a random battle based on the strengths of the combatants. */
+void
+navalcbt()
+{
+ int acrew=0,dcrew=0; /*a's and d's crew and soldier strength*/
+ int ahold=0,dhold=0; /*a's and d's warship strength*/
+ int awsunk=0,dwsunk=0; /*a's and d's warship losses for the round*/
+ int agsunk=0,dgsunk=0; /*a's and d's galley losses for the round*/
+ int amsunk=0,dmsunk=0; /*a's and d's merchent losses for the round*/
+ int awcapt=0,dwcapt=0; /*a's and d's warship captures for the round*/
+ int agcapt=0,dgcapt=0; /*a's and d's galley captures for the round*/
+ int amcapt=0,dmcapt=0; /*a's and d's merchant captures for the round*/
+ int akcrew=0,dkcrew=0; /*a's and d's crew losses for the round*/
+ char wnum[MGKNUM],gnum[MGKNUM],mnum[MGKNUM];
+ register int done,i,j,k;
+ int roll,odds,savecntry=country;
+ int PAloss, PDloss, Ploss, which, shipsize;
+ int thold, ghold, nvynum, armynum;
+ int dcptpct, acptpct, cptpct;
+ struct s_nation *saventn=curntn;
+ void show_ships(),capture();
+
+ printf("In Naval Combat....\n");
+
+ /* determine who is attacker & who is on defenders side?*/
+ for(j=0;jHOSTILE)) side[j]=ATKR;
+ else if((ntn[owner[j]].dstatus[anation]==ALLIED)
+ &&(ntn[owner[j]].dstatus[dnation]>HOSTILE)) side[j]=ATKR;
+ }
+
+ /* Loop through all competitors to determine
+ * relative combat strengths:
+ * men/unit strength
+ * crew on ship:
+ * warship crew 1
+ * galley crew 2
+ * merchant crew 4
+ * soldiers onboard:
+ * SAILOR/ARCHER 3/4
+ * MARINE 1/3
+ * others 4/3
+ */
+ for(j=0;j0) {
+ dhold += k;
+ if (magic(country,SAILOR)==TRUE) {
+ dcrew += 5*k*curntn->nvy[unit[j]].crew/4;
+ } else dcrew += k*curntn->nvy[unit[j]].crew;
+ }
+ if((k=fltmhold(unit[j]))>0) {
+ if (magic(country,SAILOR)==TRUE) {
+ dcrew += 5*k*curntn->nvy[unit[j]].crew/16;
+ } else dcrew += k*curntn->nvy[unit[j]].crew/4;
+ }
+ if((k=fltghold(unit[j]))>0) {
+ if (magic(country,SAILOR)==TRUE) {
+ dcrew += 5*k*curntn->nvy[unit[j]].crew/8;
+ } else dcrew += k*curntn->nvy[unit[j]].crew/2;
+ if(curntn->nvy[unit[j]].armynum!=MAXARM) {
+ k = curntn->nvy[unit[j]].armynum;
+ switch (curntn->arm[k].unittyp) {
+ case A_ARCHER:
+ case A_SAILOR:
+ dcrew += 3*curntn->arm[k].sold/2;
+ break;
+ case A_MARINES:
+ dcrew += 3*curntn->arm[k].sold;
+ break;
+ default:
+ dcrew += 3*curntn->arm[k].sold/4;
+ break;
+ }
+ }
+ }
+ } else if(side[j]==ATKR) {
+ if((k=fltwhold(unit[j]))>0) {
+ ahold += k;
+ if (magic(country,SAILOR)==TRUE) {
+ acrew += 5*k*curntn->nvy[unit[j]].crew/4;
+ } else acrew += k*curntn->nvy[unit[j]].crew;
+ }
+ if((k=fltmhold(unit[j]))>0) {
+ if (magic(country,SAILOR)==TRUE) {
+ acrew += 5*k*curntn->nvy[unit[j]].crew/16;
+ } else acrew += k*curntn->nvy[unit[j]].crew/4;
+ }
+ if((k=fltghold(unit[j]))>0) {
+ if (magic(country,SAILOR)==TRUE) {
+ acrew += 5*k*curntn->nvy[unit[j]].crew/8;
+ } else acrew += k*curntn->nvy[unit[j]].crew/2;
+ if(curntn->nvy[unit[j]].armynum!=MAXARM) {
+ k = curntn->nvy[unit[j]].armynum;
+ switch (curntn->arm[k].unittyp) {
+ case A_ARCHER:
+ case A_SAILOR:
+ acrew += 3*curntn->arm[k].sold/2;
+ break;
+ case A_MARINES:
+ acrew += 3*curntn->arm[k].sold;
+ break;
+ default:
+ acrew += 3*curntn->arm[k].sold/4;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /*find battle odds*/
+ if( acrew > dcrew*100 ) odds=10000;
+ else if ( dcrew > acrew*100 ) odds=1;
+ else odds = (acrew*100)/dcrew;
+
+ /* calculate capture percentages */
+ /*
+ * This formula produces:
+ * 0% capture for 1:100 odds
+ * 2% capture for 1:10 odds
+ * 15% capture for 1:1 odds
+ * 60% capture for 10:1 odds
+ * 100% capture for >60:1 odds
+ * with linear progression between each.
+ */
+ if (odds>6000) {
+ dcptpct=0;
+ acptpct=100;
+ } else if (odds>1000) {
+ dcptpct= (6000-odds)/2500;
+ acptpct= (odds-1000)/125+60;
+ } else if (odds>100) {
+ dcptpct= (1000-odds)/69+2;
+ acptpct= (odds-100)/20+15;
+ } else if (odds>10) {
+ dcptpct= (100-odds)/2+15;
+ acptpct= (odds-10)/6.9+2;
+ } else if (odds>6) {
+ dcptpct= (10-odds)*14+60;
+ acptpct= (odds-6)/2;
+ } else {
+ dcptpct= 100;
+ acptpct= 0;
+ }
+#ifdef DEBUG
+ printf("capture percentage: attack = %d defend = %d\n",acptpct,dcptpct);
+#endif /* DEBUG */
+
+ /*figure combat on a one-to-one basis */
+ /* use a bell curve roll */
+ roll = 0;
+ for(i=0;i<5;i++) {
+ roll += rand()%21+1;
+ }
+ roll -= 5;
+ PDloss = MAXLOSS * roll / 100;
+ PAloss = MAXLOSS * (100 - roll) / 100;
+#ifdef DEBUG
+ printf("Pdloss = %d PAloss = %d\n",PDloss,PAloss);
+#endif /* DEBUG */
+
+ /* adjust based on the odds */
+ if( odds == 1 ) {
+ PDloss = 0;
+ PAloss = 100;
+ } else if ( odds == 10000 ) {
+ PAloss = 0;
+ PDloss = 100;
+ } else if ( odds > 100 ) {
+ PDloss += (odds / 10 - 10); /* 10% increase */
+ PAloss -= (odds / 25 - 4); /* 4% decrease */
+ if(PAloss<(100-roll)/5)
+ PAloss=(100-roll)/5;
+ } else {
+ PAloss += ( 1000 / odds - 10); /* 10% increase */
+ PDloss -= ( 400 / odds - 4); /* 4% decrease */
+ if(PDloss100) PAloss=100;
+ if (PDloss>100) PDloss=100;
+
+ /* calculate actual losses */
+ for(j=0;j90) {
+ /* destroy a ship */
+ NSUB_WAR(1);
+ k = P_NCREW*(shipsize+1);
+ thold -= (shipsize+1);
+ if(which==ATKR) {
+ awsunk++;
+ ahold-=(shipsize+1);
+ akcrew+=k;
+ } else {
+ dwsunk++;
+ dhold-=(shipsize+1);
+ dkcrew+=k;
+ }
+ } else {
+ /* damage a ship */
+ k = (shipsize+1)*Ploss*P_NCREW/100;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ P_NCREW -= k/thold;
+ }
+ }
+ /* check galleys */
+ for(i=0;i90) {
+ /* ship destroyed */
+ k = (shipsize+1)*SHIPCREW;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ NSUB_GAL(1);
+ ghold-=(shipsize+1);
+ thold-=(shipsize+1);
+ /* kill all soldiers onboard */
+ if (P_NARMY!=MAXARM) {
+ armynum = P_NARMY;
+ k = P_ASOLD*(shipsize+1)/(ghold+shipsize+1);
+ if(P_ATYPE90) {
+ /* ship destroyed */
+ k = (shipsize+1)*P_NCREW;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ P_NCREW -= k/thold;
+ k = P_NCREW*thold;
+ NSUB_MER(1);
+ if((thold-=(shipsize+1))!=0) P_NCREW = k / thold;
+ else P_NCREW = 0;
+ /* kill all people onboard */
+ k = (shipsize+1)*P_NPEOP;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ P_NPEOP -= k/(thold+shipsize+1);
+ k = P_NPEOP*(thold+shipsize+1);
+ if (thold>0) P_NPEOP = k / thold;
+ else P_NPEOP=0;
+ if(which==ATKR) amsunk++;
+ else dmsunk++;
+ } else {
+ /* damage a ship */
+ k = (shipsize+1)*Ploss*P_NCREW/100;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ P_NCREW -= k/thold;
+ /* damage any people onboard */
+ k = (shipsize+1)*Ploss*P_NPEOP/100;
+ if(which==ATKR) akcrew += k;
+ else dkcrew += k;
+ P_NPEOP -= k/thold;
+ }
+ }
+ }
+ }
+#ifdef HIDELOC
+ fprintf(fnews,"4.\tNaval Battle occurs");
+#else
+ fprintf(fnews,"4.\t%d,%d: Naval Battle",xspot,yspot);
+#endif
+ for(j=0;j percent loss %d%%\n",acrew,PAloss);
+ fprintf(fm,"defender strength (%d men) -> percent loss %d%%\n",dcrew,PDloss);
+ fprintf(fm,"Odds are %d to 100; RANDOM ROLL is %d\n",odds,roll);
+ fprintf(fm,"RESULT: Attackers lose %d men Defenders lose %d men\n",akcrew,dkcrew);
+ /* display any other results */
+ show_ships("Attacking","sunk",awsunk,agsunk,amsunk);
+ show_ships("Defending","sunk",dwsunk,dgsunk,dmsunk);
+ show_ships("Attacking","captured",awcapt,agcapt,amcapt);
+ show_ships("Defending","captured",dwcapt,dgcapt,dmcapt);
+ mailclose(owner[j]);
+ }
+ }
+ curntn= saventn;
+ country= savecntry;
+ printf("Out Naval Combat....\n");
+}
+
+/* routine to distribute a captured ship */
+void
+capture(type,to,shipsize,holdcount)
+ int type,to,shipsize,holdcount;
+{
+ int i,nvynum;
+ struct s_nation *saventn=curntn;
+#ifdef DEBUG
+ printf("capture: hdcnt==%d typ==%d spsz==%d to==%d\n",holdcount,
+ type,shipsize,to);
+#endif /* DEBUG */
+ for (i=0;holdcount && i0) {
+ fprintf(fm,"%s ships %s: ",who,what);
+ if (war) fprintf(fm,"%d Warships ",war);
+ if (gal) fprintf(fm,"%d Galleys ",gal);
+ if (mer) fprintf(fm,"%d Merchants",mer);
+ putc('\n',fm);
+ }
+}
diff --git a/original/commands.c b/original/commands.c
new file mode 100644
index 0000000..f966bb6
--- /dev/null
+++ b/original/commands.c
@@ -0,0 +1,1465 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+#include
+#include
+#include
+#include
+#include
+#ifdef CONQUER
+#include
+#include
+#endif /*CONQUER*/
+#include "header.h"
+#include "data.h"
+
+extern long conq_mail_size;
+
+extern FILE *fexe; /*execute file pointer*/
+extern short country;
+extern short selector;
+extern short pager;
+extern short xcurs,ycurs,xoffset,yoffset;
+extern short redraw;
+
+int roads_this_turn = 0;
+
+/* routine to determine if the given designation is ok; TRUE for ok */
+int
+desg_ok(prtflag, desg, sptr)
+ int prtflag;
+ char desg;
+ struct s_sector *sptr;
+{
+ /* check vegetation */
+ if((desg!=DNODESIG)&&(desg!=DROAD)&&(desg!=DFORT)
+ &&(desg!=DSTOCKADE)&&(tofood(sptr,country)designation) {
+ if(prtflag) errormsg("Hey, get your act together! There is already one there.");
+ return(FALSE);
+ }
+
+ /* check for city/capitol being made into something else */
+ if((desg!=DRUIN)
+ &&((desg!=DCAPITOL && sptr->designation==DCITY)
+ ||sptr->designation==DCAPITOL)) {
+ if(prtflag) {
+ char buf[LINELTH+1];
+ sprintf(buf,"Must first burn down city/capitol (designate as '%c')",DRUIN);
+ errormsg(buf);
+ }
+ return(FALSE);
+ }
+
+ /* check for proper population */
+ if((sptr->people<500)
+ &&(desg==DCAPITOL || desg==DCITY || desg==DTOWN)) {
+ if(prtflag) errormsg("Need 500 people to build a city or town");
+ return(FALSE);
+ }
+
+ /* only god may create pirate */
+ if(desg==DBASECAMP) {
+ if(prtflag) errormsg("A Pirate Cove?? Are you serious?!");
+ return(FALSE);
+ }
+
+ /* should not appear in display list */
+ if (prtflag==FALSE &&
+ ((desg==DSPECIAL && sptr->tradegood!=TG_stones) || desg==DNODESIG))
+ return(FALSE);
+
+ if (desg==DRUIN) {
+ if(sptr->designation!=DCITY&&sptr->designation!=DCAPITOL) {
+ if(prtflag) errormsg("Ruins may only come from cities or capitols");
+ return(FALSE);
+ }
+ }
+
+ if (desg==DCAPITOL || desg==DCITY) {
+ if((desg==DCAPITOL && sptr->designation!=DCITY)
+ && sptr->designation!=DTOWN && sptr->designation!=DRUIN) {
+ if(prtflag) errormsg("You can't build a city from that!");
+ return(FALSE);
+ }
+ }
+
+ if (desg==DUNIVERSITY || desg==DLUMBERYD) {
+ if((sptr->tradegood != TG_none)
+ &&(*(tg_stype + sptr->tradegood) != desg)
+ &&(*(tg_stype + sptr->tradegood) != 'x')) {
+ if(prtflag) errormsg("You can't have one of those here!");
+ return(FALSE);
+ }
+ }
+
+ if(desg==DMINE || desg==DGOLDMINE) {
+ if( !tg_ok( country, sptr )) {
+ if(prtflag) errormsg("Your people refuse to be unemployed");
+ return(FALSE);
+ }
+ if((desg==DMINE && sptr->metal==0 )
+ ||( desg==DGOLDMINE && sptr->jewels==0)) {
+ if(prtflag) errormsg("Your people refuse to be unemployed");
+ return(FALSE);
+ }
+ }
+
+ if((desg==DSPECIAL)&&(magic(country,SUMMON)!=TRUE)) {
+ if(prtflag) errormsg("You are gonna need SUMMON power to use those stones!");
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+/*change current hex designation*/
+void
+redesignate()
+{
+ char newdes;
+ char tgtype[NAMELTH+1];
+ struct s_sector *sptr= &sct[XREAL][YREAL];
+ short x,y;
+ long metal=0;
+ int isgod=FALSE;
+
+ if(country==0){
+ isgod=TRUE;
+ country=sptr->owner;
+ curntn= &ntn[country];
+
+ clear_bottom(0);
+ mvaddstr(LINES-4,0,"SUPER USER: CHANGE (v)eg, (e)lev, (d)esig, (o)wner, (p)op, (t)radegood");
+ refresh();
+ switch(getch()){
+ case 'd':
+ /* fall into normal redesignation command */
+ break;
+ case 'e':
+ /*simple contour map definitions*/
+ mvprintw(LINES-3,7,"ELEVATIONS: change to %c, %c, %c, %c or %c?",WATER,PEAK,MOUNTAIN,HILL,CLEAR);
+ refresh();
+ newdes=getch();
+ if(newdes!=WATER&&newdes!=PEAK&&newdes!=MOUNTAIN
+ &&newdes!=HILL&&newdes!=CLEAR) {
+ reset_god();
+ return;
+ }
+ sptr->altitude=newdes;
+ if((newdes==PEAK)||(newdes==WATER)) {
+ sptr->owner=0;
+ sptr->people=0;
+ sptr->fortress=0;
+ }
+ /*will fall through as must change vegetation*/
+ case 'v':
+ /*vegetation types*/
+ mvprintw(LINES-3,7,"VEGETATIONS: change to %c, %c, %c, %c, %c, %c, %c, %c, %c, %c, %c or %c?",
+ VOLCANO,DESERT,TUNDRA,BARREN,LT_VEG,
+ GOOD,WOOD,FOREST,JUNGLE,SWAMP,ICE,NONE);
+ refresh();
+ newdes=getch();
+ if(newdes!=VOLCANO
+ &&newdes!=DESERT&&newdes!=TUNDRA
+ &&newdes!=BARREN&&newdes!=LT_VEG
+ &&newdes!=NONE&&newdes!=GOOD
+ &&newdes!=WOOD&&newdes!=FOREST&&newdes!=JUNGLE
+ &&newdes!=SWAMP&&newdes!=ICE) {
+ reset_god();
+ return;
+ }
+ sptr->vegetation=newdes;
+ if( tofood(sptr,0) < DESFOOD )
+ sptr->designation=newdes;
+ else sptr->designation=DNODESIG;
+ reset_god();
+ return;
+ case 'o':
+ mvaddstr(LINES-3,7,"What nation owner:");
+ refresh();
+ x = get_country();
+ if (x>0 && xowner=x;
+ reset_god();
+ return;
+ case 'p':
+ if (sptr->altitude == WATER) {
+ errormsg("Trying to build a colony of mermen?");
+ reset_god();
+ return;
+ }
+ mvaddstr(LINES-3,7,"new population for sector: ");
+ refresh();
+ metal = get_number();
+ if (metal <= (-1)) return;
+ sptr->people = metal;
+ reset_god();
+ return;
+ case 't':
+ x=TRUE;
+ while(x==TRUE) {
+ mvaddstr(LINES-2,7,"new sector tradegood type:");
+ clrtoeol();
+ refresh();
+ get_nname(tgtype);
+ if(strlen(tgtype)==0) {
+ reset_god();
+ return;
+ }
+ for(y=0;x==TRUE && y<=TG_none;y++)
+ if(strcmp(tg_name[y],tgtype)==0) x=FALSE;
+ }
+ y--;
+ if((y!=TG_none)&&(y>END_NORMAL)) {
+ mvaddstr(LINES-1,7,"new sector value: ");
+ refresh();
+ x = get_number();
+ if(x<100 && x>0) {
+ if(y>END_MINE) {
+ sptr->jewels = (char)x;
+ sptr->metal = 0;
+ } else {
+ sptr->metal = (char)x;
+ sptr->jewels = 0;
+ }
+ } else {
+ sptr->jewels = 0;
+ sptr->metal = 0;
+ }
+ } else {
+ sptr->jewels=0;
+ sptr->metal=0;
+ }
+ sptr->tradegood= (char)y;
+ reset_god();
+ return;
+ default:
+ reset_god();
+ return;
+ }
+ }
+
+ clear_bottom(0);
+ if((SOWN!=country)&&(isgod==FALSE)) {
+ errormsg("Hey! You don't own that sector!");
+ return;
+ }
+
+ mvaddstr(LINES-4,0,"Possible sector designations: ");
+ x = 30;
+ y = LINES-4;
+ for(newdes=0; *(des+newdes) != '0'; newdes++ ) {
+ if((isgod==TRUE)||desg_ok(FALSE,*(des+newdes),sptr)) {
+ mvprintw(y,x,"(%c)",*(des+newdes));
+ x+=4;
+ if(x>COLS-15) {
+ x=5;
+ y++;
+ }
+ }
+ }
+
+ if((sptr->tradegood != TG_none)
+ &&( *(tg_stype+sptr->tradegood) != 'x')
+ &&( isgod==TRUE || desg_ok(FALSE,*(tg_stype+sptr->tradegood),sptr)) )
+ mvprintw(y,x,"(%c special=>%c)",DSPECIAL,*(tg_stype+sptr->tradegood));
+
+ mvaddstr(++y,0," What new designation:");
+ refresh();
+
+ /*read answer*/
+ if((newdes=getch())==DSPECIAL) {
+ if((sptr->tradegood == TG_none)
+ ||( *(tg_stype+sptr->tradegood) == 'x')||(isgod==FALSE
+ && !desg_ok(FALSE,*(tg_stype+sptr->tradegood),sptr)) ) {
+ errormsg("no special designation possible" );
+ if(isgod==TRUE) reset_god();
+ return;
+ } else
+ newdes = *(tg_stype + sptr->tradegood);
+ }
+
+ for(x=0; *(des+x) != '0'; x++ )
+ if(newdes == *(des+x)) break;
+
+ if(*(des+x) == '0') {
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ /* validate designation */
+ if((isgod==FALSE)&&!desg_ok(TRUE,newdes,sptr)) {
+ return;
+ }
+
+ if (newdes == DROAD && isgod==FALSE) {
+ if( sptr->people < 100 ) {
+ errormsg("Need 100+ people to build a road!");
+ return;
+ }
+ roads_this_turn++;
+ if (roads_this_turn>2) {
+ roads_this_turn=2;
+ errormsg("Only two roads a turn! Let the road crews sleep!!");
+ return;
+ }
+ }
+
+ /* do not need metal to build a capitol from a city */
+ if((newdes==DFORT)||(newdes == DTOWN)) metal=DESCOST;
+ else if((newdes == DCITY)
+ ||(newdes == DCAPITOL && sptr->designation!=DCITY)) metal=5*DESCOST;
+
+ if((newdes!=DTOWN)&&(newdes!=DFORT)&&(newdes!=DCITY)&&(newdes!=DCAPITOL)){
+ /*decrement treasury*/
+ if(newdes==DRUIN) {
+ if (sptr->fortress>4) {
+ sptr->fortress-=4;
+ } else {
+ sptr->fortress=0;
+ }
+ } else if (sptr->designation==DRUIN) {
+ curntn->tgold-=REBUILDCOST;
+ }
+ sptr->designation=newdes;
+
+ SADJDES;
+ if(newdes == DSTOCKADE)
+ curntn->tgold-=STOCKCOST*(1-isgod);
+ else
+ curntn->tgold-=DESCOST*(1-isgod);
+
+ } else if((isgod==FALSE)&&(curntn->metalsdesignation==DRUIN){
+ curntn->tgold-=10*DESCOST*(1-isgod);
+ curntn->metals-=metal/2*(1-isgod);
+ } else {
+ curntn->tgold-=20*DESCOST*(1-isgod);
+ if(newdes==DCITY || sptr->designation!=DCITY)
+ curntn->metals-=metal*(1-isgod);
+ }
+ x=curntn->capx; /* need this for SADJDES2 */
+ y=curntn->capy;
+ /* can only have one capitol */
+ if(newdes==DCAPITOL){
+ if (sct[x][y].owner==country) {
+ sct[x][y].designation=DCITY;
+ SADJDES2;
+ }
+ curntn->capx=XREAL;
+ curntn->capy=YREAL;
+ }
+ sptr->designation=newdes;
+ SADJDES;
+ } else if((newdes==DFORT)||(newdes==DTOWN)){
+ curntn->tgold-=10*DESCOST*(1-isgod);
+ curntn->metals-=metal*(1-isgod);
+ sptr->designation=newdes;
+ SADJDES;
+ } else errormsg("Serious error: What designation are you?");
+ if(isgod==TRUE) reset_god();
+}
+
+/*build fort or ship-type */
+void
+construct()
+{
+ int tmpvar,tmpvar2,onboard;
+ long cost;
+ int armbonus;
+ int x,y;
+ short nvynum=0;
+ short shipsize,amount;
+ short isgod=FALSE;
+ char type;
+
+ clear_bottom(0);
+ if(country==0){
+ isgod=TRUE;
+ country=sct[XREAL][YREAL].owner;
+ curntn= &ntn[country];
+ }
+
+ if(sct[XREAL][YREAL].owner!=country) {
+ errormsg("You do not own");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if((isgod==FALSE)&&(sct[XREAL][YREAL].people<=500)) {
+ errormsg("You need over 500 people to construct");
+ return;
+ }
+
+ if((isgod==FALSE) && (curntn->tgold < 0 )) {
+ errormsg("You are broke");
+ return;
+ }
+ tmpvar=FALSE;
+ for(x=XREAL-1;x<=XREAL+1;x++)
+ for(y=YREAL-1;y<=YREAL+1;y++)
+ if(ONMAP(x,y) && sct[x][y].altitude==WATER)
+ tmpvar=TRUE;
+
+ if((sct[XREAL][YREAL].designation==DTOWN)
+ ||(sct[XREAL][YREAL].designation==DFORT)
+ ||(sct[XREAL][YREAL].designation==DCAPITOL)
+ ||(sct[XREAL][YREAL].designation==DCITY)) {
+ /*calculate cost for fort*/
+ cost=FORTCOST;
+ if(isgod==TRUE) cost=0;
+ else for(x=1;x<=sct[XREAL][YREAL].fortress;x++)
+ cost*=2;
+
+ if(sct[XREAL][YREAL].designation==DTOWN) armbonus=TOWNSTR;
+ else if(sct[XREAL][YREAL].designation==DFORT) armbonus=FORTSTR;
+ else if(sct[XREAL][YREAL].designation==DCAPITOL) armbonus=CITYSTR;
+ else if(sct[XREAL][YREAL].designation==DCITY) armbonus=CITYSTR;
+ if(magic(country,ARCHITECT)==TRUE) armbonus*=2;
+
+ if(tmpvar)
+ mvprintw(LINES-4,0,"ortify sector (+%d%%/%ld talons); uild or epair ships?: ",armbonus,cost);
+ else
+ mvprintw(LINES-4,0,"ortify sector (+%d%% - %ld talons):",armbonus,cost);
+ refresh();
+ type=getch();
+ } else {
+ errormsg("Must construct in town, city, or fortress");
+ if (isgod==TRUE) reset_god();
+ return;
+ }
+
+ /* construct ships*/
+ if((type=='b')||(type=='r')) {
+ /*check if next to sea*/
+ if((tmpvar==FALSE)||(sct[XREAL][YREAL].designation==DFORT)){
+ errormsg("not in a harbor");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ nvynum=getselunit()-MAXARM;
+ if(type=='r') {
+ if((nvynum>=MAXNAVY)||(nvynum<0)){
+ errormsg("INVALID NAVY");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ if (P_NCREW==SHIPCREW) {
+ errormsg("You may only &^#$! repair damaged fleets!!!");
+ return;
+ }
+ clear_bottom(0);
+ shipsize = flthold(nvynum);
+ mvprintw(LINES-4,0,"Repairing Fleet (%d)",nvynum);
+ mvprintw(LINES-4,30,"Storage Units [%d]",shipsize);
+ mvprintw(LINES-3,0,"crew per unit = %d",(int)P_NCREW);
+ mvprintw(LINES-3,30,"max crew per unit = %d",SHIPCREW);
+ mvaddstr(LINES-2,0,"How many crew per unit do you wish to add:");
+ clrtoeol();
+ refresh();
+ amount = (short) get_number();
+ if (amount<0) {
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+
+ /* find cost of repairs on all ships */
+ cost = 0;
+ for(tmpvar=N_LIGHT;tmpvar<=N_HEAVY;tmpvar++) {
+ cost += (tmpvar+1)*WARSHPCOST*P_NWAR(tmpvar);
+ cost += (tmpvar+1)*MERSHPCOST*P_NMER(tmpvar);
+ cost += (tmpvar+1)*GALSHPCOST*P_NGAL(tmpvar);
+ }
+ cost *= amount / SHIPCREW;
+
+ if(isgod==TRUE) cost=0;
+ else if(magic(country,SAILOR)==TRUE) cost/=2L;
+
+ if( curntn->tgold < cost ) {
+ errormsg("NOT ENOUGH GOLD");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if( sct[XREAL][YREAL].people < amount * shipsize) {
+ errormsg("NOT ENOUGH CIVILIANS IN SECTOR");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if( SHIPCREW < P_NCREW + amount ){
+ errormsg("THAT WOULD EXCEED MAXIMUM SHIP CREW");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ curntn->tgold -= cost;
+ sct[XREAL][YREAL].people -= amount*shipsize;
+ P_NCREW += (unsigned char) amount;
+ NADJCRW;
+ SADJCIV;
+
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ mvaddstr(LINES-3,0,"Do you wish to raise a new fleet? (y or n)");
+ clrtoeol();
+ refresh();
+ if(getch()=='y') nvynum=(-1);
+
+ clear_bottom(0);
+ if(nvynum<0) {
+ nvynum=0;
+ x=(-1);
+ while((x==(-1))&&(nvynumN_MASK)) amount=0;
+ if (amount<=0)
+ {
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ /* 6 and 3 hard coded ... see above comment */
+ cost = (long) amount * ( shipsize%3 + 1 );
+ if (shipsize>=6) {
+ cost *= MERSHPCOST;
+ } else if (shipsize>=3) {
+ cost *= GALSHPCOST;
+ } else {
+ cost *= WARSHPCOST;
+ }
+
+ if(isgod==TRUE) cost=0;
+ else if(magic(country,SAILOR)==TRUE) cost/=2L;
+
+ if((cost > curntn->tgold) && (cost > 0)) {
+ errormsg("sorry - not enough talons");
+ return;
+ }
+
+ if( sct[XREAL][YREAL].people < amount * (shipsize+1) * SHIPCREW ){
+ errormsg("NOT ENOUGH CIVILIANS IN SECTOR");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ if((nvynum>=0)&&(nvynum=6) {
+ shipsize %= 3;
+ tmpvar2 = NADD_MER(amount);
+ } else if (shipsize>=3) {
+ shipsize %= 3;
+ tmpvar2 = NADD_GAL(amount);
+ } else {
+ shipsize %= 3;
+ tmpvar2 = NADD_WAR(amount);
+ }
+
+ /* check for bad build */
+ if (tmpvar2==FALSE) {
+ errormsg("Too many such ships in fleet.");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ /* crew average based on number of holding units */
+ P_NCREW = (unsigned char)( tmpvar / flthold(nvynum) );
+
+ sct[XREAL][YREAL].people-=amount*(shipsize+1)*SHIPCREW;
+ curntn->tgold -= cost;
+
+ P_NXLOC =XREAL;
+ P_NYLOC =YREAL;
+ P_NMOVE=0;
+
+ mvprintw(LINES-4,0,"Fleet (%2d): Warships = [Light %2hd/Medium %2hd/Heavy %2hd]",nvynum,P_NWAR(N_LIGHT),P_NWAR(N_MEDIUM),P_NWAR(N_HEAVY));
+ mvprintw(LINES-3,0," Merchants = [Light %2hd/Medium %2hd/Heavy %2hd]",P_NMER(N_LIGHT),P_NMER(N_MEDIUM),P_NMER(N_HEAVY));
+ mvprintw(LINES-2,0,"Avg Crew[%3d] Galleys = [Light %2hd/Medium %2hd/Heavy %2hd]",(int)P_NCREW,P_NGAL(N_LIGHT),P_NGAL(N_MEDIUM),P_NGAL(N_HEAVY));
+
+ if(fltmhold(nvynum)>0)
+ P_NPEOP = (unsigned char) (onboard/fltmhold(nvynum));
+ else P_NPEOP = 0;
+ SADJCIV;
+ NADJCRW;
+ NADJWAR;
+ NADJMER;
+ NADJGAL;
+ NADJHLD;
+ NADJLOC;
+ NADJMOV;
+ mvaddstr(LINES-2,65,"HIT ANY KEY");
+ refresh();
+ getch();
+
+ } else errormsg("ERROR!!!!!!!!!!!!!");
+ }
+ /* construct fortification points*/
+ else if(type=='f'){
+ /* can only go into debt as much as the nation has jewels */
+ if (sct[XREAL][YREAL].fortress>11) {
+ errormsg("That sector is as impregnable as you can make it");
+ } else if ((curntn->tgold - cost) >= ((-1)*10*curntn->jewels)) {
+ mvprintw(LINES-2,5,"you build +%d%% fort points for %ld gold",armbonus,cost);
+ curntn->tgold-=cost;
+ sct[XREAL][YREAL].fortress++;
+ INCFORT;
+ errormsg("");
+ } else errormsg("you may not spend that much");
+ }
+ else errormsg("invalid input error");
+
+ if(isgod==TRUE) reset_god();
+ refresh();
+}
+
+/*DRAFT IF IN A CITY*/
+void
+draft()
+{
+ short armynum,x,y,i;
+ long men=0,mercs;
+ short army=(-1), isgod=FALSE, newtype=0;
+ long i_cost, e_cost;
+ char ch;
+
+ clear_bottom(0);
+ if(country==0) {
+ isgod=TRUE;
+ country=sct[XREAL][YREAL].owner;
+ curntn= &ntn[country];
+ } else if(sct[XREAL][YREAL].owner!=country) {
+ errormsg("You do not own");
+ return;
+ }
+
+ if((sct[XREAL][YREAL].designation!=DTOWN)
+ &&(sct[XREAL][YREAL].designation!=DCAPITOL)
+ &&(sct[XREAL][YREAL].designation!=DCITY)) {
+ errormsg("must raise in towns/cities/capitols");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if(curntn->tgold <= 0){
+ errormsg("You are broke");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ if(ISCITY(sct[XREAL][YREAL].designation)
+ &&(sct[XREAL][YREAL].people*(3*CITYLIMIT+(curntn->tsctrs/2))tciv)){
+ mvprintw(LINES-1,0,"Need %d people in sector: hit any key",curntn->tciv/(3*CITYLIMIT+(curntn->tsctrs/2)));
+ refresh();
+ getch();
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ /*ask what type of unit*/
+ y=LINES-2;
+ mvaddstr(y,0,"options: 1) spy 2) scout");
+ clrtoeol();
+ x=25;
+ for(i=0;i<=NOUNITTYPES;i++){
+ if(unitvalid(i)==TRUE) {
+ mvprintw(y,x+2,"%s",*(shunittype+i));
+ mvprintw(y,x,"(%c)",*(shunittype+i)[0]);
+ x+= strlen( *(shunittype+i) ) +3;
+ if(x>COLS-10){
+ x=0;
+ y++;
+ }
+ }
+ }
+ move(y,x);
+ clrtoeol();
+ if((magic(country,WARRIOR)==TRUE)
+ ||(magic(country,WARLORD)==TRUE)
+ ||(magic(country,CAPTAIN)==TRUE))
+ mvaddstr(LINES-3,0,"(Warrior = 1/2 enlist cost) what type of unit do you want:");
+ else
+ mvaddstr(LINES-3,0,"what type of unit do you want to raise:");
+
+ clrtoeol();
+ refresh();
+ ch = getch();
+ for(newtype=0;newtype<=NOUNITTYPES;newtype++)
+ if(ch == *(shunittype+newtype)[0]) break;
+
+ if((newtype == NOUNITTYPES+1 )||(unitvalid(newtype)==FALSE)) {
+ if( ch == '1' ) newtype=A_SPY;
+ else if( ch == '2' ) newtype=A_SCOUT;
+ else {
+ errormsg("Invalid type");
+ if (isgod==TRUE) reset_god();
+ return;
+ }
+ }
+ clear_bottom(0);
+
+ /* marines and sailors may only be drafted in harbors */
+ if(newtype==A_MARINES || newtype==A_SAILOR) {
+ i=FALSE;
+ for (x=XREAL-1;x<=XREAL+1;x++)
+ for (y=YREAL-1;y<=YREAL+1;y++)
+ if (sct[x][y].altitude==WATER) i=TRUE;
+
+ /* not a harbor */
+ if (i==FALSE) {
+ if (newtype==A_MARINES)
+ errormsg("Huh? What would marines do without the water?");
+ else errormsg("You gotta be kinding!? Sailors on land?");
+ if (isgod==TRUE) reset_god();
+ return;
+ }
+ }
+
+ /*raise an untrained army */
+ i = FALSE;
+ if( newtype==A_SPY || newtype==A_SCOUT ) {
+ men=1;
+ } else {
+ mvprintw(LINES-3,0,"how many %s do you wish to raise:",unittype[newtype]);
+ clrtoeol();
+ refresh();
+ men = get_number();
+ if(men<=0) {
+ if (isgod==TRUE) reset_god();
+ return;
+ }
+ }
+
+ /* i_people*256 is initial people -> can draft up to following */
+ /* draftable = max_draft - already drafted */
+ /* = imen/4 - ( imen - people) */
+ /* = -3/4 * imen + people) */
+ /* 192 comes from 3*256/4 */
+ if( (newtype != A_MERCENARY && (men > sct[XREAL][YREAL].people - (sct[XREAL][YREAL].i_people*192) ) )
+ ||(sct[XREAL][YREAL].i_people < 0)) {
+ if(sct[XREAL][YREAL].i_people < 0)
+ errormsg("error: sector wasn't city at beginning of turn");
+ else errormsg("error: raising too many soldiers");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ /* check that you dont have too many mercenaries */
+ mercs=0;
+ if(newtype == A_MERCENARY){
+ int totalsolds=0;
+ for(armynum=0;armynum (totalsolds+men)/2) {
+ errormsg("you would then have more than 50%% mercenaries");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if(mercgot+men > MERCMEN/NTOTAL) {
+ errormsg("there are not that many mercanaries available");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ }
+
+ e_cost= (long) *(u_encost+newtype) * men;
+ i_cost= (long) *(u_enmetal+newtype) * men;
+
+ /*magiced get 1/2 enlistment costs*/
+ if((magic(country,WARRIOR)==TRUE)
+ ||(magic(country,WARLORD)==TRUE)
+ ||(magic(country,CAPTAIN)==TRUE))
+ e_cost/=2;
+
+ if((magic(country,SAPPER)==TRUE)
+ &&((newtype==A_SIEGE)||(newtype==A_CATAPULT))){
+ e_cost/=2;
+ i_cost/=2;
+ }
+
+ /*check to see if enough gold*/
+ if(e_cost > curntn->tgold) {
+ errormsg("You don't have enough talons");
+ if(isgod==TRUE) reset_god();
+ return;
+ } else if(i_cost > curntn->metals) {
+ mvprintw(LINES-1,0,"You don't have %ld metal",i_cost);
+ mvaddstr(LINES-1,COLS-20,"PRESS ANY KEY");
+ clrtoeol();
+ refresh();
+ getch();
+ if(isgod==TRUE) reset_god();
+ return;
+ } else {
+ move(LINES-2,0);
+ clrtoeol();
+ }
+
+ /*count is order of that army in sector*/
+ /*armynum is number of that army*/
+ if((armynum=getselunit())>=0){
+ if(armynum>=MAXARM || newtype==A_SPY || newtype==A_SCOUT) {
+ army = -1;
+ } else {
+ /*if different types, must raise new army*/
+ if((newtype == P_ATYPE)&&(P_ASTAT!=ONBOARD)) {
+ mvaddstr(LINES-1,0,"Do you wish to raise a new army:");
+ clrtoeol();
+ refresh();
+ if(getch()!='y') army=armynum;
+ else army= -1;
+ }
+ else army=(-1);
+ }
+ }
+ if(army==(-1)) {
+ mvprintw(LINES-2,0,"(%s, gold talons=%ld, metal=%ld) raising a new army",*(unittype+newtype),e_cost,i_cost);
+ clrtoeol();
+ refresh();
+ sleep(1);
+
+ armynum=0;
+ while((army==(-1))&&(armynumdstatus[i]!=UNMET) {
+ P_AYLOC = ntn[i].capy;
+ P_AXLOC = ntn[i].capx;
+ mvprintw(LINES-2,0,"The Spy Starts in %s's Capitol (%d,%d)",
+ ntn[i].name,(int)P_AXLOC,(int)P_AYLOC);
+ clrtoeol();
+ } else {
+ clear_bottom(0);
+ mvprintw(LINES-4,0,"You do not yet know where %s is",ntn[i].name);
+ mvaddstr(LINES-3,0,"Have the Spy start from this sector? [y or n]");
+ refresh();
+ if(getch()!='y') {
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ P_AYLOC = YREAL;
+ P_AXLOC = XREAL;
+ mvprintw(LINES-2,0,"Intelligence indicates that %s lies to the %s",ntn[i].name,
+ *(directions+compass((int)P_AXLOC,(int)P_AYLOC,
+ (int)ntn[i].capx,(int)ntn[i].capy)));
+ clrtoeol();
+ }
+ errormsg("");
+ redraw=PART;
+ } else {
+ P_AYLOC=YREAL;
+ P_AXLOC=XREAL;
+ }
+ if( newtype == A_SPY || newtype == A_SCOUT ) {
+ P_ASTAT = SCOUT;
+ AADJSTAT;
+ }
+ P_ATYPE=newtype;
+ if(P_ATYPE != A_MERCENARY){
+ sct[XREAL][YREAL].people -= men;
+ SADJCIV;
+ } else {
+ mercgot += men;
+ AADJMERC;
+ }
+ AADJLOC;
+ P_AMOVE=0;
+ AADJMOV;
+ P_ASOLD+=men;
+ AADJMEN;
+ if(P_ASTAT>=NUMSTATUS) {
+ P_ASTAT=ATTACK;
+ AADJSTAT;
+ }
+ curntn->metals -= i_cost;
+ curntn->tgold -= e_cost;
+ makemap(); /* if display 'y' is set, this will show new army */
+ if(isgod==TRUE) reset_god();
+}
+
+/*go through msgfile not rewriting to temp messages you discard*/
+/* then move temp to msgfile*/
+void
+rmessage()
+{
+ int unlink();
+ FILE *mesgfp;
+ FILE *fptemp;
+ int i;
+ int count,msglen;
+ int contd;
+ int done=FALSE;
+ char tempfile[FILELTH];
+ char mesgfile[FILELTH];
+ char line[LINELTH+1], inpch;
+ char save[LINELTH][LINELTH+1];
+ struct stat fst;
+
+ /*open file; used in mailopen() as well */
+ sprintf(tempfile,"%s%hd.tmp",msgfile,country);
+ if( (fptemp = fopen(tempfile,"w")) == NULL ) {
+ clear_bottom(0);
+ sprintf(mesgfile,"error: %s open",tempfile);
+ errormsg(mesgfile);
+ redraw=DONE;
+ makebottom();
+ return;
+ }
+
+ sprintf(mesgfile,"%s%d",msgfile,country);
+ if ((mesgfp=fopen(mesgfile,"r"))==NULL) {
+ (void) unlink (tempfile) ;
+ clear_bottom(0);
+ errormsg("No Messages");
+ makebottom();
+ redraw=DONE;
+ return;
+ }
+
+ /* check for people sending mail */
+ sprintf(line,"send.%s%hd",msgfile,country);
+ if (stat(line,&fst)==0) {
+ long now;
+ now = time(0);
+ if (now - fst.st_mtime < TIME_DEAD) {
+ /* someone is sending mail to the country */
+ (void) unlink (tempfile) ;
+ clear_bottom(0);
+ errormsg("Someone is sending you mail... please wait.");
+ makebottom();
+ redraw=DONE;
+ return;
+ } else {
+ /* remove useless file */
+ (void) unlink(line);
+ }
+ }
+
+ /*read in file a line at at time*/
+ if(fgets(line,LINELTH,mesgfp)==NULL) {
+ done=TRUE;
+ redraw=DONE;
+ clear_bottom(0);
+ errormsg("No messages");
+ makebottom();
+ }
+ if (done==FALSE) clear();
+ while(done==FALSE) {
+ contd=FALSE;
+ msglen=0;
+ count=3;
+ clear();
+ standout();
+ /*print to end of message*/
+ while(contd==FALSE) {
+ if(msglen=NTOTAL
+ || (!isntn(ntn[temp].active) && temp!=0)) {
+ makebottom();
+ return;
+ }
+ strcpy(name,ntn[temp].name); /* find nation name */
+ }
+
+ if(mailopen( temp )==(-1)) {
+ makebottom();
+ return;
+ }
+ redraw=FULL;
+
+ if(temp != -2) {
+ if (country==0)
+ fprintf(fm,"Message to %s from GOD (%s of year %d)\n\n",name,PSEASON(TURN),YEAR(TURN));
+ else fprintf(fm,"Message to %s from %s (%s of year %d)\n\n",name,curntn->name,PSEASON(TURN),YEAR(TURN));
+ } else fprintf(fm,"5.----------\n");
+ strcpy(line,"");
+
+ while(done==FALSE) {
+ if (dotitles==TRUE) {
+ move(0,0);
+ clrtobot();
+ standout();
+ if(temp != -2)
+ mvprintw(3,(COLS-25)/2,"Message to Nation %s",name);
+ else
+ mvaddstr(3,(COLS-25)/2,"Message to All Players");
+ mvaddstr(LINES-2,(COLS-37)/2,"End with a on a New Line");
+ mvaddstr(LINES-1,(COLS-28)/2,"Hit ESC to Abort the Message");
+ standend();
+ mvaddstr(5,0,line);
+ y=6;
+ x=0;
+ refresh();
+ dotitles=FALSE;
+ }
+ linedone=FALSE;
+ ch=' ';
+ /*read line*/
+ while(linedone==FALSE){
+ /* check for delete or backspace */
+ switch(ch) {
+ case '\b':
+ case '\177':
+ /* backspace or delete */
+ if(x>1) x--;
+ mvaddch(y,x,' ');
+ move(y,x);
+ line[x]=' ';
+ refresh();
+ ch=getch();
+ break;
+ case '\n':
+ case '\r':
+ /* newline or carriage return */
+ linedone=TRUE;
+ break;
+ case '\004':
+ /* a control-d was hit */
+ if (x==1) {
+ linedone=TRUE;
+ done=TRUE;
+ } else {
+ standout();
+ mvaddstr(LINES-3,(COLS-37)/2,"Hit [RETURN] Control-D to End Message");
+ standend();
+ move(y,x);
+ refresh();
+ ch = getch();
+ move(LINES-3,0);
+ clrtoeol();
+ refresh();
+ }
+ break;
+ case '\033':
+ /* escape key was hit */
+ mvaddstr(LINES-3,0,"Abort Message? ");
+ refresh();
+ if(getch()=='y') {
+ linedone=TRUE;
+ done=TRUE;
+ temp=ABORTMAIL;
+ } else {
+ move(LINES-3,0);
+ clrtoeol();
+ move(y,x);
+ refresh();
+ ch = getch();
+ }
+ break;
+ case '':
+ /* new page -- end of form */
+ wrefresh(stdscr);
+ ch=getch();
+ break;
+ default:
+ /* any remaining possibilities */
+ if(isprint(ch)&&(x<65)){
+ /*concatonate to end*/
+ line[x]=ch;
+ mvaddch(y,x,ch);
+ x++;
+ refresh();
+ }
+ ch=getch();
+ break;
+ }
+ }
+ if((ch!='\n')&&(ch!='\r')&&(ch!='\033')) {
+ mvaddch(y,x,ch);
+ line[x]=ch;
+ x++;
+ }
+ line[x]='\0';
+
+ /*check for single period */
+ if (strcmp(line," .")==0) done=TRUE;
+
+ /*write to file*/
+ if (done==FALSE) {
+ if (temp != -2) fprintf(fm,"%s\n",line);
+ else {
+ if (country!=0) fprintf(fm,"5.%-9s:%s\n",curntn->name,line);
+ else fprintf(fm,"5.God :%s\n",line);
+ }
+ x=0;
+ y++;
+ if (y==LINES-3) {
+ standout();
+ mvaddstr(LINES-3,0,"Continuing...");
+ standend();
+ refresh();
+ sleep(2);
+ dotitles=TRUE;
+ }
+ }
+ }
+ mailclose(temp);
+}
+
+/*strategic move of civilians...once only*/
+void
+moveciv()
+{
+ long people;
+ short i,j;
+
+ clear_bottom(0);
+#ifdef OGOD
+ if(sct[XREAL][YREAL].owner!=country && country!=0)
+#else
+ if(sct[XREAL][YREAL].owner!=country)
+#endif
+ {
+ errormsg("Sorry, you don't own that sector.");
+ return;
+ }
+ else if(sct[XREAL][YREAL].people==0){
+ errormsg("Nobody lives there!!!");
+ return;
+ }
+
+ mvprintw(LINES-4,0,"Sector contains %d people [cost 50 per civilian]",sct[XREAL][YREAL].people);
+ mvaddstr(LINES-3,0,"How many people to move?");
+ clrtoeol();
+ refresh();
+ people = get_number();
+ if (people <= 0) {
+ return;
+ }
+ if (people>sct[XREAL][YREAL].people) {
+ errormsg("Sorry, not that many people live there.");
+ return;
+ }
+ if (people*50>curntn->tgold) {
+ errormsg("Sorry, you do not have enough gold talons.");
+ return;
+ }
+
+ mvprintw(LINES-4,0,"Sector location is x=%d, y=%d",XREAL,YREAL);
+ clrtoeol();
+ mvaddstr(LINES-3,0,"What X location to move to?");
+ clrtoeol();
+ refresh();
+ i = get_number();
+ if (i < 0) {
+ return;
+ }
+
+ if((i-(XREAL))>2||(i-(XREAL))<-2) {
+ errormsg("Sorry, your people refuse to move more than two sectors.");
+ return;
+ }
+
+ mvaddstr(LINES-2,0,"What Y location to move to?");
+ clrtoeol();
+ refresh();
+ j = get_number();
+ if (j < 0) {
+ return;
+ }
+ if((j-(YREAL)>2)||((YREAL)-j>2)) {
+ errormsg("Sorry, your people refuse to move more than two sectors.");
+ }
+#ifdef OGOD
+ else if(sct[i][j].owner!=country && country!=0)
+#else
+ else if(sct[i][j].owner!=country)
+#endif /*OGOD*/
+ {
+ errormsg("Sorry, you don't own that sector.");
+ } else if(movecost[i][j]<0){
+ /*need to check move cost > 0 for sector*/
+ errormsg("Sorry, your people refuse to enter that sector.");
+ } else if ((i!=XREAL)||(j!=YREAL)){
+ curntn->tgold-=50*people;
+ sct[XREAL][YREAL].people-=people;
+ SADJCIV;
+ sct[i][j].people+=people;
+ SADJCIV2;
+ }
+}
+
+int
+armygoto()
+{
+ short armynum=0,loop=0;
+ armynum=getselunit();
+ if((armynum<0)||(armynum>MAXARM)) armynum=0;
+ else armynum++;
+ /* move to next army with > 0 soldiers or army not in group */
+ while((armynum < MAXARM) && ((P_ASOLD <= 0) || (P_ASTAT>=NUMSTATUS)))
+ armynum++;
+ if(armynum >= MAXARM) {
+ armynum=0;
+ if(P_ASOLD <= 0) return(0);
+ }
+ /*move to correct location*/
+ xcurs = (int)P_AXLOC - xoffset;
+ ycurs = (int)P_AYLOC - yoffset;
+ coffmap();
+
+ /*select correct unit*/
+ selector=0;
+ pager=0;
+ while((getselunit() != armynum) && (loop++ < 500)) {
+ selector+=2;
+ if(selector>=10) {
+ selector=0;
+ pager+=1;
+ }
+ }
+ return(1);
+}
+
+int
+navygoto()
+{
+ short nvynum=0,loop=0;
+ nvynum=getselunit()-MAXARM;
+ if((nvynum<0)||(nvynum>MAXNAVY)) nvynum=0;
+ else nvynum++;
+ /* move to next nvy with > 0 soldiers*/
+ while ((nvynum < MAXNAVY) && (P_NMSHP==0) && (P_NWSHP==0)
+ && (P_NGSHP == 0)) nvynum++;
+ if(nvynum >= MAXNAVY) {
+ nvynum=0;
+ if((P_NMSHP==0)&&(P_NWSHP==0)&&(P_NGSHP == 0)) return(0);
+ }
+ /*move to correct location*/
+ xcurs = P_NXLOC - xoffset;
+ ycurs = P_NYLOC - yoffset;
+ coffmap();
+
+ /*select correct unit*/
+ selector=0;
+ pager=0;
+ while(((getselunit()-MAXARM) != nvynum) && (loop++ < 500)) {
+ selector+=2;
+ if(selector>=10) {
+ selector=0;
+ pager+=1;
+ }
+ }
+ return(1);
+}
diff --git a/original/data.c b/original/data.c
new file mode 100644
index 0000000..e627a36
--- /dev/null
+++ b/original/data.c
@@ -0,0 +1,286 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+/* ele is display characters */
+char *ele= "~#^%-0";
+
+/* Movement costs for varying types of terain by race - '/'=error */
+char *HElecost= "//521/";
+char *OElecost= "//222/";
+char *EElecost= "//631/";
+char *DElecost= "//311/";
+char *FElecost= "16211/"; /* flight costs */
+
+/* BELOW ARE MOVEMENT COSTS FOR VEG */
+char *veg= "vdtblgwfjsi~0";
+char *HVegcost= "63210001332//"; /* Human */
+char *OVegcost= "43100022527//"; /* Orcs */
+char *EVegcost= "86221000027//"; /* Elves */
+char *DVegcost= "47100013577//"; /* Dwarves */
+char *FVegcost= "410000001000/"; /* Flight */
+char *vegfood= "0004697400000"; /* food value given veg */
+
+char *des= "tcmfx$!&sC?lb+*g=u-P0";
+#ifdef CONQUER
+char *elename[]= { "WATER","PEAK", "MOUNTAIN", "HILL", "FLAT","ERROR"};
+char *vegname[]= { "VOLCANO", "DESERT", "TUNDRA", "BARREN", "LT VEG",
+"GOOD", "WOOD", "FOREST", "JUNGLE", "SWAMP", "ICE", "NONE"};
+char *desname[]= {"TOWN", "CITY", "MINE", "FARM", "DEVASTATED", "GOLDMINE",
+"FORT","RUIN","STOCKADE","CAPITOL","SPECIAL","LUMBERYD","BLKSMITH","ROAD",
+"MILL","GRANARY","CHURCH","UNIVERSITY","NODESIG","BASE CAMP","ERROR"};
+char *races[]= { "GOD","ORC","ELF","DWARF","LIZARD",
+"HUMAN","PIRATE","SAVAGE","NOMAD","UNKNOWN"};
+char *diploname[]= { "UNMET", "TREATY", "ALLIED", "FRIENDLY",
+"NEUTRAL", "HOSTILE", "WAR", "JIHAD"};
+char *soldname[]= { "?","MARCH","SCOUT","GARRISON","TRADED","MILITIA",
+ "FLYING","DEFEND","MAG_DEF","ATTACK","MAG_ATT","GENERAL","SORTIE",
+ "SIEGE","BESIEGED","ON_BOARD","RULE"};
+#endif /* CONQUER */
+
+char *directions[]= { "here", "north", "northeast", "east", "southeast",
+ "south", "southwest", "west", "northwest"};
+char *Class[]= { "monster", "king", "emperor", "wizard", "priest", "pirate",
+"trader", "warlord", "demon", "dragon", "shadow"};
+char *alignment[]= { "Other","Good","Neutral","Evil","Other" };
+
+char *unittype[]= {
+"Militia", "Goblins", "Orcs", "Infantry", "Sailors", "Marines", "Archers",
+"Uruk-Hai", "Ninjas", "Phalanx", "Olog-Hai", "Legionaries", "Dragoons", "Mercenaries",
+"Trolls", "Elite", "Lt_Cavalry", "Hv_Cavalry", "Catapults", "Siege", "Rocs",
+"Knights", "Gryfins","Elephants","Zombies","Spy","Scout",
+"King","Baron","Emperor","Prince","Wizard","Mage",
+"Pope","Bishop","Admiral","Captain","Warlord","Lord",
+"Demon","Devil","Dragyn","Wyrm","Shadow","Nazgul",
+"Spirit", "Assasin", "Efreet", "Gargoyl", "Wraith",
+"Hero", "Centaur", "Giant", "Suphero", "Mummy",
+"Elmentl", "Mintaur", "Daemon", "Balrog", "Dragon"
+};
+
+#ifdef CONQUER
+/*short unit types...for printing in upper right corner*/
+char *shunittype[]= {
+"mlta", "Gob", "Orc", "Inf", "Sail", "XMar", "Arch",
+"Uruk", "Ninj", "Phax", "olog", "Legn", "Drag", "Merc",
+"Trol", "Elt", "lCav", "hCav", "cat", "sge", "Roc",
+"Kni", "grif","ele","zom","Spy","Scout",
+"King","Bar","Emp","Prin","Wizd","Magi",
+"Apos","Bish","Admi","Capt","Warl","Lord",
+"Demn","Devl","Drag","Wyrm","Shad","Nazg",
+"spir", "Assn", "efr", "Garg", "Wra",
+"Hero", "Cent", "gt", "Shro", "Mumm",
+"Elem", "mino", "daem", "Bal", "Drgn"
+};
+#endif /* CONQUER */
+int unitminsth[]= /* min strength of a unit */
+{
+1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1, 1,
+1, 1, 1, 1, 1, 1,
+100,50,100,50,250,50,
+100,50,100,50,250,125,
+250,50,500,100,250,125,
+50, 50, 50, 75, 75,
+75, 50, 150, 150, 150,
+175, 150, 500, 500, 1000
+};
+
+int unitattack[]=
+{ -40, -15, 0, 0, 0, 5, 0,
+5, 20, 10, 15, 20, 10, 0,
+25, 20, 20, 30, -20, -20, 20,
+40, 40, 50, -15, -30, -30,
+30,20,30,20,30,20,
+30,20,30,20,30,30,
+50,20,50,40,50,40,
+0, 20, 10, 10, 10,
+0, 10, 0, 15, 15,
+5, 20, 50, 40, 50
+};
+int unitdefend[]=
+{
+-25, -15, 0, 0, 0, 0, 10,
+5, 0, 10, 15, 20, 10, 0,
+15, 20, 20, 30, 20, 20, 30,
+40, 50, 50, -15, -30, -30,
+30,20,30,20,30,20,
+30,20,30,20,30,30,
+50,20,50,40,50,40,
+0, 20, 10, 10, 10,
+0, 10, 0, 15, 15,
+5, 20, 50, 40, 50
+};
+/*ten times the move rate of a unit*/
+int unitmove[]=
+{
+ 0, 10, 10, 10, 0, 0, 10,
+10, 10, 10, 10, 10, 20, 10,
+10, 13, 20, 20, 5, 5, 10,
+20, 15, 5, 10, 10, 20,
+20,20,20,20,20,20,
+20,20,20,20,20,20,
+20,20,20,20,20,20,
+10, 10, 15, 10, 10,
+10, 15, 10, 10, 10,
+15, 10, 10, 15, 20
+};
+/*metal cost of a unit*/
+int u_enmetal[]=
+{
+ 0, 80, 80, 100, 100, 100, 100,
+150, 150, 150, 150, 150, 100, 0,
+200, 200, 100, 300,1000,1000, 300,
+600, 400, 600, 100, 0, 0,
+0,0,0,0,0,0,
+0,0,0,0,0,0,
+0,0,0,0,0,0,
+0, 0, 0, 0, 0,
+0, 0, 0, 0, 0,
+0, 0, 0, 0, 0
+};
+/*enlist cost for a unit*/
+int u_encost[]=
+{
+ 50, 70, 85, 100, 100, 100, 100, /* gold cost for enlistment */
+ 125, 125, 150, 180, 180, 300, 225,
+ 225, 225, 300, 450, 600, 600, 600,
+ 600, 800, 600, 100, 10000, 100,
+0,0,0,0,0,0,
+0,0,0,0,0,0,
+0,0,0,0,0,0,
+2, 2, 2, 2, 2, /* spell points for enlistment */
+2, 2, 5, 5, 5,
+5, 5,10,10,15
+};
+/*maintenance cost for a unit*/
+int unitmaint[]= {
+ 20, 20, 50, 50, 50, 50, 50,
+ 50, 50, 50, 75, 75, 200, 100,
+100, 100, 175, 225, 250, 250, 250,
+250, 250, 250, 0, 2000, 100,
+0,0,0,0,0,0, /* GOLD COST PER EQUIVALENT MAN FOR MONSTERS */
+0,0,0,0,0,0,
+0,0,0,0,0,0,
+1000, 400, 400, 450, 450, /* JEWELS / TURN COST FOR ENTIRE UNIT */
+200, 200, 2100, 450, 1000, /* MULTIPLY BY 5 FOR GOLD COST FOR UNIT */
+1900, 2100, 6000, 6000, 10000
+};
+
+char *exefile = "exec";
+char *datafile = "data";
+char *msgfile = "mesg";
+char *timefile = "timelog";
+char *sortname = "conqsort";
+
+#ifdef ADMIN
+char scenario[NAMELTH+1];
+char *npcsfile = "nations";
+#endif /* ADMIN */
+char *helpfile = "help";
+char *newsfile = "news";
+char *isonfile = "lock";
+#ifdef TRADE
+char *tradefile = "commerce";
+#endif /* TRADE */
+
+char *seasonstr[] = { "Winter", "Spring", "Summer", "Fall" };
+
+char *pwrname[] = {
+"WARRIOR", "CAPTAIN", "WARLORD", "ARCHER", "CAVALRY", "SAPPER",
+"ARMOR", "AVIAN", "MI_MONST", "AV_MONST", "MA_MONST",
+
+"SLAVER", "DERVISH", "HIDDEN", "ARCHITECT", "RELIGION", "MINER",
+"BREEDER", "URBAN", "STEEL", "NINJA", "SAILOR", "DEMOCRACY", "ROADS",
+
+"THE_VOID", "KNOWALL", "DESTROYER", "VAMPIRE",
+"SUMMON", "WYZARD", "SORCERER", "ERROR"
+};
+
+long powers[] = {
+ WARRIOR, /*MILITARY POWERS => START=0*/
+ CAPTAIN, /*1*/
+ WARLORD, /*2*/
+ ARCHER, /*3*/
+ CAVALRY, /*4*/
+ SAPPER, /*5*/
+ ARMOR, /*6*/
+ AVIAN, /*7*/
+ MI_MONST, /*8*/
+ AV_MONST, /*9*/
+ MA_MONST, /*10th power; Mil power #11*/
+ SLAVER, /*CIVILIAN POWERS => START=11*/
+ DERVISH, /*12*/
+ HIDDEN, /*13*/
+ ARCHITECT, /*14*/
+ RELIGION, /*15*/
+ MINER, /*16*/
+ BREEDER, /*17*/
+ URBAN, /*18*/
+ STEEL, /*19*/
+ NINJA, /*20*/
+ SAILOR, /*21*/
+ DEMOCRACY, /*22*/
+ ROADS, /* 13th CIVILIAN POWER (23rd total) */
+ THE_VOID, /* MAGICAL SKILLS => START=24 */
+ KNOWALL, /*25*/
+ DESTROYER, /*26*/
+ VAMPIRE, /*27*/
+ SUMMON, /*28*/
+ WYZARD, /*29*/
+ SORCERER, /*30th Entry => 31 total powers => End=7*/
+ 0
+};
+
+FILE *fnews, *fopen();
+struct sprd_sht spread;
+
+FILE *fm;
+int mailok=DONEMAIL;
+
+#ifdef CONQUER
+#ifdef SYSMAIL
+char sysmail[FILELTH];
+int sys_mail_status;
+#endif /* SYSMAIL */
+char conqmail[FILELTH];
+int conq_mail_status;
+#endif /* CONQUER */
+
+/* trade good value - zeroes in this comment line mark increments of ten*/
+/* 0 0 0 0 0 0 */
+/* a value of x means any designation is possible */
+/* fwbcwmhpgcfshfrwdpbcpstgponpmldpllpiopshmtpbcltismasspdsgridp*/
+char *tg_stype="xffffttttffffffffffftxlxllttuuctcccfff?xtccmmmmmmmm$$$$$$$$$$0";
+char *tg_value="13335157911433442331131135734567789123937571111111111111111110";
+
+char *tg_name[] = {
+"furs", "wool", "beer", "cloth", "wine",
+"mules", "horses", "pigeons", "griffons",
+"corn", "fish", "sugar", "honey", "fruit",
+"rice", "wheat", "dairy", "peas", "bread", "cereal",
+"pottery", "salt", "timber", "granite", "pine", "oak", "nails",
+"papyrus","math","library","drama","paper","literature","law","philosophy",
+"irrigation", "oxen", "plows",
+"stones",
+"herbs", "medicine",
+"torture", "prison",
+"bronze", "copper", "lead", "tin", "iron","steel", "mithral", "adamantine",
+"spice","silver","pearls","dye","silk","gold","rubys","ivory","diamonds","platinum",
+"none"
+};
diff --git a/original/data.h b/original/data.h
new file mode 100644
index 0000000..88fecba
--- /dev/null
+++ b/original/data.h
@@ -0,0 +1,1013 @@
+/* conquer : Copyright (c) 1988 by Ed Barlow. */
+
+/*--------I DO NOT BELIEVE IT IS NECESSARY TO ALTER THIS FILE----------------*/
+#define FAIL 1 /* fail return to shell */
+#define SUCCESS 0 /* successful return to shell */
+#define TIME_DEAD 3600 /* number of seconds for file aging */
+#define BIG 500000000L /* BIGGER THAN ANYTHING SHOULD BE */
+ /* this is used to protect against overflow */
+#define SCRARM ((LINES-14)/2) /* number of armies to fit on screen */
+
+/* sometimes curses.h defines TRUE */
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+
+/* definitions for mail sending */
+#define DONEMAIL (-3)
+#define NEWSMAIL (-2)
+#define ABORTMAIL (-1)
+
+/* definitions for screen redrawing */
+#define DONE 0
+#define PART 1
+#define FULL 2
+
+#define SCREEN_X_SIZE (( COLS - 21) / 2) /* divide by two as only 1/2
+ sectors will be shown */
+#define SCREEN_Y_SIZE ( LINES - 5 )
+#define HAS_SEEN(x,y) hasseen[(x)+((y)*((COLS-10)/2))]
+#define PASSLTH 7 /* the number of characters in the passwd*/
+#define NAMELTH 9 /* the number of characters in the name*/
+#define LEADERLTH 9 /* the number of characters in the leader*/
+#define FILELTH 80 /*length for filename holders*/
+#define LINELTH 80 /*length for input string lines*/
+#define BIGLTH 256 /*length for large storage strings*/
+#define NUMCLASS 11 /*number of nation classes */
+
+/* environment variable strings to check */
+#define ENVIRON_OPTS "CONQ_OPTS"
+
+/*simple contour map definitions*/
+#define WATER (*(ele+0))
+#define PEAK (*(ele+1))
+#define MOUNTAIN (*(ele+2))
+#define HILL (*(ele+3))
+#define CLEAR (*(ele+4))
+
+/*racial types*/
+#define GOD '-'
+#define ORC 'O'
+#define ELF 'E'
+#define DWARF 'D'
+#define LIZARD 'L'
+#define HUMAN 'H'
+#define PIRATE 'P'
+#define SAVAGE 'S'
+#define NOMAD 'N'
+#define TUNKNOWN '?'
+
+/*designations*/
+#define DTOWN (*(des+0))
+#define DCITY (*(des+1))
+#define DMINE (*(des+2))
+#define DFARM (*(des+3))
+#define DDEVASTATED (*(des+4))
+#define DGOLDMINE (*(des+5))
+#define DFORT (*(des+6))
+#define DRUIN (*(des+7))
+#define DSTOCKADE (*(des+8))
+#define DCAPITOL (*(des+9))
+#define DSPECIAL (*(des+10))
+#define DLUMBERYD (*(des+11))
+#define DBLKSMITH (*(des+12))
+#define DROAD (*(des+13))
+#define DMILL (*(des+14))
+#define DGRANARY (*(des+15))
+#define DCHURCH (*(des+16))
+#define DUNIVERSITY (*(des+17))
+#define DNODESIG (*(des+18))
+#define DBASECAMP (*(des+19))
+
+/* nation placement variables */
+#define GREAT 'G'
+#define FAIR 'F'
+#define RANDOM 'R'
+#define OOPS 'X'
+
+/*vegetation types -- these are legal in designations too*/
+#define VOLCANO (*(veg+0))
+#define DESERT (*(veg+1))
+#define TUNDRA (*(veg+2))
+#define BARREN (*(veg+3))
+#define LT_VEG (*(veg+4))
+#define GOOD (*(veg+5))
+#define WOOD (*(veg+6))
+#define FOREST (*(veg+7))
+#define JUNGLE (*(veg+8))
+#define SWAMP (*(veg+9))
+#define ICE (*(veg+10))
+#define NONE (*(veg+11))
+
+/*Diplomacy Variables*/
+#define JIHAD 7
+#define WAR 6
+#define HOSTILE 5
+#define NEUTRAL 4
+#define FRIENDLY 3
+#define ALLIED 2
+#define TREATY 1
+#define UNMET 0
+
+#define BREAKJIHAD 200000L /* $ cost to break confederacy or jihad */
+
+/*army status*/
+#define MARCH 1 /*March */
+#define SCOUT 2 /*Scouting--will not engage enemy if possible*/
+#define GARRISON 3 /*Garrison--for a town or Capitol */
+#define TRADED 4 /*Indicates an army that has been traded*/
+#define MILITIA 5 /*Unit is a militia unit */
+#define FLIGHT 6 /*Indicates army is flying*/
+#define DEFEND 7 /*Defend */
+#define MAGDEF 8 /*Magically enhanced defend mode*/
+#define ATTACK 9 /*Attack anybody (Hostile+) within 2 sectors*/
+#define MAGATT 10 /*Magically enhanced attack mode*/
+#define GENERAL 11 /* group leader !!! */
+#define SORTIE 12 /*Quick attack from a city */
+#define SIEGE 13 /*Set siege on a city */
+#define SIEGED 14 /*Unit under siege */
+#define ONBOARD 15 /*On board a fleet */
+#define RULE 16 /*Nation leader status for capitol */
+#define NUMSTATUS 17 /* number of possible stats */
+ /* Army groups are implemented in the army
+ status vbl. if >= NUMSTATUS, you belong to
+ army group x-NUMSTATUS - army groups always
+ of status attack and may not be magicked */
+
+/*seasonal definitions */
+#define TURN world.turn /* game turn */
+#define SEASON(x) ((x)%4)
+#define PSEASON(x) seasonstr[((x)%4)]
+#define YEAR(x) ((int)((x+3)/4))
+#define WINTER 0
+#define SPRING 1
+#define SUMMER 2
+#define FALL 3
+
+/* definitions for compass directions */
+#define CENTERED 0
+#define NORTH 1
+#define NORTHEAST 2
+#define EAST 3
+#define SOUTHEAST 4
+#define SOUTH 5
+#define SOUTHWEST 6
+#define WEST 7
+#define NORTHWEST 8
+
+struct s_world
+{
+ short mapx,mapy; /* size of world */
+ short nations; /* number of actual nations */
+ short othrntns; /* god, lizard... */
+ short turn; /* game turn */
+ long m_mil; /* number of mercs available */
+ short m_aplus; /* mercenary attack bonus */
+ short m_dplus; /* mercenary defense bonus */
+ long w_jewels; /* jewels in world */
+ long w_gold; /* gold talons in world */
+ long w_food; /* food in world */
+ long w_metal; /* metal in world */
+ long w_civ; /* world population */
+ long w_mil; /* world military */
+ long w_sctrs; /* owned sectors in world */
+ long score; /* world score total */
+};
+
+#define MAPX world.mapx
+#define MAPY world.mapy
+#define MERCMEN world.m_mil
+#define MERCATT world.m_aplus
+#define MERCDEF world.m_dplus
+#define WORLDJEWELS world.w_jewels
+#define WORLDGOLD world.w_gold
+#define WORLDMETAL world.w_metal
+#define WORLDFOOD world.w_food
+#define WORLDSCORE world.score
+#define WORLDCIV world.w_civ
+#define WORLDSCT world.w_sctrs
+#define WORLDMIL world.w_mil
+#define WORLDNTN world.nations
+
+struct s_sector
+{
+ unsigned char designation; /* designation of sector */
+ unsigned char altitude; /* sector altitude */
+ unsigned char vegetation; /* sector vegetation */
+ unsigned char owner; /* nation id of owner */
+ long people; /* civilians in sector */
+ short i_people; /* initial civilians in sector */
+ unsigned char jewels; /* jewel production ability */
+ unsigned char fortress; /* fortification level; 0 to 12 */
+ unsigned char metal; /* metal produced by sector */
+ unsigned char tradegood; /* exotic trade goods in sector */
+ /* unsigned char region; /* index of region */
+};
+#define SOWN sct[xcurs+xoffset][ycurs+yoffset].owner
+#define XREAL (xcurs+xoffset)
+#define YREAL (ycurs+yoffset)
+
+struct navy
+{
+ unsigned short warships;
+ unsigned short merchant;
+ unsigned short galleys;
+ unsigned char xloc;
+ unsigned char yloc;
+ unsigned char smove; /* movement ability of ship */
+ unsigned char crew; /* crew on ship */
+ unsigned char people; /* people carried */
+ unsigned char commodity; /* future commodities */
+ unsigned char armynum; /* army carried */
+};
+
+
+/* NATION STRATEGY: a nation's strategy is a part of the ntn[].active
+ * variable which tells if it is a PC or NPC, its alignment, and its
+ * constraints alignments can be good, neutral, or evil.
+ * NPC Nations can be Expansionsist (with 0,2,4,6 sectors to expand into)
+ * or Isolationist. */
+#define INACTIVE 0
+#define PC_GOOD 1 /* PC NATIONS */
+#define PC_NEUTRAL 2
+#define PC_EVIL 3
+#define GOOD_0FREE 4 /* NPC NATIONS */
+#define GOOD_2FREE 5
+#define GOOD_4FREE 6
+#define GOOD_6FREE 7
+#define NEUTRAL_0FREE 8
+#define NEUTRAL_2FREE 9
+#define NEUTRAL_4FREE 10
+#define NEUTRAL_6FREE 11
+#define EVIL_0FREE 12
+#define EVIL_2FREE 13
+#define EVIL_4FREE 14
+#define EVIL_6FREE 15
+#define ISOLATIONIST 16 /* ISOLATIONIST NATIONS */
+#define NPC_PEASANT 17 /* PEASANT REVOLT TYPE NATIONS */
+#define NPC_PIRATE 18
+#define NPC_LIZARD 19
+#define NPC_NOMAD 20
+#define NPC_SAVAGE 21
+
+#define ispc(x) (((x)==PC_GOOD)||((x)==PC_EVIL)||((x)==PC_NEUTRAL))
+#define npctype(x) (ispc(x) ? (x) : (ismonst(x)?0:(x)/4))
+#define isgood(x) (npctype(x) == 1)
+#define isneutral(x) (npctype(x) == 2)
+#define isevil(x) (npctype(x) == 3)
+#define isnpc(x) (((x)>=GOOD_0FREE)&&((x)<=ISOLATIONIST))
+#define isnotpc(x) (((x)>=GOOD_0FREE)&&((x)!=INACTIVE))
+#define ismonst(x) ((x)>=NPC_PEASANT)
+#define ispeasant(x) ((x)==NPC_PEASANT)
+#define isntn(x) (((x)!=INACTIVE)&&((x)<=ISOLATIONIST))
+#define isntnorp(x) (((x)!=INACTIVE)&&((x)<=NPC_PEASANT))
+#define isactive(x) ((x)!=INACTIVE)
+
+/* definitions for mail checker */
+#define NO_MAIL 0
+#define NEW_MAIL 1
+
+/* definitions for naval types */
+#define N_LIGHT 0
+#define N_MEDIUM 1
+#define N_HEAVY 2
+#define N_BITSIZE 5
+#define N_MASK ((unsigned short) 0x001f)
+
+/* definitions for naval calculations */
+#define N_WSPD 20 /* speed of warships */
+#define N_GSPD 18 /* speed of galleys */
+#define N_MSPD 15 /* speed of merchants */
+#define N_NOSPD 0 /* no ships no speed */
+#define N_SIZESPD 3 /* bonus speed for lighter ships */
+
+#define UTYPE 75
+#define TWOUTYPE 150 /* two times value of UTYPE above */
+
+#define A_MILITIA 0
+#define A_GOBLIN 1
+#define A_ORC 2
+#define A_INFANTRY 3
+#define A_SAILOR 4
+#define A_MARINES 5
+#define A_ARCHER 6
+#define A_URUK 7
+#define A_NINJA 8
+#define A_PHALANX 9
+#define A_OLOG 10
+#define A_LEGION 11
+#define A_DRAGOON 12
+#define A_MERCENARY 13
+#define A_TROLL 14
+#define A_ELITE 15
+#define A_LT_CAV 16
+#define A_CAVALRY 17
+#define A_CATAPULT 18
+#define A_SIEGE 19
+#define A_ROC 20
+#define A_KNIGHT 21
+#define A_GRIFFON 22
+#define A_ELEPHANT 23
+#define A_ZOMBIE 24
+#define A_SPY 25
+#define A_SCOUT 26
+#define NOUNITTYPES 26 /*number of unit types*/
+
+#define MINLEADER (27+UTYPE) /* min value of a leader -1*/
+#define L_KING (27+UTYPE)
+#define L_BARON (28+UTYPE)
+#define L_EMPEROR (29+UTYPE)
+#define L_PRINCE (30+UTYPE)
+#define L_WIZARD (31+UTYPE)
+#define L_MAGI (32+UTYPE)
+#define L_APOSTLE (33+UTYPE)
+#define L_BISHOP (34+UTYPE)
+#define L_ADMIRAL (35+UTYPE)
+#define L_CAPTAIN (36+UTYPE)
+#define L_WARLORD (37+UTYPE)
+#define L_LORD (38+UTYPE)
+#define L_DEMON (39+UTYPE)
+#define L_DEVIL (40+UTYPE)
+#define L_DRAGON (41+UTYPE)
+#define L_WYRM (42+UTYPE)
+#define L_SHADOW (43+UTYPE)
+#define L_NAZGUL (44+UTYPE)
+
+#define MINMONSTER (45+TWOUTYPE) /* min value of a monster */
+#define SPIRIT (45+TWOUTYPE)
+#define ASSASSIN (46+TWOUTYPE)
+#define DJINNI (47+TWOUTYPE)
+#define GARGOYLE (48+TWOUTYPE)
+#define WRAITH (49+TWOUTYPE)
+#define HERO (50+TWOUTYPE)
+#define CENTAUR (51+TWOUTYPE)
+#define GIANT (52+TWOUTYPE)
+#define SUPERHERO (53+TWOUTYPE)
+#define MUMMY (54+TWOUTYPE)
+#define ELEMENTAL (55+TWOUTYPE)
+#define MINOTAUR (56+TWOUTYPE)
+#define DEMON (57+TWOUTYPE)
+#define BALROG (58+TWOUTYPE)
+#define DRAGON (59+TWOUTYPE)
+#define MAXMONSTER (59+TWOUTYPE)
+
+struct army
+{
+ unsigned char unittyp;
+ unsigned char xloc;
+ unsigned char yloc;
+ unsigned char smove;
+ long sold;
+ unsigned char stat;
+};
+
+struct s_nation /* player nation stats */
+{
+ char name[NAMELTH+1]; /* name */
+ char passwd[PASSLTH+1]; /* password */
+ char leader[LEADERLTH+1]; /* leader title */
+ char race; /* national race (integer--see header.h)*/
+ char location; /* location variable (gfr) */
+ char mark; /* unique mark for nation */
+#ifdef CHECKUSER
+ short int uid; /* for uid checking (CHECKUSER) */
+#endif /* CHECKUSER */
+ unsigned char capx; /* Capitol x coordinate */
+ unsigned char capy; /* Capitol y coordinate */
+ unsigned char active; /* nation type and strategy */
+ unsigned char maxmove;/* maximum movement of soldiers */
+ char repro; /* reproduction rate of nation */
+ long score; /* score */
+ long tgold; /* gold in treasury */
+ long jewels; /* raw amount of jewels in treasury */
+ long tmil; /* total military */
+ long tciv; /* total civilians */
+ long metals; /* total real metal in nation */
+ long tfood; /* total food in nation */
+ long powers;
+ short class; /* national class */
+ short aplus; /* attack plus of all soldiers */
+ short dplus; /* attack plus of all soldiers */
+ short spellpts; /* spell points */
+ short tsctrs; /* total number sectors */
+ short tships; /* number warships */
+ short inflation; /* inflation rate */
+ unsigned char charity; /* charity budget (% of Taxes) */
+ struct army arm[MAXARM];
+ struct navy nvy[MAXNAVY];
+ char dstatus[NTOTAL]; /* diplomatic status */
+ unsigned char tax_rate; /* taxrate populace */
+ unsigned char prestige; /* nations prestige */
+ unsigned char popularity; /* governments popularity */
+ unsigned char power; /* nation power */
+ unsigned char communications; /* leader communication */
+ unsigned char wealth; /* per capita income */
+ unsigned char eatrate; /* food eaten / 10 people*/
+ unsigned char spoilrate; /* food spoilage rate */
+ unsigned char knowledge; /* general knowledge */
+ unsigned char farm_ability; /* farming ability */
+ unsigned char mine_ability; /* mine ability */
+ unsigned char poverty; /* % poor people */
+ unsigned char terror; /* peoples terror of you*/
+ unsigned char reputation; /* reputation of nation */
+};
+#define P_NTNCOM ((((float) curntn->communications)/ 50.0 ))
+#define P_EATRATE ((((float) curntn->eatrate) / 25.0 ))
+#define P_REPRORATE ( ((float) (100.0 + 25.0*curntn->repro )/100.0))
+
+#define P_ATYPE curntn->arm[armynum].unittyp
+#define P_AXLOC curntn->arm[armynum].xloc
+#define P_AYLOC curntn->arm[armynum].yloc
+#define P_AMOVE curntn->arm[armynum].smove
+#define P_ASOLD curntn->arm[armynum].sold
+#define P_ASTAT curntn->arm[armynum].stat
+#define P_NWSHP curntn->nvy[nvynum].warships
+#define P_NMSHP curntn->nvy[nvynum].merchant
+#define P_NGSHP curntn->nvy[nvynum].galleys
+#define P_NCREW curntn->nvy[nvynum].crew
+#define P_NARMY curntn->nvy[nvynum].armynum
+#define P_NPEOP curntn->nvy[nvynum].people
+#define P_NXLOC curntn->nvy[nvynum].xloc
+#define P_NYLOC curntn->nvy[nvynum].yloc
+#define P_NMOVE curntn->nvy[nvynum].smove
+
+/* naval routine macros */
+#define SHIPS(x,y) (short)( ((x)&(N_MASK<<((y)*N_BITSIZE))) >> ((y)*N_BITSIZE) )
+#define P_NWAR(x) SHIPS(P_NWSHP,x)
+#define P_NMER(x) SHIPS(P_NMSHP,x)
+#define P_NGAL(x) SHIPS(P_NGSHP,x)
+#define NADD_WAR(x) addwships(nvynum,shipsize,(x));
+#define NADD_MER(x) addmships(nvynum,shipsize,(x));
+#define NADD_GAL(x) addgships(nvynum,shipsize,(x));
+#define NSUB_WAR(x) subwships(nvynum,shipsize,(x));
+#define NSUB_MER(x) submships(nvynum,shipsize,(x));
+#define NSUB_GAL(x) subgships(nvynum,shipsize,(x));
+
+#define ATYPE ntn[country].arm[armynum].unittyp
+#define AXLOC ntn[country].arm[armynum].xloc
+#define AYLOC ntn[country].arm[armynum].yloc
+#define AMOVE ntn[country].arm[armynum].smove
+#define ASOLD ntn[country].arm[armynum].sold
+#define ASTAT ntn[country].arm[armynum].stat
+#define NWSHP ntn[country].nvy[nvynum].warships
+#define NMSHP ntn[country].nvy[nvynum].merchant
+#define NGSHP ntn[country].nvy[nvynum].galleys
+#define NCREW ntn[country].nvy[nvynum].crew
+#define NARMY ntn[country].nvy[nvynum].armynum
+#define NPEOP ntn[country].nvy[nvynum].people
+#define NXLOC ntn[country].nvy[nvynum].xloc
+#define NYLOC ntn[country].nvy[nvynum].yloc
+#define NMOVE ntn[country].nvy[nvynum].smove
+
+/* these defines are for types of magic powers */
+#define M_MIL 1 /* military */
+#define M_CIV 2 /* civilian */
+#define M_MGK 3 /* magical */
+#define M_TECH 4 /* technological */
+#define M_ALL 5
+
+#define AORN 0
+#define ARMY 1
+#define NAVY 2
+
+#define XASTAT 1
+#define XAMEN 2
+#define XBRIBE 3
+#define XALOC 4
+#define XNLOC 5
+#define XNAMER 6
+#define XNACREW 7
+#define XECNAME 8
+#define XECPAS 9
+#define EDSPL 10
+#define XSADES 11
+#define XSACIV 12
+#define XSIFORT 13
+#define XNAGOLD 14
+#define XAMOV 15
+#define XNMOV 16
+#define XSAOWN 17
+#define EDADJ 18
+#define XNARGOLD 19
+#define XNAMETAL 20
+#define INCAPLUS 22
+#define INCDPLUS 23
+#define CHG_MGK 24
+#define DESTRY 25
+#define MSETA 26
+#define MSETB 27
+#define NTAX 28
+#define XNAWAR 29
+#define XNAGAL 30
+#define XNAHOLD 31
+#define NPOP 32
+#define XSACIV3 33
+
+#define BRIBENATION fprintf(fm,"L_NGOLD\t%d\t%d\t%ld\t0\t%d\t%s\n",XBRIBE,country,bribecost,nation,"null");
+#define DESTROY fprintf(fexe,"DESTROY\t%d\t%d\t%hd\t0\t0\t%s\n",DESTRY,save,country,"null")
+#define CHGMGK fprintf(fexe,"L_MAGIC\t%d\t%hd\t%ld\t%ld\t0\t%s\n",CHG_MGK,country,ntn[country].powers,x,"null")
+#define I_APLUS fprintf(fexe,"INC_APLUS\t%d\t%hd\t0\t0\t0\t%s\n",INCAPLUS,country,"null")
+#define I_DPLUS fprintf(fexe,"INC_DPLUS\t%d\t%hd\t0\t0\t0\t%s\n",INCDPLUS,country,"null")
+#define AADJMERC fprintf(fexe,"A_MERC\t%d\t%d\t%ld\t0\t0\t%s\n",MSETA,country,men,"null")
+#define AADJDISB fprintf(fexe,"A_MERC\t%d\t%d\t%ld\t%d\t%d\t%s\n",MSETB,country,bemerc,attset,defset,"null")
+#define AADJSTAT fprintf(fexe,"A_STAT\t%d\t%hd\t%d\t%d\t0\t%s\n",XASTAT,country,armynum,ntn[country].arm[armynum].stat,"null")
+#define AADJMEN fprintf(fexe,"L_ADJMEN\t%d\t%hd\t%hd\t%ld\t%d\t%s\n",XAMEN,country,armynum,P_ASOLD,P_ATYPE,"null")
+#define NADJCRW fprintf(fexe,"N_ASHP\t%d\t%hd\t%hd\t%d\t%d\t%s\n",XNACREW,country,nvynum,NCREW,ntn[country].nvy[nvynum].armynum,"null")
+#define NADJMER fprintf(fexe,"N_ASHP\t%d\t%hd\t%d\t%hd\t%d\t%s\n",XNAMER,country,nvynum,ntn[country].nvy[nvynum].merchant,0,"null")
+#define NADJWAR fprintf(fexe,"N_ASHP\t%d\t%hd\t%d\t%hd\t%d\t%s\n",XNAWAR,country,nvynum,ntn[country].nvy[nvynum].warships,0,"null")
+#define NADJGAL fprintf(fexe,"N_ASHP\t%d\t%hd\t%d\t%hd\t%d\t%s\n",XNAGAL,country,nvynum,ntn[country].nvy[nvynum].galleys,0,"null")
+#define NADJHLD fprintf(fexe,"N_ASHP\t%d\t%hd\t%d\t%hd\t%d\t%s\n",XNAHOLD,country,nvynum,ntn[country].nvy[nvynum].armynum,ntn[country].nvy[nvynum].people,"null")
+#define AADJLOC fprintf(fexe,"A_LOC\t%d\t%hd\t%d\t%d\t%d\t%s\n",XALOC,country,armynum,ntn[country].arm[armynum].xloc,ntn[country].arm[armynum].yloc,"null")
+#define NADJLOC fprintf(fexe,"N_LOC\t%d\t%hd\t%d\t%d\t%d\t%s\n",XNLOC,country,nvynum,ntn[country].nvy[nvynum].xloc,ntn[country].nvy[nvynum].yloc,"null")
+#define AADJMOV fprintf(fexe,"A_MOV\t%d\t%hd\t%d\t%d\t0\t%s\n",XAMOV,country,armynum,ntn[country].arm[armynum].smove,"null")
+#define NADJMOV fprintf(fexe,"N_MOV\t%d\t%hd\t%d\t%d\t0\t%s\n",XNMOV,country,nvynum,ntn[country].nvy[nvynum].smove,"null")
+#define ECHGNAME fprintf(fexe,"E_CNAME\t%d\t%hd\t0\t0\t0\t%s\n",XECNAME,country,ntn[country].name)
+#define ECHGPAS fprintf(fexe,"E_CPAS\t%d\t%hd\t0\t0\t0\t%s\n",XECPAS,country,curntn->passwd)
+#define SADJDES fprintf(fexe,"S_ADES\t%d\t%hd\t0\t%d\t%d\t%c\n",XSADES,country,xcurs+xoffset,ycurs+yoffset,sct[xcurs+xoffset][ycurs+yoffset].designation)
+#define SADJDES2 fprintf(fexe,"S_ADES\t%d\t%hd\t0\t%d\t%d\t%c\n",XSADES,country,x,y,sct[x][y].designation)
+#define SADJCIV2 fprintf(fexe,"S_ACIV\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV,country,sct[i][j].people,i,j,"null")
+#define SADJCIV fprintf(fexe,"S_ACIV\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV,country,sct[xcurs+xoffset][ycurs+yoffset].people,xcurs+xoffset,ycurs+yoffset,"null")
+#define SADJCIV3 fprintf(fexe,"S_ACIV3\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV3,country,people_to_add,i,j,"null")
+#define INCFORT fprintf(fexe,"SIFORT\t%d\t%hd\t0\t%d\t%d\t%s\n",XSIFORT,country,xcurs+xoffset,ycurs+yoffset,"null")
+#define SADJOWN fprintf(fexe,"S_AOWN\t%d\t%hd\t0\t%d\t%d\t%s\n",XSAOWN,country,xcurs+xoffset,ycurs+yoffset,"null")
+#define EADJDIP(a,b) fprintf(fexe,"E_ADJ\t%d\t%hd\t%d\t%d\t0\t%s\n",EDADJ,a,b,ntn[a].dstatus[b],"null")
+#define EDECSPL fprintf(fexe,"E_SPL\t%d\t%hd\t%d\t%d\t0\t%s\n",EDSPL,country,s_cost,0,"null")
+#define NADJNTN fprintf(fexe,"N_TAX \t%d \t%hd \t%d \t%d \t%d \tnull\n",NTAX,country,(int) curntn->tax_rate,(int) curntn->active, (int) curntn->charity)
+#define NADJNTN2 fprintf(fexe,"N_POP \t%d \t%hd \t%d \t%d \t%d \tnull\n",NPOP,country,(int) curntn->popularity,(int) curntn->terror, (int) curntn->reputation)
+
+#define S_MIL 0 /* position in powers array */
+#define WARRIOR 0x00000001L
+#define CAPTAIN 0x00000002L
+#define WARLORD 0x00000004L
+#define ARCHER 0x00000008L
+#define CAVALRY 0x00000010L
+#define SAPPER 0x00000020L
+#define ARMOR 0x00000040L
+#define AVIAN 0x00000080L
+#define MI_MONST 0x00000100L
+#define AV_MONST 0x00000200L
+#define MA_MONST 0x00000400L
+#define E_MIL 11
+ /*CIVILIAN POWERS */
+#define S_CIV 11
+#define SLAVER 0x00000800L
+#define DERVISH 0x00001000L
+#define HIDDEN 0x00002000L
+#define ARCHITECT 0x00004000L
+#define RELIGION 0x00008000L
+#define MINER 0x00010000L
+#define BREEDER 0x00020000L
+#define URBAN 0x00040000L
+#define STEEL 0x00080000L
+#define NINJA 0x00100000L
+#define SAILOR 0x00200000L
+#define DEMOCRACY 0x00400000L
+#define ROADS 0x00800000L
+#define E_CIV 13
+ /* MAGICAL SKILLS */
+#define S_MGK 24
+#define THE_VOID 0x01000000L
+#define KNOWALL 0x02000000L
+#define DESTROYER 0x04000000L
+#define VAMPIRE 0x08000000L
+#define SUMMON 0x10000000L
+#define WYZARD 0x20000000L
+#define SORCERER 0x40000000L
+#define E_MGK 7
+#define MAXPOWER 31 /* number of powers */
+
+/* magic macro: returns TRUE if the nation has that power*/
+#define magic(NATION,POWER) ((ntn[NATION].powers&(POWER))!=0)
+#define ONMAP(x,y) ((x)>=0 && (y)>=0 && (x)(y) ? (x) : (y))
+#define min(x,y) ((x)<(y) ? (x) : (y))
+#endif
+
+/* attractiveness of sector to general populace */
+#define GOLDATTR 9 /* per jewel value of sector */
+#define FARMATTR 7 /* per point of food producable */
+#define MINEATTR 9 /* per metal value of sector */
+#define TOWNATTR 150
+#define CITYATTR 300
+#define TGATTR 10 /* bonus per point of value for tradegoods */
+#define OTHRATTR 50 /* attractiveness of other sector types */
+
+
+#define DMNTNATTR 40 /* DWARF ATTRACTIVENESS */
+#define DHILLATTR 20
+#define DCLERATTR 0
+#define DCITYATTR -20
+#define DTOWNATTR -20
+#define DGOLDATTR 40
+#define DMINEATTR 40
+#define DFOREATTR -20
+#define DWOODATTR -10
+
+#define EMNTNATTR -40 /* ELF */
+#define EHILLATTR -20
+#define ECLERATTR 0
+#define ECITYATTR -50
+#define ETOWNATTR -50
+#define EGOLDATTR 0
+#define EMINEATTR 0
+#define EFOREATTR 40
+#define EWOODATTR 40
+
+#define OMNTNATTR 30 /* ORC */
+#define OHILLATTR 20
+#define OCLERATTR 0
+#define OCITYATTR 50
+#define OTOWNATTR 25
+#define OGOLDATTR 20
+#define OMINEATTR 20
+#define OFOREATTR -40
+#define OWOODATTR -20
+
+#define HMNTNATTR -10 /* HUMAN */
+#define HHILLATTR 0
+#define HCLERATTR 30
+#define HCITYATTR 50
+#define HTOWNATTR 40
+#define HGOLDATTR 10
+#define HMINEATTR 10
+#define HFOREATTR -20
+#define HWOODATTR 0
+
+/* EXOTIC TRADE GOODS */
+#define TG_furs 0
+#define TG_wool 1
+#define TG_beer 2
+#define TG_cloth 3
+#define TG_wine 4
+#define END_POPULARITY 4
+
+#define TG_mules 5
+#define TG_horses 6
+#define TG_pigeons 7
+#define TG_griffons 8
+#define END_COMMUNICATION 8
+
+#define TG_corn 9
+#define TG_fish 10
+#define TG_sugar 11
+#define TG_honey 12
+#define TG_fruit 13
+#define TG_rice 14
+#define TG_wheat 15
+#define TG_dairy 16
+#define TG_peas 17
+#define TG_bread 18
+#define TG_cereal 19
+#define END_EATRATE 19
+
+#define TG_pottery 20
+#define TG_salt 21
+#define TG_timber 22
+#define TG_granite 23
+#define TG_pine 24
+#define TG_oak 25
+#define TG_nails 26
+#define END_SPOILRATE 26 /* also Knowledge start */
+
+#define TG_papyrus 27
+#define TG_math 28
+#define TG_library 29
+#define TG_drama 30
+#define TG_paper 31
+#define TG_literature 32
+#define TG_law 33
+#define TG_philosophy 34
+#define END_KNOWLEDGE 34
+
+#define TG_irregation 35
+#define TG_oxen 36
+#define TG_plows 37
+#define END_FARM 37
+
+#define TG_stones 38
+#define END_SPELL 38
+
+#define TG_herbs 39
+#define TG_medecine 40
+#define END_HEALTH 40
+
+#define TG_torture 41
+#define TG_prison 42
+#define END_TERROR 42
+#define END_NORMAL 42 /* also end of non mine/jewel goods */
+
+#define TG_bronze 43
+#define TG_copper 44
+#define TG_lead 45
+#define TG_tin 46
+#define TG_iron 47
+#define TG_steel 48
+#define TG_mithral 49
+#define TG_adamantine 50
+#define END_MINE 50
+
+#define TG_spice 51
+#define TG_silver 52
+#define TG_pearls 53
+#define TG_dye 54
+#define TG_silk 55
+#define TG_gold 56
+#define TG_rubys 57
+#define TG_ivory 58
+#define TG_diamonds 59
+#define TG_platinum 60
+#define END_WEALTH 60
+#define TG_none 61 /* no trade goods in sector */
+#define MAXTGVAL 100 /* maximum value for stat */
+
+/* defines for a nations class */
+#define C_NPC 0
+#define C_KING 1
+#define C_EMPEROR 2
+#define C_WIZARD 3
+#define C_PRIEST 4
+#define C_PIRATE 5
+#define C_TRADER 6
+#define C_WARLORD 7
+#define C_DEMON 8
+#define C_DRAGON 9
+#define C_SHADOW 10
+#define C_END 10
+
+#define ISCITY(desig) ((desig==DCITY)||(desig==DCAPITOL)||(desig==DFORT)||(desig==DTOWN))
+
+#define PWR_NA 10 /* national attributes gained from power */
+#define CLA_NA 30 /* national attributes gained from class */
+
+/* MAGIC/CIVILIAN/MILITARY POWER COSTS BY RACE */
+#define BASEMAGIC 50000L /* default for all not mentioned */
+#define DWFMAGIC 80000L
+#define HUMMAGIC 100000L
+#define ORCMAGIC 150000L
+#define DWFCIVIL 40000L
+#define ORCCIVIL 75000L
+#define HUMCIVIL 25000L
+#define DWFMILIT 40000L
+#define ORCMILIT 45000L
+
+#define abrt() { \
+fprintf(stderr,"\nSerious Error (File %s, Line %d) - Aborting\n",__FILE__,__LINE__); \
+abort(); \
+}
+
+#define DEVASTATE(X,Y) { \
+if(is_habitable(X,Y)) { \
+if((sct[X][Y].designation == DCAPITOL) \
+||(sct[X][Y].designation == DRUIN) \
+||(sct[X][Y].designation == DCITY)) { \
+ if(sct[X][Y].fortress >= 4) { \
+ sct[X][Y].fortress -= 4; \
+ } else sct[X][Y].fortress = 0; \
+ sct[X][Y].designation = DRUIN; \
+} else sct[X][Y].designation = DDEVASTATED; \
+} \
+}
+
+extern FILE *fm;
+extern int mailok;
+extern char *seasonstr[];
+extern char *alignment[];
+extern struct s_sector **sct;
+extern struct s_nation ntn[NTOTAL];
+extern struct s_nation *curntn;
+extern struct s_world world;
+
+extern short **movecost;
+extern char **occ; /* sector occupied?, NTOTAL+1 if contested */
+extern char *ele, *elename[], *veg, *vegfood, *vegname[];
+extern char *Class[],*races[],*diploname[];
+extern char *soldname[], *unittype[], *shunittype[], *directions[];
+extern int unitminsth[], u_enmetal[], u_encost[], unitmaint[];
+extern char *des, *desname[], *pwrname[];
+extern long powers[];
+extern char *tg_value, *tg_name[], *tg_stype; /* trade goods */
+
+#ifdef CONQUER
+extern long mercgot;
+#endif /* CONQUER */
+
+#ifdef ADMIN
+extern char *npcsfile;
+extern char scenario[];
+#endif /* ADMIN */
+extern int unitmove[], unitattack[], unitdefend[];
+
+/* file name definitions */
+extern char *sortname,*exefile,*datafile,*msgfile;
+extern char *helpfile,*newsfile,*isonfile,*timefile;
+
+#ifdef CONQUER
+extern int conq_mail_status;
+extern char conqmail[];
+#ifdef SYSMAIL
+extern int sys_mail_status;
+extern char sysmail[];
+#endif /* SYSMAIL */
+#endif /* CONQUER */
+#ifdef TRADE
+extern char *tradefile;
+#endif /* TRADE */
+
+#define EXT_CMD '\033' /* ESC to start extended command */
+
+#define MAXX (MAPX / 8) /* Number of X areas on map */
+#define MAXY (MAPY / 8) /* Number of Y areas on map */
+#define NUMAREAS (MAXX * MAXY) /* total # areas, MAXX*MAXY */
+#define NUMSECTS (MAPX * MAPY) /* total # areas, MAXX*MAXY */
+#define MAXHELP 6
+
+#ifdef HPUX
+#define SYSV
+#endif /* HPUX */
+
+/* minor market items */
+#define GETFOOD 97 /* response needed to get food */
+#define GETMETAL 98
+#define GETJEWL 99
+#define GODFOOD 8000L /* food recieved for GODPRICE */
+#define GODMETAL 2000L /* " */
+#define GODJEWL 3000L /* " */
+#define GODPRICE 25000L
+
+#ifdef XYZ
+/* THE FOLLOWING DEFINES ARE NOT IMPLEMENTED YET */
+/* THEY DEFINE THE ATTRIBUTES OF A (TO BE IMPLEMENTED) REGION */
+
+/* REGIONS REVOLT STATUS: if larger than the value */
+#define R_OPEN_REVOLT 220
+#define R_GUERILLA_WAR 170
+#define R_UNREST 150
+#define R_DISSENT 120
+#define R_CALM 80
+#define R_HAPPY 50
+#define R_PROSPEROUS 0
+
+/* REGIONS GOVERNMENTAL STRENGTH */
+#define R_BARBARIAN 0
+#define R_IND_VILAGES 20
+#define R_TRIBAL 40
+#define R_CITY_STATES 80
+#define R_BALKANIZED 110
+#define R_CONFEDERACY 140
+#define R_NATION 160
+#define R_MONARCHY 180
+#define R_EMPIRE 200
+
+/* REGION STRATEGY: region strategy by owning nation */
+#define R_ISOLATION 37
+#define R_BUILD_ECON 36
+#define R_EXPAND_PCE 35
+#define R_TAX 34
+#define R_BUILD_MIL 33
+#define R_EXPAND_MIL 32
+#define R_AT_WAR 31
+#define R_SUBDUE 20 /* 20-30: # of turns left in unrest */
+#define R_CIVIL_WAR 0 /* 0-19: number of turns left in war */
+
+#define NUMREGIONS 250 /* number of regions in the world */
+#define STARTYEAR -10000 /* year that game treats as 0. In this
+ case - ten thousand years B.C */
+
+struct s_region
+{
+ char *name; /* name of region */
+ long people; /* civilians in sector*/
+ long tax; /* tax production ability*/
+ unsigned char owner; /* nation id of owner */
+ unsigned char color; /* color to display region*/
+ unsigned char tech_level; /* technology level */
+ unsigned char law_level; /* law level of region */
+ unsigned char social_level; /* social level of region*/
+ unsigned char govt_sth; /* owners sth. in region */
+ unsigned char strategy; /* owners strategy in region */
+ unsigned char revolt; /* status of region */
+ unsigned char prestige; /* prestige for owning */
+};
+#endif /* 0 */
diff --git a/original/display.c b/original/display.c
new file mode 100644
index 0000000..b711531
--- /dev/null
+++ b/original/display.c
@@ -0,0 +1,491 @@
+/*Print and io subroutines for interactive game*/
+
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+/*include files*/
+#include
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+/*offset of upper left hand corner*/
+extern short xoffset;
+extern short yoffset;
+/*current cursor postion (relative to 00 in upper corner)*/
+/* position is 2*x,y*/
+extern short xcurs;
+extern short ycurs;
+/*redraw map in this turn if redraw is a 1*/
+extern short redraw;
+/*display state SEE data.h FOR CURRENT VALUES OF THESE */
+extern short hilmode;
+extern short dismode;
+extern short otherdismode;
+extern short otherhilmode;
+
+/* nation id of owner*/
+extern short country;
+
+static char *hasseen;
+
+/* allocate space for the hasseen array based on the actual screen size */
+void
+init_hasseen()
+{
+ hasseen = (char *)malloc(((COLS-10)/2) * (LINES-5));
+#ifdef BSD
+ bzero(hasseen,((COLS-10)/2) * (LINES-5));
+#else
+ memset( hasseen, 0, ((COLS-10)/2) * (LINES-5));
+#endif
+ if (hasseen == (char *)NULL) {
+ errormsg("Cannot allocate memory.");
+ bye(FALSE);
+ }
+}
+
+/*make a map*/
+void
+makemap()
+{
+ register int x,y;
+
+ for(x=0;x 0) /* just 'd' not 'd1 or 'd2' */
+ *odmode= - *odmode;
+ break;
+ case 'a': /* armies hilighted map*/
+ prep(country,FALSE);
+ *hmode=HI_ARMY;
+ goto changed_highlight;
+ case 'o': /* owners hilighted map*/
+ *hmode=HI_OWN;
+ goto changed_highlight;
+ case 's': /* hilight tradegoods */
+ *hmode=HI_GOOD;
+ goto changed_highlight;
+ case 'x': /*no highlighting*/
+ *hmode=HI_NONE;
+ goto changed_highlight;
+ case 'y': /* your armies hilighted map*/
+ prep(country,FALSE);
+ *hmode=HI_YARM;
+ goto changed_highlight;
+ case 'l': /* your armies with moves left hilighted map*/
+ prep(country,FALSE);
+ *hmode=HI_MOVE;
+ changed_highlight:
+ if ( odmode !=NULL ) /* just 'd' not 'd1 or 'd2' */
+ *ohmode= *hmode;
+ break;
+ default:
+ error:
+ beep();
+ redraw=DONE;
+ }
+}
+
+void
+newdisplay()
+{
+ get_display_mode(&dismode,&hilmode,&otherdismode,&otherhilmode);
+ makebottom();
+}
+
+/*see what is in xy as per display modes*/
+char
+get_display_for(x,y,dmode)
+ int x,y;
+ short dmode;
+{
+ int armbonus;
+
+ char ch= '{';
+ if((magic(sct[x+xoffset][y+yoffset].owner,THE_VOID)==TRUE)
+ &&((dmode==DI_DEFE)||(dmode==DI_GOLD)||(dmode==DI_METAL)
+ ||(dmode==DI_PEOP)||(dmode==DI_FOOD)||(dmode==DI_ITEMS))
+ &&(country!=sct[x+xoffset][y+yoffset].owner)
+ &&(magic(country,NINJA)!=TRUE)
+ &&(country!=0)) {
+ ch='?';
+ } else {
+ switch(dmode){
+ case DI_FOOD: /*food */
+ if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
+ ch=sct[x+xoffset][y+yoffset].vegetation;
+ else if (tofood( &sct[x+xoffset][y+yoffset],country)<10)
+ ch=tofood( &sct[x+xoffset][y+yoffset],country)+'0';
+ else ch='+';
+ break;
+ case DI_VEGE: /*vegetation*/
+ ch=sct[x+xoffset][y+yoffset].vegetation;
+ break;
+ case DI_DESI: /*designation*/
+ if(sct[x+xoffset][y+yoffset].owner==0){
+ if(tofood( &sct[x+xoffset][y+yoffset],country)!=0)
+ ch=sct[x+xoffset][y+yoffset].altitude;
+ else ch=sct[x+xoffset][y+yoffset].vegetation;
+ }
+ else if((country==0)
+ ||(sct[x+xoffset][y+yoffset].owner==country))
+ ch=sct[x+xoffset][y+yoffset].designation;
+ else ch=ntn[sct[x+xoffset][y+yoffset].owner].mark;
+ break;
+ case DI_CONT: /*contour*/
+ ch=sct[x+xoffset][y+yoffset].altitude;
+ break;
+ case DI_NATI: /*ownership*/
+ if(sct[x+xoffset][y+yoffset].owner==0)
+ ch=sct[x+xoffset][y+yoffset].altitude;
+ else ch=ntn[sct[x+xoffset][y+yoffset].owner].mark;
+ break;
+ case DI_RACE: /*race*/
+ if(sct[x+xoffset][y+yoffset].owner==0)
+ ch=sct[x+xoffset][y+yoffset].altitude;
+ else ch=ntn[sct[x+xoffset][y+yoffset].owner].race;
+ break;
+ case DI_MOVE: /*movement cost map*/
+ if(movecost[x+xoffset][y+yoffset]>=0) {
+ if(movecost[x+xoffset][y+yoffset]>=10)
+ ch='+';
+ else ch=movecost[x+xoffset][y+yoffset]+'0';
+ } else if(sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else
+ ch='X';
+ break;
+ case DI_DEFE: /*Defence*/
+ if (sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else if(movecost[x+xoffset][y+yoffset]<0)
+ ch='X';
+ else {
+ /*Racial combat bonus due to terrain (the faster you move the better)*/
+ armbonus=0;
+ armbonus+=5*(9-movecost[x+xoffset][y+yoffset]);
+
+ if(sct[x+xoffset][y+yoffset].altitude==MOUNTAIN)
+ armbonus+=40;
+ else if(sct[x+xoffset][y+yoffset].altitude==HILL)
+ armbonus+=20;
+
+ if(sct[x+xoffset][y+yoffset].vegetation==JUNGLE)
+ armbonus+=30;
+ else if(sct[x+xoffset][y+yoffset].vegetation==FOREST)
+ armbonus+=20;
+ else if(sct[x+xoffset][y+yoffset].vegetation==WOOD)
+ armbonus+=10;
+
+ armbonus+=fort_val(&sct[x+xoffset][y+yoffset]);
+
+ if(armbonus<200) ch=armbonus/20+'0';
+ else ch='+';
+ }
+ break;
+ case DI_PEOP: /*People*/
+ if (sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else if (sct[x+xoffset][y+yoffset].people>=9950)
+ ch='X';
+ else if (sct[x+xoffset][y+yoffset].people>=4950)
+ ch='V';
+ else if (sct[x+xoffset][y+yoffset].people>=950)
+ ch='I';
+ else
+ ch=(50+sct[x+xoffset][y+yoffset].people)/100+'0';
+ break;
+ case DI_GOLD: /*Gold*/
+ if (sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
+ ch='X';
+ else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
+ if (sct[x+xoffset][y+yoffset].jewels>=10)
+ ch='+';
+ else
+ ch=sct[x+xoffset][y+yoffset].jewels+'0';
+ } else ch='0';
+ break;
+ case DI_METAL: /*Metal*/
+ if (sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
+ ch='X';
+ else if (tg_ok(country,&sct[x+xoffset][y+yoffset])){
+ if (sct[x+xoffset][y+yoffset].metal>=10)
+ ch='+';
+ else
+ ch=sct[x+xoffset][y+yoffset].metal+'0';
+ } else ch='0';
+ break;
+ case DI_ITEMS: /* designations needed for tradegoods */
+ if (sct[x+xoffset][y+yoffset].altitude==WATER)
+ ch=WATER;
+ else if(tofood( &sct[x+xoffset][y+yoffset],country)==0)
+ ch='X';
+ else if (sct[x+xoffset][y+yoffset].tradegood!=TG_none
+ && (*(tg_stype+sct[x+xoffset][y+yoffset].tradegood)!='x')
+ && tg_ok(country,&sct[x+xoffset][y+yoffset]))
+ ch= *(tg_stype+sct[x+xoffset][y+yoffset].tradegood);
+ else ch='-';
+ break;
+ default:
+ break;
+ }
+ }
+ return ch;
+}
+
+void
+see(x,y)
+{
+ char ch;
+ if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
+ ||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
+ if(((y+yoffset) 0 ) {
+ highlight(x,y,otherhilmode);
+ ch=get_display_for(x,y,otherdismode);
+ mvaddch(y,2*x+1,ch);
+ }
+ }
+ else {
+ mvaddch(y,2*x,' ');
+ mvaddch(y,2*x+1,' ');
+ }
+}
+
+/*highlight what is in xy as per highlight mode*/
+void
+highlight(x,y,hmode)
+ short hmode;
+{
+ int armynum;
+ if((x<0)||(y<0)||(x>=SCREEN_X_SIZE)||(y>=SCREEN_Y_SIZE)
+ ||((y+yoffset)>=MAPY)||((x+xoffset)>=MAPX)) return;
+ standend();
+ switch(hmode){
+ case HI_MOVE: /* your armies w/ move left */
+ for(armynum=0;armynum=SCREEN_X_SIZE-1 ||
+ ycurs>=SCREEN_Y_SIZE-1 || XREAL>=MAPX || YREAL>=MAPY) {
+ centermap();
+ redraw=PART;
+ }
+
+ if(redraw!=DONE) {
+ if (redraw==FULL) {
+ clear(); /* clear real screen */
+ } else {
+ move(0,0); /* clear curses screen but not real screen */
+ clrtobot();
+ }
+ makemap(); /* update map */
+ makebottom();
+ redraw=DONE;
+ }
+ move(ycurs,2*xcurs);
+ makeside(FALSE); /*update side*/
+ move(ycurs,2*xcurs);
+ refresh();
+}
+
+int
+canbeseen(x,y)
+int x,y;
+{
+ if(!ONMAP(x,y)) return(FALSE);
+ return( (int) HAS_SEEN(x-xoffset,y-yoffset) );
+}
+
+/** CANSEE() fills seen[SCREEN_X_SIZE][SCREEN_Y_SIZE] */
+void
+whatcansee()
+{
+ register int x,y;
+ int i,j;
+ short armynum,nvynum;
+
+ if((magic(country,KNOWALL)==TRUE)||(country==0)) {
+ for(x=0;x=0 && j>=0 && i=0 && j>=0
+ && i0)
+ for(i=(int)P_AXLOC-xoffset-ARMYSEE;i!=1+(int)P_AXLOC-xoffset+ARMYSEE;i++)
+ for(j=(int)P_AYLOC-yoffset-ARMYSEE;j!=1+(int)P_AYLOC-yoffset+ARMYSEE;j++)
+ if(ONMAP(i+xoffset,j+yoffset) && i>=0 && j>=0
+ && i
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+extern FILE *fexe;
+extern short selector;
+extern short country;
+extern short xcurs, ycurs, xoffset, yoffset;
+
+void
+ext_cmd(armie)
+int armie;
+{
+ int stat=0,armynum,army2,men;
+
+ clear_bottom(0);
+
+ if( armie == -1 ) armynum = getselunit();
+ else armynum=armie;
+
+ mvaddstr(LINES-2, 0,
+ " (+) combine, (-) split n men, (/) divide by 2, (G)roup");
+ mvaddstr(LINES-3, 0,
+ " (a)ttack, (d)efend, (s)cout, (m)arch, (g)arrison");
+ if(fort_val(&sct[P_AXLOC][P_AYLOC]) > 0) {
+ if (sct[P_AXLOC][P_AYLOC].owner==country) addstr(", (S)ortie");
+ else addstr(", (S)iege");
+ if (P_ATYPE>=MINLEADER && P_ATYPE= MAXARM
+ || army2 < 0 || army2 >= MAXARM || P_ASOLD == 0
+ || curntn->arm[army2].sold == 0) {
+ errormsg("Selected unit doesn't exist");
+ return;
+ }
+ if (P_ASTAT != curntn->arm[army2].stat
+ || P_ATYPE != curntn->arm[army2].unittyp
+ || P_ATYPE >= MINLEADER
+ || P_ASTAT == ONBOARD || P_ASTAT == TRADED) {
+ if ((nocomb_stat(P_ASTAT) == TRUE) ||
+ (nocomb_stat(curntn->arm[army2].stat) == TRUE) ||
+ curntn->arm[army2].stat == MARCH ||
+ curntn->arm[army2].stat == SIEGE || /* may not jump out */
+ curntn->arm[army2].stat == SORTIE || /* of these statuses */
+ P_ATYPE >= MINLEADER ||
+ P_ATYPE!=curntn->arm[army2].unittyp) {
+ errormsg("Selected armies not legal");
+ return;
+ }
+ }
+ if((curntn->arm[army2].xloc!=P_AXLOC)
+ ||(curntn->arm[army2].yloc!=P_AYLOC)) {
+ errormsg("Selected armies not together");
+ return;
+ }
+ P_ASOLD += curntn->arm[army2].sold;
+ curntn->arm[army2].sold = 0;
+ P_AMOVE=min(P_AMOVE,curntn->arm[army2].smove);
+ AADJMEN;
+ AADJMOV;
+ if (P_ASTAT>NUMSTATUS) {
+ curntn->arm[P_ASTAT-NUMSTATUS].smove=P_AMOVE;
+ armynum = P_ASTAT-NUMSTATUS;
+ AADJMOV;
+ }
+ armynum = army2;
+ AADJMEN;
+}
+
+void
+change_status(armynum,new_stat)
+int armynum,new_stat;
+{
+ int i;
+ if(armynum<0 || armynum >= MAXARM || P_ASTAT==SCOUT ||
+ P_ASTAT==TRADED || P_ASTAT==ONBOARD || P_ASTAT==SORTIE){
+ errormsg("Can't change status on that army");
+ return;
+ }
+ if( P_ATYPE == A_MILITIA && new_stat!=MILITIA ) {
+ errormsg("Militia is all you get");
+ return;
+ }
+ if( P_ATYPE == A_ZOMBIE && new_stat==MARCH ) {
+ errormsg("Duh? Your Zombies just lumber about.");
+ return;
+ }
+ if(P_ASTAT == SIEGED && new_stat != SORTIE && new_stat != RULE) {
+ errormsg("Sieged troops may only switch to sortie");
+ return;
+ }
+ if(P_ASTAT == new_stat) {
+ errormsg("Uh, sir. Aren't we doing that already?");
+ return;
+ }
+ if(new_stat == SCOUT) {
+ if(( P_ATYPE != A_SCOUT )&&( P_ASOLD >= 25)) {
+ errormsg("Need less than 25 men to scout");
+ return;
+ } else {
+ P_ATYPE=A_SCOUT;
+ AADJMEN;
+ }
+ }
+ if(P_ASTAT == GENERAL ){
+ i=armynum;
+ for(armynum=0;armynum0) && (P_ASTAT==i+NUMSTATUS)){
+ P_ASTAT = ATTACK;
+ AADJSTAT;
+ }
+ }
+ armynum=i;
+ }
+ if(new_stat == GARRISON) {
+ if((sct[P_AXLOC][P_AYLOC].owner!=country)
+ ||(fort_val(&sct[P_AXLOC][P_AYLOC])==0)) {
+ errormsg("Just how do you want to garrison that?");
+ return;
+ }
+ } else if(new_stat == SORTIE) {
+ if((sct[P_AXLOC][P_AYLOC].owner!=country)
+ ||(fort_val(&sct[P_AXLOC][P_AYLOC])==0)) {
+ errormsg("Hmmm... How do you figure to sortie from there?");
+ return;
+ }
+ } else if(new_stat == SIEGE) {
+ if((sct[P_AXLOC][P_AYLOC].owner==country)
+ ||(fort_val(&sct[P_AXLOC][P_AYLOC])==0)) {
+ errormsg("You want to lay seige to this??");
+ return;
+ }
+ } else if(new_stat == RULE) {
+ if((sct[P_AXLOC][P_AYLOC].owner!=country)
+ ||(!ISCITY(sct[P_AXLOC][P_AYLOC].designation))
+ ||(P_ATYPE=MINMONSTER)) {
+ errormsg("Sorry, but you can't rule in that sector");
+ return;
+ }
+ }
+
+ /* eliminate half starting movement if start out on march */
+ if( P_ASTAT==MARCH && new_stat!=MARCH ) {
+ if(P_AMOVE<(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50){
+ errormsg("That troop has gone too far to stop marching");
+ return;
+ }
+ P_AMOVE-=(curntn->maxmove * *(unitmove+(P_ATYPE%UTYPE)))/50;
+ AADJMOV;
+ }
+
+ /* location dependent statuses make armies stay in place */
+ if((new_stat==RULE)||(new_stat==SORTIE)
+ ||(new_stat==SIEGE)||(new_stat==GARRISON)) {
+ P_AMOVE=0;
+ AADJMOV;
+ }
+ P_ASTAT = new_stat;
+ AADJSTAT;
+ if( P_AMOVE != 0 ) P_AMOVE--;
+ AADJMOV;
+}
+
+void
+reducearmy(armynum,men)
+int armynum,men;
+{
+ int army2;
+ int oldx, oldy, army;
+
+ if(P_ATYPE>=MINMONSTER){
+ errormsg("sorry -- army is monster");
+ return;
+ }
+ if(P_ATYPE>=MINLEADER){
+ errormsg("sorry -- army is leader");
+ return;
+ }
+#ifdef TRADE
+ if(men<25 || armynum < 0 || armynum >= MAXARM || P_ASOLD < men+25 || P_ASTAT==ONBOARD || P_ASTAT==TRADED) {
+#else
+ if(men<25 || armynum < 0 || armynum >= MAXARM || P_ASOLD < men+25 || P_ASTAT==ONBOARD) {
+#endif /* TRADE */
+ errormsg("Selected army too small or illegal");
+ return;
+ }
+
+ if(P_ASOLD < men) {
+ errormsg("Too many men to split from army");
+ return;
+ }
+
+ oldx=(int)P_AXLOC;
+ oldy=(int)P_AYLOC;
+ army2=armynum;
+
+ armynum=(-1);
+ for(army=0;armyarm[army].sold==0){
+ if(armynum==(-1)) armynum=army;
+ }
+ /*overflow*/
+ if(armynum==(-1)) {
+ errormsg("TOO MANY ARMIES");
+ return;
+ } else {
+ P_AMOVE=curntn->arm[army2].smove;
+ P_ATYPE=curntn->arm[army2].unittyp;
+ P_ASTAT=curntn->arm[army2].stat;
+ P_AXLOC=oldx;
+ P_AYLOC=oldy;
+ P_ASOLD=men;
+ curntn->arm[army2].sold-=P_ASOLD;
+ AADJSTAT;
+ AADJMEN;
+ AADJLOC;
+ AADJMOV;
+ armynum=army2;
+ AADJMEN;
+ }
+}
+
+void
+splitarmy(armynum)
+int armynum;
+{
+ int men;
+ clear_bottom(2);
+ mvaddstr(LINES-2, 0, "How many men to split? ");
+ refresh();
+ men = get_number();
+ if(men <= 0) {
+ return;
+ }
+ reducearmy(armynum,men);
+}
+
+void
+errormsg(str)
+char *str;
+{
+ mvaddstr(LINES-1, 0, str);
+ clrtoeol();
+ mvaddstr(LINES-1, COLS-16, "PRESS ANY KEY");
+ beep();
+ refresh();
+ getch();
+}
+
+void
+clear_bottom(i)
+int i;
+{
+ if(i==0) i=4;
+ for (; i>0 ; i--) {
+ move( LINES-i, 0);
+ clrtoeol();
+ }
+}
+
+/* add army to a group */
+void
+addgroup(armynum)
+int armynum;
+{
+ int moverate,group;
+
+ if((P_ATYPE>=MINLEADER)&&(P_ATYPE= MAXARM || P_ASTAT==SCOUT ||
+ P_ASTAT==TRADED || P_ASTAT==ONBOARD || P_ATYPE==A_MILITIA ){
+ errormsg("Selected army not groupable");
+ return;
+ }
+ mvaddstr(LINES-4,0,"enter a valid leader unit/army group id: ");
+ refresh();
+ group = get_number();
+ if(group < 0) {
+ return;
+ }
+ if(group > MAXARM || curntn->arm[group].sold <=0){
+ errormsg("invalid unit number");
+ return;
+ }
+ if((P_AXLOC != curntn->arm[group].xloc)
+ ||(P_AYLOC != curntn->arm[group].yloc)){
+ errormsg("units are not in same sector");
+ return;
+ }
+ if((curntn->arm[group].unittyp arm[group].unittyp >=MINMONSTER)){
+ errormsg("Group leader not a leader unit");
+ return;
+ } else if(curntn->arm[group].stat==ONBOARD){
+ errormsg("Cannot group onto a transport");
+ return;
+ }
+
+ P_ASTAT=group+NUMSTATUS;
+ moverate = P_AMOVE;
+ AADJSTAT;
+ armynum = group;
+ P_ASTAT=GENERAL;
+ AADJSTAT;
+ if( P_AMOVE > moverate ){
+ P_AMOVE = moverate;
+ AADJMOV;
+ }
+}
diff --git a/original/forms.c b/original/forms.c
new file mode 100644
index 0000000..4814be1
--- /dev/null
+++ b/original/forms.c
@@ -0,0 +1,1094 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+/* screen subroutines */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+extern FILE *fexe, *fnews;
+extern short country,redraw;
+extern long startgold;
+extern short Gaudy;
+
+static char helplist[MAXHELP][20]={"Commands", "General Info",
+ "Military","Magic","Designations","Other"};
+
+#define RPT_LINES 14
+#define RPT_COLS 13
+#define BUF_LINES 10
+#define BUF_COLS 15
+#define MAXINROW ((COLS-BUF_COLS)/RPT_COLS)
+#define MAXINSCR (((LINES-BUF_LINES)/RPT_LINES)*MAXINROW)
+void
+showscore()
+{
+ int i;
+ int done=FALSE;
+ int xpos,ypos;
+ int count,count2; /*number of time through the loop on this screen*/
+ int nationid; /*current nation id */
+
+ count2=1;
+ clear();
+ while(done==FALSE) {
+ move(0,0);
+ clrtobot();
+ standout();
+ mvaddstr(0,(COLS/2)-10,"NATION SCORE SCREEN");
+ standend();
+
+ nationid=count2;
+ xpos=BUF_COLS;
+ ypos=3;
+ count=0;
+ while((nationiddstatus[i]==WAR)
+ ||(curntn->dstatus[i]==JIHAD)) standout();
+ mvprintw(count%MAXINCOL+2,offset+14, "=> %s",*(diploname+curntn->dstatus[i]));
+ standend();
+ if((ntn[i].dstatus[country]==WAR)
+ ||(ntn[i].dstatus[country]==JIHAD)) standout();
+ mvprintw(count%MAXINCOL+2,offset+28, "=> %s",*(diploname+ntn[i].dstatus[country]));
+ standend();
+ count++;
+ }
+
+ /* display options */
+ standout();
+ mvaddstr(LINES-7,COLS/2-26,"HIT RETURN KEY TO CHANGE STATUS; HIT SPACE IF DONE");
+ mvprintw(LINES-6,COLS/2-31,"HIT 'B' KEY TO BRIBE NPC NATION (cost=$%ld per 1000 Mil.)",BRIBE);
+ mvaddstr(LINES-5,COLS/2-21,"HIT ANY OTHER KEY TO SCROLL NATIONS LIST");
+ standend();
+ refresh();
+ k=getch();
+ if(k==' ') {
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if((k!='B')&&(k!='\r')&&(k!='\n')) {
+ /* find start for next listing */
+ for(; itgold<=BRIBE){
+ mvaddstr(LINES-3,0,"NOT ENOUGH GOLD");
+ refresh();
+ getch();
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ mvaddstr(LINES-4,0,"BRIBES DONT ALWAYS WORK (only the update will show)");
+ mvaddstr(LINES-3,0,"WHAT NATION:");
+ refresh();
+ nation = get_country();
+
+ /* may only change with NPCs */
+ if((nation<=0)
+ ||(nation>=NTOTAL)
+ ||(!isnpc(ntn[nation].active))){
+ errormsg("That nation is not a Non-Player Country");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if(ntn[nation].dstatus[country]==UNMET){
+ errormsg("They have no knowledge that you exist");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if((isgod!=TRUE)
+ &&((ntn[nation].dstatus[country]==ALLIED)
+ ||(ntn[nation].dstatus[country]==JIHAD)
+ ||(ntn[nation].dstatus[country]==UNMET)
+ ||(ntn[nation].dstatus[country]==TREATY))){
+ errormsg("Sorry, you cannot bribe them");
+ return;
+ }
+
+ if( isgod==TRUE ) {
+ bribecost = 0;
+ } else if( ntn[nation].tmil > 1000 ) {
+ bribecost = BRIBE * ntn[nation].tmil / 1000;
+ } else bribecost = BRIBE;
+ mvprintw(LINES-3,0,"This will cost %ld gold talons. continue (y or n)",bribecost);
+ refresh();
+
+ if( getch() != 'y' ) return;
+ if(curntn->tgold<=bribecost){
+ errormsg("Sorry Not Enough Gold");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ curntn->tgold-=bribecost;
+
+ sprintf(name,"%s%d",exefile,nation);
+ if ((fm=fopen(name,"a+"))==NULL) {
+ printf("error opening news file\n");
+ exit(FAIL);
+ }
+ BRIBENATION;
+
+ ntn[nation].dstatus[country]--;
+
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ mvaddstr(LINES-3,0,"WHAT NATION:");
+ refresh();
+ nation = get_country();
+ /* can't change with nomads...*/
+ if((nation<=0)||(nation>NTOTAL)||(!isntnorp(ntn[nation].active))){
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ if((isgod==FALSE)
+ &&(curntn->tgold < BREAKJIHAD )
+ &&(((curntn->dstatus[nation]==TREATY)
+ &&(ntn[nation].dstatus[country]dstatus[nation]==JIHAD))) {
+
+ mvprintw(LINES-1,0,"Sorry, need %d talons to change status with ntn %s",BREAKJIHAD,ntn[nation].name);
+ clrtoeol();
+ mvaddstr(LINES-1, 60, "PRESS ANY KEY");
+ refresh();
+ getch();
+ if(isgod==TRUE) reset_god();
+ return;
+ } else if (isgod==FALSE && curntn->dstatus[nation]==UNMET
+ && ntn[nation].dstatus[country]==UNMET) {
+ errormsg("Sorry, you have not met that nation yet.");
+ if(isgod==TRUE) reset_god();
+ return;
+ } else {
+ clear();
+ mvaddstr(0,0,"WHAT NEW STATUS");
+ j=2;
+ mvprintw(j++,0,"1) TREATY (%d talons to break)",BREAKJIHAD);
+ mvaddstr(j++,0,"2) ALLIED");
+ mvaddstr(j++,0,"3) FRIENDLY");
+ mvaddstr(j++,0,"4) NEUTRAL");
+ mvaddstr(j++,0,"5) HOSTILE");
+ mvaddstr(j++,0,"6) WAR");
+ mvprintw(j++,0,"7) JIHAD (%d talons to break):",BREAKJIHAD);
+ j++;
+ for( i=1; iJIHAD)
+ ||((isgod==FALSE)&&(temp==UNMET))){
+ errormsg("SORRY, Invalid inputs -- hit return");
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+
+ if((curntn->dstatus[nation]==JIHAD)&&(temp!=JIHAD))
+ curntn->tgold -= BREAKJIHAD;
+ else if ((curntn->dstatus[nation]==TREATY)&&(temp!=TREATY)) {
+ if (ntn[nation].dstatus[country]!=TREATY) {
+ errormsg("Non-binding Treaty broken... fee waived.");
+ } else {
+ curntn->tgold -= BREAKJIHAD;
+ }
+ }
+
+ curntn->dstatus[nation]=temp;
+ EADJDIP(country,nation);
+
+ if((temp>HOSTILE)
+ &&(ispc(ntn[nation].active))
+ &&(ntn[nation].dstatus[country]name);
+ mailclose(nation);
+ }
+ }
+
+ /*prevent ron from being sneaky*/
+ if((temp>HOSTILE)
+ &&(isactive(ntn[nation].active))
+ &&(ntn[nation].dstatus[country]name);
+ mvprintw(4,0,"alignment is %s",alignment[npctype(curntn->active)]);
+
+ if (isgod==TRUE)
+ mvprintw(5,0,"active is %d",curntn->active);
+ mvprintw(6,0,"tax_rate...... %2d%%",curntn->tax_rate);
+ mvprintw(7,0,"inflation..... %2d%%",curntn->inflation);
+ i=(int)10*curntn->tax_rate-curntn->popularity-curntn->terror-3*curntn->charity;
+ if( i<0 ) i=0;
+ mvprintw(8,0,"peasant revolt %2d%%",(i*PREVOLT)/100);
+ i=(int)5*curntn->tax_rate - curntn->prestige;
+ if( i<0 ) i=0;
+ mvprintw(9,0,"other revolt.. %2d%%",(i*PREVOLT)/100);
+ standend();
+ mvprintw(10,0,"capitol loc: x is %d",curntn->capx);
+ mvprintw(11,0," y is %d",curntn->capy);
+ mvprintw(13,0,"class is %s",*(Class+curntn->class));
+ if(ispc( curntn->active ) )
+ addstr(" (PC)");
+ else if(isnpc( curntn->active ) )
+ addstr(" (NPC)");
+ else addstr(" (MON)");
+ mvprintw(14,0,"nations mark is...%c ",curntn->mark);
+ for(i=1;i<8;i++) if(curntn->race==*(races+i)[0]){
+ mvprintw(15,0, "nation race is....%s ",*(races+i));
+ break;
+ }
+
+ mvprintw(3,COLS/2-12, "terror........ %3d",curntn->terror);
+ mvprintw(4,COLS/2-12, "popularity.... %3d",curntn->popularity);
+ mvprintw(5,COLS/2-12, "prestige...... %3d",curntn->prestige);
+ mvprintw(6,COLS/2-12, "knowledge..... %3d",curntn->knowledge);
+ temp = P_EATRATE;
+ mvprintw(7,COLS/2-12, "eatrate.......%3.2f",temp);
+ mvprintw(8,COLS/2-12, "wealth........ %3d",curntn->wealth);
+ mvprintw(9,COLS/2-12, "charity....... %2d%%",curntn->charity);
+ mvprintw(10,COLS/2-12,"communication.%3.2f",(float) P_NTNCOM);
+ mvprintw(11,COLS/2-12,"reputation.... %3d",curntn->reputation);
+ mvprintw(12,COLS/2-12,"spoilrate.....%3d%%",curntn->spoilrate);
+ mvprintw(13,COLS/2-12,"farm ability.. %3d",curntn->farm_ability);
+ mvprintw(14,COLS/2-12,"mine ability.. %3d",curntn->mine_ability);
+ mvprintw(15,COLS/2-12,"poverty rate.. %2d%%",curntn->poverty);
+ mvprintw(16,COLS/2-12,"power......... %3d",curntn->power);
+
+ if (country!=0) {
+ mvprintw(12,0,"leader is %s",curntn->leader);
+ mvprintw(16,0,"score currently...%ld",curntn->score);
+ mvprintw(3,COLS-30, "attack bonus.........%+4d%%",curntn->aplus);
+ mvprintw(4,COLS-30, "defense bonus........%+4d%%",curntn->dplus);
+ mvprintw(12,COLS-30,"total soldiers....%8ld",curntn->tmil);
+ } else {
+ mvprintw(12,0,"demigod is %s",curntn->leader);
+ mvprintw(16,0,"turn currently....%ld",TURN);
+ mvprintw(3,COLS-30, "mercs attack bonus....+%2d%%",MERCATT);
+ mvprintw(4,COLS-30, "mercs defense bonus...+%2d%%",MERCDEF);
+ mvprintw(12,COLS-30,"total mercs.......%8ld",MERCMEN);
+ }
+
+ mvprintw(5,COLS-30, "maximum move rate.......%2d",curntn->maxmove);
+ mvprintw(6,COLS-30, "reproduction rate......%2d%%",curntn->repro);
+ mvprintw(8,COLS-30, "gold talons......$%8ld",curntn->tgold);
+
+ mvprintw(9,COLS-30,"jewels ..........$%8ld",curntn->jewels);
+ mvprintw(10,COLS-30,"metal & minerals..%8ld",curntn->metals);
+ if(curntn->tfood<2*curntn->tciv) standout();
+ mvprintw(11,COLS-30,"food in granary...%8ld",curntn->tfood);
+ standend();
+
+ mvprintw(13,COLS-30,"total civilians...%8ld",curntn->tciv);
+ mvprintw(14,COLS-30,"total ships..........%5d",curntn->tships);
+ mvprintw(15,COLS-30,"total sectors........%5d",curntn->tsctrs);
+ mvprintw(16,COLS-30,"spell points.........%5d",curntn->spellpts);
+
+ standout();
+ mvaddstr(LINES-6,COLS/2-26,"HIT 'B' FOR BUDGET SCREEN, 'P' FOR PRODUCTION SCREEN");
+ mvaddstr(LINES-5,COLS/2-25,"1) NAME 2) PASSWD 3) TAX RATE 4) CHARITY 5) TERROR");
+ if(magic(country,VAMPIRE)!=1 || isgod==TRUE)
+ mvaddstr(LINES-4,COLS/2-21,"6) ADJUST TO COMBAT BONUS");
+ else mvaddstr(LINES-4,COLS/2-22,"CANT ADD TO COMBAT BONUS");
+ addstr(" 7) TOGGLE PC <-> NPC");
+
+#ifdef OGOD
+ if(isgod==TRUE) mvaddstr(LINES-3,COLS/2-33,"HIT 8 TO DESTROY, 9 TO CHANGE COMMODITY OR '0' TO CHANGE DEMI-GOD");
+#else OGOD
+ if(isgod==TRUE) mvaddstr(LINES-3,COLS/2-24,"HIT 8 TO DESTROY NATION, OR '0' TO CHANGE DEMI-GOD");
+#endif /* OGOD */
+ else mvaddstr(LINES-3,COLS/2-14,"HIT ANY OTHER KEY TO CONTINUE");
+ standend();
+ refresh();
+ switch(getch()){
+ case '1': /*get name*/
+ clear();
+ mvaddstr(0,0,"What name would you like:");
+ clrtoeol();
+ refresh();
+ get_nname(string);
+ if((strlen(string)<=1)||(strlen(string)>NAMELTH)){
+ errormsg("Invalid name length");
+ break;
+ }
+ /*check if already used*/
+ else for(i=1;iname,string);
+ ECHGNAME;
+ break;
+ case '2': /*change password */
+ clear();
+ /* minimum password length setting */
+ if (country != 0) intval=2;
+ else intval=4;
+ if(isgod!=TRUE){
+ mvaddstr(0,0,"What is your current password:");
+ refresh();
+ (void) get_pass(command);
+ strncpy(passwd,crypt(command,SALT),PASSLTH+1);
+ if((strncmp(passwd,ntn[0].passwd,PASSLTH)!=0)
+ &&(strncmp(passwd,curntn->passwd,PASSLTH)!=0)){
+ break;
+ }
+ }
+ mvaddstr(2,0,"What is your new password:");
+ refresh();
+ i = get_pass(command);
+ if (iPASSLTH) {
+ errormsg("Password too long");
+ break;
+ }
+ strncpy(passwd,command,PASSLTH);
+ mvaddstr(4,0,"Reenter your new password:");
+ refresh();
+ (void) get_pass(command);
+ if(strncmp(passwd,command,PASSLTH)!=0) {
+ errormsg("Invalid password match; Password unchanged");
+ break;
+ }
+ errormsg("New password can be used following next update");
+ strncpy(curntn->passwd,crypt(command,SALT),PASSLTH);
+ ECHGPAS;
+ break;
+ case '3': /* change tax rate */
+ standout();
+ mvaddstr(LINES-1,0,"WHAT TAX RATE DO YOU WISH:");
+ standend();
+ refresh();
+ intval = get_number();
+ if( intval < 0 )
+ break;
+ else if( intval > 20 )
+ errormsg("NO WAY! the peasants will revolt!!!");
+ else if( intval > 10 && (curntn->tsctrs<20 || curntn->score<20) )
+ errormsg("Sorry, you may not go above 10% yet");
+ else {
+ curntn->tax_rate = (unsigned char) intval;
+ NADJNTN;
+ }
+ break;
+ case '4': /* charity */
+ standout();
+ mvaddstr(LINES-1,0,"GIVE WHAT PERCENT OF YOUR INCOME TO THE POOR:");
+ standend();
+ refresh();
+ intval = get_number();
+ if (intval < 0) {
+ break;
+ } else if( intval > 100 ) {
+ errormsg("ERROR - invalid charity rate");
+ } else if (intval > 25) {
+ errormsg("You are kidding, right?");
+ /* this will protect from both underflow and overflow */
+ } else if(intval > curntn->charity) {
+ if (2 * (intval - (int)curntn->charity) + (int) curntn->popularity > 100) {
+ errormsg("ERROR - you may not increase charity that much");
+ } else {
+ curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity);
+ curntn->charity = intval;
+ NADJNTN;
+ NADJNTN2;
+ }
+ } else {
+ if (2 * (intval - (int)curntn->charity) < - (int) curntn->popularity) {
+ errormsg("ERROR - you may not decrease charity that much");
+ } else {
+ curntn->popularity += (unsigned char) 2*(intval - (int) curntn->charity);
+ curntn->charity = intval;
+ NADJNTN;
+ NADJNTN2;
+ }
+ }
+ break;
+ case '5': /* terror */
+ mvaddstr(LINES-2,0,"YOU CAN TERRORIZE YOUR PEOPLE AN ADDITONAL 1-5%:");
+ standout();
+ mvaddstr(LINES-1,0,"HOW MUCH MORE TO TERRORIZE THEM: ");
+ standend();
+ refresh();
+ intval = get_number();
+ if( intval < 0 )
+ break;
+ else if( intval+curntn->terror > 100 )
+ errormsg("Cant go over 100 terror!!!");
+ else if((intval > curntn->popularity )
+ || (intval > curntn->reputation ))
+ errormsg("Sorry - this would cause underflow");
+ else if(intval>5) {
+ errormsg("That is over the allowed 5%");
+ } else if(terror_adj>0) {
+ errormsg("Terror may only be adjusted once per turn");
+ } else if(intval>0) {
+ terror_adj++;
+ curntn->terror += (unsigned char) intval;
+ curntn->popularity -= (unsigned char) intval;
+ curntn->reputation -= (unsigned char) (intval+1)/2;
+ NADJNTN2;
+ }
+ break;
+ case '6': /* combat bonus */
+#ifdef OGOD
+ if(isgod==TRUE) {
+ mvaddstr(LINES-2,0,"SUPER-USER: Change (A)ttack or (D)efense Bonus? ");
+ refresh();
+ if ((intval=getch())=='A' || intval=='a') {
+ mvaddstr(LINES-1,0,"Enter new value for Attack Bonus: ");
+ refresh();
+ curntn->aplus = get_number();
+ if (curntn->aplus < 0) curntn->aplus = 0;
+ } else if (intval=='d' || intval == 'D') {
+ mvaddstr(LINES-1,0,"Enter new value for Defense Bonus: ");
+ refresh();
+ curntn->dplus = get_number();
+ if (curntn->dplus < 0) curntn->dplus = 0;
+ }
+ break;
+ }
+#endif /*OGOD*/
+ if(magic(country,VAMPIRE)==1) {
+ errormsg("VAMPIRES CAN'T ADD TO COMBAT BONUS");
+ break;
+ }
+ if(magic(country,WARLORD)==1) intval=30;
+ else if(magic(country,CAPTAIN)==1) intval=20;
+ else if(magic(country,WARRIOR)==1) intval=10;
+ else intval=0;
+ men=0;
+ for(armynum=0;armynum0)&&(P_ATYPEaplus-intval, 10 ) / 10;
+ cost = METALORE*men*armynum*armynum;
+ if( curntn->race == ORC) cost*=3;
+ mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Attack (enter y or n):",cost);
+ refresh();
+ if(getch()=='y'){
+ if(curntn->metals> cost){
+ curntn->aplus+=1;
+ I_APLUS;
+ curntn->metals-=cost;
+ } else {
+ errormsg("SORRY");
+ }
+ }
+ armynum = max( curntn->dplus-intval, 10 ) / 10;
+ cost=METALORE*men*armynum*armynum;
+ if( curntn->race == ORC) cost*=3;
+ mvprintw(LINES-1,0,"Do You Wish Spend %ld Metal On Defense (enter y or n):",cost);
+ refresh();
+ if(getch()=='y'){
+ if(curntn->metals>cost){
+ curntn->dplus+=1;
+ I_DPLUS;
+ curntn->metals-=cost;
+ } else {
+ errormsg("SORRY");
+ }
+ }
+ break;
+ case '7':
+ if(ispc(curntn->active)) {
+ errormsg("Note: you get no mail while playing as an NPC!");
+ curntn->active *= 4;
+ } else if(isnpc(curntn->active)) {
+ errormsg("Okay.... you have now come back to reality.");
+ curntn->active /= 4;
+ }
+ NADJNTN;
+ break;
+ case '8':
+ if(isgod==TRUE){
+ standout();
+ mvaddstr(LINES-1,0,"DO YOU WANT TO DESTROY THIS NATION (y or n)");
+ standend();
+ refresh();
+
+ if(getch()=='y') {
+ /* save to last turns news file */
+ sprintf(filename,"%s%d",newsfile,TURN-1);
+ if ((fnews=fopen(filename,"a+"))==NULL) {
+ printf("error opening news file\n");
+ exit(FAIL);
+ }
+ destroy(country);
+ fclose(fnews);
+ sprintf(command,"%s/%s", EXEDIR, sortname);
+ sprintf(command,"%s %s %s", command, filename, filename);
+ system(command);
+ }
+ }
+ break;
+#ifdef OGOD
+ case '9':
+ if (isgod==TRUE) {
+ /* open the target country's files */
+ sprintf(filename,"%s%d",exefile,country);
+ if ((ftmp=fopen(filename,"a"))==NULL) {
+ beep();
+ errormsg("error opening country's file");
+ reset_god();
+ return;
+ }
+ /* adjust commodities */
+ mvaddstr(LINES-2,0,"CHANGE: 1) Gold 2) Jewels 3) Iron 4) Food ?");
+ clrtoeol();
+ refresh();
+ switch(getch()) {
+ case '1':
+ mvaddstr(LINES-1,0,"WHAT IS NEW VALUE FOR TREASURY? ");
+ refresh();
+ curntn->tgold = (long) get_number();
+ if (curntn->tgold < 0L) curntn->tgold=0L;
+ fprintf(ftmp,"L_NGOLD\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNAGOLD ,country,curntn->tgold,"null");
+ break;
+ case '2':
+ mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF JEWELS? ");
+ refresh();
+ curntn->jewels = (long) get_number();
+ if (curntn->jewels < 0L) curntn->jewels=0L;
+ fprintf(ftmp,"L_NJWLS\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNARGOLD ,country,curntn->jewels,"null");
+ break;
+ case '3':
+ mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF METAL? ");
+ refresh();
+ curntn->metals = (long) get_number();
+ if (curntn->metals < 0L) curntn->metals=0L;
+ fprintf(ftmp,"L_NMETAL\t%d \t%d \t%ld \t0 \t0 \t%s\n", XNAMETAL ,country,curntn->metals,"null");
+ break;
+ case '4':
+ mvaddstr(LINES-1,0,"WHAT IS NEW AMOUNT OF FOOD? ");
+ refresh();
+ curntn->tfood = (long) get_number();
+ if (curntn->tfood < 0L) curntn->tfood = 0L;
+ break;
+ default:
+ break;
+ }
+ fclose(ftmp);
+ }
+ break;
+#endif /* OGOD */
+ case '0':
+ if(isgod==TRUE) {
+ mvaddstr(LINES-2,0,"ENTER CONQUER SUPER-USER PASSWORD:");
+ refresh();
+ (void) get_pass(string);
+ strcpy(passwd,crypt(string,SALT));
+ if(strncmp(passwd,ntn[0].passwd,PASSLTH)!=0) break;
+ mvaddstr(LINES-1,0,"PROMOTE WHAT USER TO DEMI-GOD? ");
+ refresh();
+ get_nname(string);
+ if (strlen(string)!=0 && getpwnam(string)!=NULL) {
+ strncpy(ntn[0].leader,string,LEADERLTH);
+ }
+ }
+ break;
+ case 'p':
+ case 'P':
+ produce();
+ if (isgod==TRUE) reset_god();
+ return;
+ case 'b':
+ case 'B':
+ budget();
+ if(isgod==TRUE) reset_god();
+ return;
+ default:
+ if(isgod==TRUE) reset_god();
+ return;
+ }
+ } /* end of continuous loop */
+}
+
+void
+help()
+{
+ int lineno;
+ FILE *fp, *fopen();
+ int i,xcnt,ycnt,done=FALSE;
+ char line[LINELTH],fname[FILELTH];
+
+ /*find out which helpfile to read in */
+ clear_bottom(0);
+ ycnt = LINES - 3;
+ xcnt = 0;
+ mvaddstr(LINES-4,0,"Help on which topic:");
+ for (i=0;iMAXHELP) {
+ redraw=DONE;
+ makebottom();
+ return;
+ }
+
+ /*open help file*/
+ sprintf(fname,"%s/%s%d",DEFAULTDIR,helpfile,i);
+ if ((fp=fopen(fname,"r"))==NULL) {
+ mvprintw(0,0,"\nerror on read of %s\n",fname);
+ refresh();
+ getch();
+ return;
+ }
+
+ while(done==FALSE){
+ /*read in screen (until DONE statement)*/
+ fgets(line,80,fp);
+ if(strncmp(line,"DONE",4)==0) done=TRUE;
+ else {
+ clear();
+ lineno=0;
+ while(strncmp(line,"END",3)!=0) {
+ if(lineno==0) {
+ /* highlight topic line */
+ for(i=0;line[i]==' ';i++) ;
+ i--; /* back up 1 */
+ standout();
+ mvaddstr(lineno,i,line+i);
+ /* add a blank space on the end */
+ mvaddch(lineno,strlen(line)-1,' ');
+ standend();
+ } else mvaddstr(lineno,0,line);
+ lineno++;
+ if(lineno>LINES-3) strcpy(line,"END");
+ else fgets(line,80,fp);
+ }
+ standout();
+ /* help screen 80 col format; constants needed */
+ mvaddstr(LINES-2,16,"HIT ANY KEY TO CONTINUE HELP SCREENS");
+ mvaddstr(LINES-1,21,"TO END HELP HIT SPACE KEY");
+ standend();
+ refresh();
+ if(getch()==' ') done=TRUE;
+ }
+ }
+ fclose(fp);
+}
+
+/* routine to highlight a line for news display */
+/* if country name is mentioned. By T. Kivinen */
+mvaddstrnahil(li,col,p)
+ int li;
+ int col;
+ char *p;
+{
+ int i,j;
+ move(li,col);
+ for (i=0;p[i];i++) {
+ for (j=0;p[i+j]==ntn[country].name[j];j++);
+ if (ntn[country].name[j]==0 && p[i+j]!='-') {
+ standout();
+ addstr(ntn[country].name);
+ standend();
+ i+=j-1;
+ }
+ else
+ addch(p[i]);
+ }
+}
+
+void
+newspaper()
+{
+ int lineno;
+ FILE *fp, *fopen();
+ int newpage,choice,done;
+ short pagenum,subpage;
+ int i,ydist,xdist;
+ char line[LINELTH],name[FILELTH];
+ int readold;
+ int c;
+
+ /* check to make sure that there are newspapers */
+ if (TURN==0) {
+ clear_bottom(0);
+ errormsg("no news to read");
+ redraw=DONE;
+ makebottom();
+ return;
+ }
+
+ /* set to 1 if news already read and redraw is needed */
+ readold=0;
+ readoldp: /* label to jump if reading old pages */
+ clear_bottom(0);
+ ydist=LINES-3;
+ xdist=0;
+
+ /* check for all newspapers up until the current turn */
+ for (i=TURN-1;i>=0 && i>=TURN-MAXNEWS;i--) {
+ sprintf(line," %d) %s of Year %d",TURN-i,
+ PSEASON(i), YEAR(i));
+ /* align all strings */
+ mvprintw(ydist,xdist,"%s",line);
+ xdist += strlen(line);
+ if (xdist>60) {
+ xdist=0;
+ ydist++;
+ }
+ }
+ mvaddstr(LINES-4,0,"Read Which Newspaper:");
+ standend();
+ refresh();
+
+ /* get the choice */
+ choice = getch() - '0';
+ /* make sure the choice is valid */
+ if (choice<1 || choice > MAXNEWS) {
+ if (readold)
+ return;
+ makebottom();
+ redraw=DONE;
+ return;
+ }
+ /* select page to read */
+ pagenum=1;
+ backpage: /* label for reading previous pages. pagenum set to page */
+ sprintf(name,"%s%d",newsfile,TURN-choice);
+ if ((fp=fopen(name,"r"))==NULL) {
+ clear_bottom(0);
+ sprintf(line,"unable to open news file <%s>",name);
+ errormsg(line);
+ if (readold)
+ return;
+ redraw=DONE;
+ makebottom();
+ return;
+ }
+
+ /*open and read one page */
+ forpage: /* label for reading forward pages. pagenum set to page */
+ subpage=1;
+ newpage=FALSE;
+ line[0]='\0';
+ strcpy(name,"");
+ /* reading to correct page */
+ i=0;
+ done=FALSE;
+ while(done==FALSE && i2) {
+ if (Gaudy) mvaddstrnahil(lineno++,0,line+2);
+ else mvaddstr(lineno++,0,line+2);
+ }
+ } else if(fgets(line,80,fp)==NULL) done=TRUE;
+ else {
+ if(line[1]!='.' && line[1]!=':') {
+ strcpy(name,line);
+ newpage=FALSE;
+ pagenum=todigit(line[0]);
+ subpage=1;
+ } else {
+ if(todigit(line[0])!=pagenum) {
+ newpage=FALSE;
+ pagenum=todigit(line[0]);
+ subpage=1;
+ }
+ else if(lineno>LINES-4) newpage=FALSE;
+ else if(strlen(line)>2) {
+ if (Gaudy) mvaddstrnahil(lineno++,0,line+2);
+ else mvaddstr(lineno++,0,line+2);
+ }
+ }
+ }
+ if(newpage==FALSE||done==TRUE){
+ standout();
+ /* constants since news is 80 col format */
+ mvaddstr(LINES-2,4,"N=next page, P=previous page, 1-5=jump to page, O=Read other news");
+ mvaddstr(LINES-1,12,"ANY OTHER KEY TO ADVANCE -- TO END NEWS HIT SPACE");
+ standend();
+ refresh();
+ stayhere:
+ c=getch();
+ switch (c) {
+ case 'N':
+ case 'n':
+ /* go forward a page */
+ if (subpage!=1 && done!=TRUE) {
+ pagenum++;
+ if (pagenum>5) pagenum=5;
+ goto forpage;
+ } else if (done==TRUE) {
+ goto stayhere;
+ }
+ break;
+ case 'P':
+ case 'p':
+ /* go backward a page */
+ if (subpage==1) pagenum--;
+ pagenum--;
+ if (pagenum<1) pagenum=1;
+ fclose(fp);
+ goto backpage;
+ break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ /* goto a specific page */
+ i=todigit(c);
+ if (i<=pagenum) {
+ pagenum=i;
+ fclose(fp);
+ goto backpage;
+ } else {
+ pagenum=i;
+ goto forpage;
+ }
+ break;
+ case ' ':
+ done=TRUE;
+ break;
+ case 'O':
+ case 'o':
+ readold=1;
+ fclose(fp);
+ goto readoldp;
+ break;
+ }
+ }
+ } while (done==FALSE);
+ fclose(fp);
+}
diff --git a/original/header.h b/original/header.h
new file mode 100644
index 0000000..d29953a
--- /dev/null
+++ b/original/header.h
@@ -0,0 +1,201 @@
+/* conquer : Copyright (c) 1988, 1989 by Ed Barlow.
+ MODIFICATION OF THIS FILE IMPLIES THAT THE MODIFIER WILL ACCEPT
+ A LIMITED USE COPYRIGHT AS FOLLOWS:
+
+
+ 1) This software is copyrighted and protected by law. The
+ sole owner of this software, which hereafter is known as
+ "conquer" is Edward M. Barlow, who hereby grants you a
+ personal, non-exclusive right to use this software.
+ All rights on this software are reserved.
+ 2) conquer may not be redistributed in any form. Any requests for
+ new software shall, for now, be the perogative of the author.
+ 3) loss or damage caused by this software shall not be
+ the responsibility of the author.
+ 4) Ed Barlow or Adam Bryant shall be notified of enhancements to this
+ software via electronic mail and, if there is no response, via
+ US mail to:
+
+ Ed Barlow
+ 115 E 34ths St.
+ NY, NY 10016
+
+ My home phone is 212-679-1439. Use it sparingly and call
+ before 11PM if it is important. Note that I no longer have
+ access to the arpanet and cant really support conquer like
+ I used to. If somebody knows of a cheap (free) way of getting
+ a login somewhere where there is network access - HELP ME!!!!
+ Since i am "volunteering" my time for this project, I am not
+ about to spend millions of dollars to buy network access...
+ I can get a modem for my PC if somebody will help me get
+ something to call into. -ED-
+ 5) no attempt shall be made to make any money from this game or to
+ use any portion of this code to make any money without the
+ authors permission.
+ 6) no attempt shall be made to port this software to any form of
+ personal computer without the permission of Ed Barlow.
+ 7) you agree to use your best efforts to see that any user
+ of conquer complies with the terms and conditions stated above.
+ 8) The above copyright agreement will not be tampered with in any form.
+
+
+ Special thanks to Brian Beuning, Adam Bryant, and any others who helped
+ me by making enhancements and bug reports
+*/
+
+/* --- MODIFICATION IS REQUIRED OF THE FOLLOWING DEFINE STATEMENTS --- */
+#define OWNER "Adam Bryant" /* administrators name */
+#define LOGIN "adb" /* administrators login id. IMPORTANT! */
+ /* only this UID may update. */
+/* #define SYSV /* uncomment this line on a UNIX SYSV machine */
+#define BSD /* uncomment this line on a BSD machine */
+/* #define HPUX /* uncomment for HP-UNIX */
+/*#define XENIX /* this plus SYSV for XENIX machines, untested */
+#define SYSMAIL /* if your system supports mail */
+ /* conquer will notify you about system mail */
+
+/* ------------------MODIFICATION IS OPTIONAL ON THE FOLLOWING----------*/
+#define SPOOLDIR "/usr/spool/mail" /* location of mail spool */
+#define FILELOCK /* if your system supports BSD flock() */
+ /* other file locking is not well implemented */
+/*#define LOCKF /* in addition to FILELOCK if you have lockf */
+ /* this is needed on NFS remote file systems */
+#define TIMELOG /* if your system has the date command */
+
+#define NTOTAL 25 /* max # of nations ( player + npc + monster ) */
+#define MAXPTS 65 /* points for players to buy stuff with at start*/
+#define MAXARM 50 /* maximum number of armies per nation */
+#define MAXNAVY 10 /* maximum number of fleets per nation */
+#define PDEPLETE 30 /* % of armies/sectors depleted without Capitol */
+#define PFINDSCOUT 50 /* percentage chance for capturing scouts */
+
+#define RUNSTOP /* defined to stop update if players are in */
+ /* game -- not recommended with automatic update*/
+#define TRADE /* defined to allow commerce between nations */
+#define TRADEPCT 75 /* percent of sectors with exotic trade goods */
+#define METALPCT 33 /* percent of tradegoods that are metals */
+#define JEWELPCT 33 /* percent of tradegoods that are luxury items */
+#define HIDELOC /* defined if news is not to report sectors */
+#define OGOD /* defined if you wish to enhance god powers. */
+#define REMAKE /* may make a world even if datafile exists. */
+ /* this allows demi-gods the ability to remake */
+ /* their world. */
+#define NOSCORE /* only show full scores to god while in game */
+/* #define CHECKUSER */ /* only allow owner of nation to play it */
+#define REVSPACE 5 /* allow for this many revolts in nation list */
+#define LASTADD 5 /* last turn players may w/out password */
+#define USERLOG /* log users who play a nation */
+#define MASK 037 /* data file protection mask (umask) */
+#define DERVDESG /* allow DERVISH to redesignate in DESERT/ICE */
+#define MONSTER 45 /* defined if pirates/savages/nomads/lzard exist.
+ represents # of sectors of land that need to be
+ in world per pirate/savage/nomad nation */
+#define MORE_MONST /* defined if destroyed monsters are replaced */
+#define NPC 45 /* defined if NPC nations should exist. The numeric
+ represents # of sectors of land that need to be
+ in world per non-player character nation */
+#define CHEAT /* npcs will cheat to keep up - this is a very weak
+ form of cheating. I use good npc algorithms
+ (i think... comments) */
+/*#define NPC_COUNT_ARMIES /* defined if NPC nations can always count armies
+ This makes them to cheat by seeing even VOID and
+ HIDDEN armies when counting enemy units. */
+/*#define NPC_SEE_SECTORS /* defined if NPC nations can always see sectors
+ This allows them to cheat by being allowed to see
+ all sector attributes of even VOID sectors. */
+#define NPC_SEE_CITIES /* defined if NPC nations can always see cities
+ This allows them to cheat by being able to see
+ if a VOID sector is a city/town. Simulates the
+ players ability to tell cities via movement. */
+#define STORMS /* have storms strike fleets */
+#define VULCANIZE /* add in volcano eruptions.... */
+#define PVULCAN 20 /* % chance of eruption each round (see above) */
+#define ORCTAKE 100000L /* comment out if dont want orcs to takeover orc
+ NPCs. else is takeover price in jewels */
+#define MOVECOST 20l /* cost to do a move, get a screen... */
+#define TAKEPOINTS 10 /* spell points for orc takeover */
+#define PMOUNT 40 /* % of land that is mountains */
+#define PSTORM 3 /* % chance that a storm will strike a fleet */
+ /* unless it is in harbor */
+#define CMOVE /* #ifdef NPC; defined for the computer to move
+ for Player nations if they forget to move */
+#define BEEP /* defined if you wish terminal to beep */
+#define HILIGHT /* defined if terminals support inverse video */
+#define RANEVENT 15 /* comment out if you dont want random events
+ weather, tax revolts, and volcanoes all are
+ considered random events. */
+#define PWEATHER 0 /* percent for weather disaster - unimplemented */
+#define PREVOLT 25 /* %/turn that a revolt acutally occurs */
+ /* a turn is 1 season and 25% is a large value */
+#define SPEW /* spew random messages from npcs */
+
+/* -BELOW THIS POINT ARE PARAMETERS YOU MIGHT OPTIONALLY WISH TO CHANGE-*/
+
+/* making these numbers large takes more CPU time */
+#define LANDSEE 2 /* how far you can see from your land */
+#define NAVYSEE 1 /* how far navies can see */
+#define ARMYSEE 2 /* how far armies can see */
+#define PRTZONE 3 /* how far pirates roam from their basecamp */
+#define MEETNTN 2 /* how close nations must be to adjust status */
+
+/* Below taxation rates are in gold talons per unit of product produced */
+#define TAXFOOD 5L
+#define TAXMETAL 8L
+#define TAXGOLD 8L
+#define TAXOTHR 3L /* per food point equivalent */
+/* Town and City/Capitol tax rates based on # of people */
+#define TAXCITY 100L
+#define TAXTOWN 80L
+
+#define SHIPMAINT 4000L /* ship mainatinance cost */
+#define TOMANYPEOPLE 4000L /* too many people in sector - 1/2 repro and
+ 1/2 production; not in cities/caps */
+#define ABSMAXPEOPLE 50000L /* absolute max people in any sector */
+#define MILLSIZE 500L /* min number of people to work a mill */
+#define TOMUCHMINED 50000L /* units mined for 100% chance of metal */
+ /* depletion actual chance is prorated */
+#define DESFOOD 4 /* min food val to redesignate sector */
+#define MAXNEWS 5 /* number of news files stored */
+#define LONGTRIP 100 /* navy trip lth for 100% attrition */
+
+/* min soldiers to take sector - either 75 or based on your civilians */
+#define TAKESECTOR min(500,max(75,(ntn[country].tciv/350)))
+
+#define MAXLOSS 60 /* maximum % of men lost in 1:1 battle */
+#define FINDPERCENT 1 /* percent to find gold/metal in sector */
+#define DESCOST 2000L /* cost to redesignate and the metal cost
+ for cities */
+#define FORTCOST 1000L /* cost to build a fort point */
+#define STOCKCOST 3000L /* cost to build a stockade */
+#define REBUILDCOST 3000L /* cost to remove a ruin */
+#define WARSHPCOST 20000L /* cost to build one light warship */
+#define MERSHPCOST 25000L /* cost to build one light merchant */
+#define GALSHPCOST 25000L /* cost to build one light galley */
+#define N_CITYCOST 4 /* move lost in (un)loading in cities */
+#define SHIPCREW 100 /* full strength crew on a ship */
+#define SHIPHOLD 100L /* storage space of a ship unit */
+#define CITYLIMIT 8L /* % of npc pop in sctr before => city */
+#define CITYPERCENT 20L /* % of npc pop able to be in cities */
+/* note that militia are not considered military below */
+#define MILRATIO 8L /* ratio civ:mil for NPCs */
+#define MILINCAP 8L /* ratio (mil in cap):mil for NPCs */
+#define MILINCITY 10L /* militia=people/MILINCITY in city/cap */
+#define NPCTOOFAR 15 /* npcs should not go this far from cap */
+#define BRIBE 50000L /* amount of gold/1000 men to bribe */
+#define METALORE 7L /* metal/soldier needed for +1% weapons */
+/* strength value for fortifications */
+#define DEF_BASE 10 /* base defense value 2 * in city/caps */
+#define FORTSTR 5 /* percent per fortress point in forts */
+#define TOWNSTR 5 /* percent per fortress point in towns */
+#define CITYSTR 8 /* percent per fortress point in city */
+#define LATESTART 2 /* new player gets 1 point/LATESTART turns,
+ when they start late into the game */
+
+/* starting values for mercenaries */
+#define ST_MMEN (NTOTAL*500) /* a nation may draft ST_MMEN/NTOTAL */
+ /* mercenaries per turn. Added to when */
+ /* armies are disbanded. */
+#define ST_MATT 40 /* mercenary attack bonus */
+#define ST_MDEF 40 /* mercenary defense bonus */
+
+#define VERSION "Version 4" /* version number of the game */
diff --git a/original/io.c b/original/io.c
new file mode 100644
index 0000000..6670d6f
--- /dev/null
+++ b/original/io.c
@@ -0,0 +1,736 @@
+/*io.c*/
+/*Print and io subroutines for game*/
+
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+#include "patchlevel.h"
+
+extern FILE *fexe;
+/*offset of upper left hand corner*/
+extern short xoffset, yoffset;
+/*current cursor postion (relative to 00 in upper corner)*/
+/* position is 2*x,y*/
+extern short xcurs,ycurs;
+extern short redraw; /*redraw map in this turn if redraw is a 1*/
+extern short hilmode,dismode; /*display state*/
+extern short country; /* nation id of owner*/
+
+/************************************************************************/
+/* GETSPACE() - malloc all space needed */
+/************************************************************************/
+void
+getspace()
+{
+ if (sct != NULL) free(sct);
+ sct = (struct s_sector **) m2alloc(MAPX,MAPY,sizeof(struct s_sector));
+ if (occ != NULL) free(occ);
+ occ = (char **) m2alloc(MAPX,MAPY,sizeof(char));
+ if (movecost != NULL) free(movecost);
+ movecost = (short **) m2alloc(MAPX,MAPY,sizeof(short));
+}
+
+#ifdef CONQUER
+char **mapseen;
+
+/************************************************************************/
+/* MAPPREP() - initialize map with what can be seen by nation. */
+/************************************************************************/
+void
+mapprep()
+{
+ int armynum, nvynum;
+ int x,y,i,j;
+
+ /* get space for map */
+ mapseen = (char **) m2alloc(MAPX,MAPY,sizeof(char));
+
+ /* initialize the array */
+ if (country==0 || magic(country,KNOWALL)==TRUE) {
+ armynum = TRUE;
+ } else {
+ armynum = FALSE;
+ }
+ for (x=0;x0) {
+ for(i=(int)P_AXLOC-ARMYSEE;i<=(int)P_AXLOC+ARMYSEE;i++)
+ for(j=(int)P_AYLOC-ARMYSEE;j<=(int)P_AYLOC+ARMYSEE;j++)
+ if (ONMAP(i,j)) {
+ mapseen[i][j]=TRUE;
+ }
+ }
+
+ /* now add sectors visible by navy */
+ for(nvynum=0;nvynumname, TURN);
+ }
+ for(Y=0;Yname, TURN);
+ }
+ for(Y=0;Yname, TURN);
+ }
+ for(Y=0;Yname, TURN);
+ }
+ for(Y=0;Y= SCREEN_X_SIZE-1){
+ if(XREAL=MAPX) xcurs=MAPX-1-xoffset;
+ if(xoffset<0) {
+ xcurs += xoffset;
+ xoffset=0;
+ }
+ if(xcurs<0) {
+ xoffset += xcurs;
+ xcurs=0;
+ }
+ else if(xcurs >= SCREEN_X_SIZE-1) {
+ redraw=PART;
+ xoffset+=15;
+ xcurs-=15;
+ }
+
+ if(ycurs<1){
+ if(YREAL<=0) {
+ yoffset=0;
+ ycurs=0;
+ }
+ else {
+ redraw=PART;
+ ycurs+=15;
+ yoffset-=15;
+ }
+ }
+ else if(ycurs >= SCREEN_Y_SIZE-1){
+ if(YREAL=MAPY) ycurs=MAPY-1-yoffset;
+ if(yoffset<0) {
+ ycurs += yoffset;
+ yoffset=0;
+ }
+ if(ycurs<0) {
+ yoffset += ycurs;
+ ycurs=0;
+ }
+ else if(ycurs >= SCREEN_Y_SIZE-1) {
+ redraw=PART;
+ yoffset+=15;
+ ycurs-=15;
+ }
+ whatcansee();
+}
+#endif /* XYZZY */
+
+/************************************************************************/
+/* CENTERMAP() - redraws screen so that cursor is centered */
+/************************************************************************/
+void
+centermap()
+{
+ int xx,yy;
+ xx=XREAL;
+ yy=YREAL;
+ xoffset = xx - (SCREEN_X_SIZE/2);
+ yoffset = yy - (SCREEN_Y_SIZE/2);
+ if (xoffset<0)
+ xoffset=0;
+ if (yoffset<0)
+ yoffset=0;
+ xcurs= xx-xoffset;
+ ycurs= yy-yoffset;
+ whatcansee();
+}
+
+/************************************************************************/
+/* JUMP_TO() - move screen position to a specific location */
+/* home indicates just go to capitol sector. */
+/************************************************************************/
+void
+jump_to(home)
+ int home;
+{
+ int i,j,done;
+ static int next_ntn;
+
+ /* find location to jump to */
+ if (home) {
+ if (country==0) {
+ /* check if in sequence */
+ if ((XREAL!=ntn[next_ntn].capx)
+ ||(YREAL!=ntn[next_ntn].capy)) {
+ next_ntn= 0;
+ }
+ /* find next capitol */
+ done = FALSE;
+ do {
+ next_ntn++;
+ if (next_ntn==NTOTAL) {
+ j = 0;
+ for(i=0;icapx;
+ j = curntn->capy;
+ }
+ } else {
+ /* entered location */
+ clear_bottom(0);
+ mvaddstr(LINES-3,0,"Jump to what X location? ");
+ refresh();
+ i = get_number();
+ if (i==(-1)) return;
+ if (i>=MAPX) {
+ errormsg("That location is out of this world!");
+ return;
+ }
+ mvaddstr(LINES-2,0,"Jump to what Y location? ");
+ refresh();
+ j = get_number();
+ if (j==(-1)) return;
+ if (j>=MAPY) {
+ errormsg("That location is out of this world!");
+ return;
+ }
+ }
+ /* now center location about given position */
+ xcurs = i;
+ ycurs = j;
+ xoffset = yoffset = 0;
+ centermap();
+}
+
+/************************************************************************/
+/* PRINTSCORE() - like it says */
+/************************************************************************/
+void
+printscore()
+{
+ int i;
+ int nationid; /*current nation id */
+#ifdef TIMELOG
+ FILE *timefp, *fopen();
+ char timestr[LINELTH+1];
+#endif /* TIMELOG */
+
+ printf("Conquer %s.%s: %s of Year %d, Turn %d\n",VERSION,PATCHLEVEL,
+ PSEASON(TURN),YEAR(TURN), TURN);
+#ifdef TIMELOG
+ if ((timefp=fopen(timefile,"r"))!=NULL) {
+ fgets(timestr, 50, timefp);
+ printf("Last Update: %s", timestr);
+ fclose(timefp);
+ }
+#endif /* TIMELOG */
+ printf("id name race class align score talons military civilians sect\n");
+ for (nationid=1; nationid0) {
+#ifdef CONQUER
+ if(isupd==0) {
+ if(slaver==TRUE){
+ mvprintw(LINES-2,20,"CIVILIANS ABANDON SECTOR (%d slaves)",slaves);
+ }else{
+ mvaddstr(LINES-2,20,"CIVILIANS ABANDON SECTOR");
+ }
+ }
+#endif /* CONQUER */
+ for(i=x-2;i<=x+2;i++) for(j=y-2;j<=y+2;j++)
+ if(ONMAP(i,j)
+ &&(ntn[sct[i][j].owner].race==ntn[sct[x][y].owner].race)) {
+ people_to_add = sct[x][y].people / count;
+ /* don't show until next turn if player move */
+ if(isupd==0) SADJCIV3;
+ else sct[x][y].people += people_to_add;
+ }
+ } else {
+ sct[x][y].people /= 2;
+ for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++)
+ if(ONMAP(i,j)
+ &&(ntn[sct[i][j].owner].race==ntn[sct[x][y].owner].race))
+ count++;
+ if(count>0) {
+#ifdef CONQUER
+ if(isupd==0) mvaddstr(LINES-2,20,"PEOPLE FLEE SECTOR AND HALF DIE");
+#endif /* CONQUER */
+ for(i=x-4;i<=x+4;i++) for(j=y-4;j<=y+4;j++)
+ if(ONMAP(i,j)
+ &&(ntn[sct[i][j].owner].race==ntn[sct[x][y].owner].race)) {
+ sct[i][j].people += sct[x][y].people / count;
+ if(isupd==0) SADJCIV2;
+ }
+ }
+#ifdef CONQUER
+ else if(isupd==0) mvaddstr(LINES-2,20,"PEOPLE IN SECTOR DIE");
+#endif /* CONQUER */
+ }
+
+ sct[x][y].people = slaves;
+ if(isupd==0) SADJCIV;
+ sct[x][y].fortress=0;
+ /*SINFORT;*/
+ if(tofood( &sct[XREAL][YREAL],sct[XREAL][YREAL].owner)!=0) {
+ DEVASTATE(x,y);
+ if(isupd==0) SADJDES2;
+ }
+ country=svcountry;
+}
+#ifdef ADMIN
+/************************************************************************/
+/* READMAP() - read a map in from map files */
+/* returns TRUE for success, FALSE for fail */
+/************************************************************************/
+int
+readmap()
+{
+ FILE *mapfile;
+ char line[BIGLTH+1];
+ register int x,y;
+
+ /* read in ele.map */
+ strcpy(line,scenario);
+ strcat(line,".ele");
+ if ((mapfile=fopen(line,"r"))==NULL) {
+ fprintf(stderr,"error on read of %s file\n",line);
+ return(TRUE);
+ } else fprintf(stderr,"reading elevation map file from %s\n",line );
+
+ y=0;
+ while( TRUE ) {
+ if(fgets( line, 128, mapfile )==NULL) break;
+ for(x=0;x=MAPY) break;
+ }
+ fprintf(stderr,"done reading %d lines of %d characters\n",y,strlen(line));
+
+ /* read in veg.map */
+ strcpy(line,scenario);
+ strcat(line,".veg");
+ if ((mapfile=fopen(line,"r"))==NULL) {
+ fprintf(stderr,"error on read of %s file\n",line);
+ return(TRUE);
+ } else fprintf(stderr,"reading vegetation map file from %s\n",line );
+ y=0;
+ while( TRUE ) {
+ if(fgets( line, BIGLTH, mapfile )==NULL) break;
+ for(x=0;x=MAPY) break;
+ }
+ fprintf(stderr,"done reading %d lines of %d characters\n",y,strlen(line));
+
+ return(TRUE);
+}
+#endif /* ADMIN */
+
+/*********************************************************************/
+/* M2ALLOC() - two dimensional array allocator (because C is stupid) */
+/*********************************************************************/
+char **m2alloc(nrows, ncols, entrysize)
+int nrows; /* row dimension */
+int ncols; /* column dimension */
+int entrysize; /* # bytes in items to be stored */
+{
+ char **baseaddr;
+ int j;
+ entrysize *= ncols;
+ baseaddr = (char **)
+ malloc( (unsigned) (nrows*(sizeof(char *)+entrysize)));
+
+ if( baseaddr == (char **) NULL ) {
+ printf("OOPS - cannot allocate %d by %d blocks of %d bytes\n",nrows,ncols,entrysize);
+ abrt();
+ }
+ if(nrows>0){
+ *baseaddr = (char *) (baseaddr + nrows);
+ for(j=1; j 0) {
+ count--;
+ }
+ } else if (ch=='\025') {
+ /* make sure that ^U works */
+ count=0;
+ } else if (ch=='\n' || ch=='\r') {
+ done = TRUE;
+ } else if (ch != '\0') {
+ /* add any other character to the string */
+ if (count < PASSLTH) {
+ /* don't try adding too many */
+ str[count]= ch;
+ }
+ count++;
+ }
+ }
+ /* truncate too long a password and end others properly */
+ if (count > PASSLTH) {
+ str[PASSLTH] = '\0';
+ } else {
+ str[count] = '\0';
+ }
+ return(count);
+}
diff --git a/original/magic.c b/original/magic.c
new file mode 100644
index 0000000..c7949ef
--- /dev/null
+++ b/original/magic.c
@@ -0,0 +1,1000 @@
+/*conquer : Copyright (c) 1988 by Ed Barlow.
+ * I spent a long time writing this code & I hope that you respect this.
+ * I give permission to alter the code, but not to copy or redistribute
+ * it without my explicit permission. If you alter the code,
+ * please document changes and send me a copy, so all can have it.
+ * This code, to the best of my knowledge works well, but it is my first
+ * 'C' program and should be treated as such. I disclaim any
+ * responsibility for the codes actions (use at your own risk). I guess
+ * I am saying "Happy gaming", and am trying not to get sued in the process.
+ * Ed
+ */
+
+/*create a new login for a new player*/
+#include
+#include
+#include
+#include
+#include
+#include "header.h"
+#include "data.h"
+
+extern short country;
+extern short redraw;
+extern FILE *fexe;
+extern FILE *fnews;
+
+/*give player one new magic power in current magic (powers)*/
+/*do nothing if that player has that power or it is not permitted*/
+/*getmagic() returns the value of the power gained, and stores it in power*/
+
+long
+getmagic(type)
+int type;
+{
+ long newpower;
+ int start,end;
+ switch(type){
+ case M_MGK:
+ start=S_MGK;
+ end=E_MGK;
+ break;
+ case M_CIV:
+ start=S_CIV;
+ end=E_CIV;
+ break;
+ case M_MIL:
+ start=S_MIL;
+ end=E_MIL;
+ break;
+ default:
+ printf("fatal error in num_powers");
+ abrt();
+ }
+ newpower=powers[start+(rand()%end)];
+ if(newpower==0) {
+ printf("ILLEGAL POWER");
+ abrt();
+ }
+
+ if((newpower==WARRIOR)||(newpower==CAPTAIN)||(newpower==WARLORD)){
+ if(magic(country,WARRIOR)!=TRUE){
+ curntn->powers|=WARRIOR;
+ return(WARRIOR);
+ }
+ else if(magic(country,CAPTAIN)!=TRUE){
+ curntn->powers|=CAPTAIN;
+ return(CAPTAIN);
+ }
+ else if(magic(country,WARLORD)!=TRUE){
+ curntn->powers|=WARLORD;
+ return(WARLORD);
+ }
+ else return(0L);
+ }else if((newpower==MI_MONST) ||(newpower==AV_MONST) ||(newpower==MA_MONST)){
+ if(curntn->race!=ORC) return(0L);
+ if(magic(country,MI_MONST)!=TRUE){
+ curntn->powers|=MI_MONST;
+ return(MI_MONST);
+ }
+ else if(magic(country,AV_MONST)!=TRUE){
+ curntn->powers|=AV_MONST;
+ return(AV_MONST);
+ }
+ else if(magic(country,MA_MONST)==TRUE){
+ curntn->powers|=MA_MONST;
+ return(MA_MONST);
+ }
+ else return(0L);
+ }else if(newpower==CAVALRY){
+ if(curntn->race==ORC) return(0L);
+ if(isnotpc(curntn->active)) return(0L); /*npc nation*/
+ if(magic(country,newpower)==TRUE) return(0L);
+ curntn->powers|=newpower;
+ return(newpower);
+ }else if(newpower==URBAN){
+ if(magic(country,BREEDER)==TRUE) return(0L);
+ if(magic(country,newpower)==TRUE) return(0L);
+ curntn->powers|=newpower;
+ return(newpower);
+ }else if(newpower==RELIGION){
+ if(curntn->race==ORC) return(0L);
+ if(magic(country,newpower)==TRUE) return(0L);
+ curntn->powers|=newpower;
+ return(newpower);
+ }else if(newpower==KNOWALL){
+#ifdef OGOD
+#ifdef HIDELOC
+ /* only god should have KNOWALL if sectors hidden */
+ if(country!=0) return(0L);
+#endif
+#endif
+ if(magic(country,KNOWALL)==TRUE) return(0L);
+ curntn->powers|=KNOWALL;
+ return(KNOWALL);
+ }else if((newpower==SLAVER)
+ ||(newpower==DERVISH)
+ ||(newpower==HIDDEN)
+ ||(newpower==ARCHITECT)
+ ||(newpower==THE_VOID)
+ ||(newpower==ARCHER)){
+ if((magic(country,newpower)==TRUE)
+ ||((newpower==DERVISH)&&(magic(country,DESTROYER)==TRUE)))
+ return(0L);
+ curntn->powers|=newpower;
+ return(newpower);
+ }else if(newpower==DESTROYER){
+ if((curntn->race!=ELF)
+ &&(magic(country,DESTROYER)!=TRUE)
+ &&(magic(country,DERVISH)!=TRUE)){
+ curntn->powers|=DESTROYER;
+ return(DESTROYER);
+ }
+ return(0L);
+ }else if(newpower==VAMPIRE){
+ if((curntn->race!=ELF)&&(magic(country,VAMPIRE)!=TRUE)){
+ curntn->powers|=VAMPIRE;
+ return(VAMPIRE);
+ }
+ return(0L);
+ }else if(newpower==MINER){
+ if((curntn->race!=ELF)&&(curntn->race!=DWARF)&&(magic(country,MINER)!=TRUE)){
+ curntn->powers|=MINER;
+ return(MINER);
+ }
+ return(0L);
+ }else if(newpower==STEEL){
+ if(magic(country,STEEL)==TRUE) return(0L);
+ if(magic(country,MINER)!=TRUE) return(0L);
+ curntn->powers|=STEEL;
+ return(STEEL);
+ }else if(newpower==BREEDER){
+ if(magic(country,URBAN)==TRUE) return(0L);
+ if(magic(country,BREEDER)==TRUE) return(0L);
+ if(curntn->race!=ORC) return(0L);
+ curntn->powers|=BREEDER;
+ return(BREEDER);
+ }
+ else if(isnotpc(curntn->active)) {
+ return(0L); /* remaining powers only for pc's */
+ } else if((newpower==NINJA)
+ ||(newpower==SLAVER)
+ ||(newpower==SAILOR)
+ ||(newpower==DEMOCRACY)
+ ||(newpower==ROADS)
+ ||(newpower==SAPPER)
+ ||(newpower==ARMOR)
+ ||(newpower==AVIAN)){
+ if(magic(country,newpower)==TRUE) return(0L);
+ curntn->powers|=newpower;
+ return(newpower);
+ }
+ else if((newpower==SUMMON)||(newpower==WYZARD)||(newpower==SORCERER)){
+ /* dwarves may not cast spells */
+ if(curntn->race==DWARF) return(0L);
+ if(magic(country,SUMMON)!=TRUE) {
+ curntn->powers|=SUMMON;
+ return(SUMMON);
+ } else if(magic(country,WYZARD)!=TRUE) {
+ curntn->powers|=WYZARD;
+ return(WYZARD);
+ } else if(magic(country,SORCERER)!=TRUE) {
+ curntn->powers|=SORCERER;
+ return(SORCERER);
+ } else return(0L);
+ } else return(0L);
+}
+#ifdef CONQUER
+/*form to interactively get a magic power*/
+void
+domagic()
+{
+ int county, countx, done=FALSE, loop=0, i,type;
+ long price,x;
+#ifdef OGOD
+ void god_magk();
+#endif /* OGOD */
+
+ short isgod=0;
+ if(country==0) {
+ isgod=TRUE;
+ if (get_god()) return;
+ }
+
+ clear();
+ while(done==FALSE){
+ done=TRUE;
+ move(0,0);
+ clrtobot();
+ county=3;
+ countx=0;
+ redraw=FULL;
+ standout();
+ mvprintw(0,(COLS/2)-15,"MAGIC POWERS FOR %s",curntn->name);
+ mvprintw(county++,30,"1) %d military powers: %ld jewels",
+ num_powers(country,M_MIL) ,getmgkcost(M_MIL,country));
+ mvprintw(county++,30,"2) %d civilian powers: %ld jewels",
+ num_powers(country,M_CIV) ,getmgkcost(M_CIV,country));
+ mvprintw(county++,30,"3) %d magic powers: %ld jewels",
+ num_powers(country,M_MGK),getmgkcost(M_MGK,country));
+
+ price = getmgkcost(M_MIL,country);
+ if(price > getmgkcost(M_CIV,country))
+ price = getmgkcost(M_CIV,country);
+ if(price > getmgkcost(M_MGK,country))
+ price = getmgkcost(M_MGK,country);
+
+ standend();
+ county=3;
+ /*print the powers that you have*/
+ i=0;
+ while( powers[i] != 0 ){
+ if(magic(country,powers[i])==TRUE)
+ mvprintw(county++,countx,"you have power %s",*(pwrname+i));
+ i++;
+ if (county > 18) {
+ county=7;
+ countx=40;
+ }
+ }
+
+ if(county<=7) county=8;
+ else if(countx == 40) county = 20;
+ else county++;
+ standout();
+ mvprintw(county++,0,"YOU HAVE %ld JEWELS IN YOUR TREASURY",curntn->jewels);
+#ifdef OGOD
+ if (isgod==TRUE) {
+ mvaddstr(county++,0,"DO YOU WISH TO CHANGE THIS NATION'S POWERS? [yn]");
+ standend();
+ refresh();
+ if (getch()=='y') god_magk();
+ } else
+#endif /* OGOD */
+ if(price <= curntn->jewels){
+
+ mvaddstr(county++,0,"DO YOU WISH TO BUY A RANDOM NEW POWER? [yn]");
+ standend();
+ refresh();
+ if(getch()=='y'){
+ done=FALSE;
+ mvaddstr(county++,0,"ENTER SELECTION (1,2,3):");
+ refresh();
+ type = getch() - '0';
+ if(type==M_MIL || type==M_CIV || type==M_MGK){
+ price=getmgkcost(type,country);
+ if(curntn->jewels>=price) {
+ loop = 0;
+ while(loop++ < 500) if((x=getmagic(type))!=0){
+ curntn->jewels -= price;
+ CHGMGK;
+ exenewmgk(x);
+ refresh();
+ if (isgod==TRUE) reset_god();
+ break;
+ }
+ if (loop >= 500)
+ errormsg("You have too many powers!");
+ } else errormsg("CAN'T AFFORD A NEW POWER");
+ } else errormsg("BAD SELECTION");
+ }
+ } else {
+ mvaddstr(LINES-1,0,"CAN'T AFFORD A NEW POWER");
+ clrtoeol();
+ mvaddstr(LINES-1,60,"PRESS ANY KEY");
+ refresh();
+ standend();
+ getch();
+ }
+#ifdef ORCTAKE
+ if((curntn->race==ORC)&&(curntn->jewels>=ORCTAKE)&&(curntn->spellpts>=TAKEPOINTS))
+ done |= orctake(&county);
+#endif /* ORCTAKE */
+ }
+ if(isgod==TRUE) reset_god();
+}
+#endif /* CONQUER */
+#ifdef ORCTAKE
+/*do magic for both npcs and pcs in update*/
+/*if target is 0 then it is update and target will be picked randomly*/
+int
+takeover(percent,target)
+int percent,target;
+{
+ int loop=1,y,save,isupdate=0;
+ save=country;
+ if(target==country) return(0);
+ if(target==0) isupdate=1;
+ country=target;
+ if(rand()%100dstatus[country]dstatus[country]!=UNMET)
+ &&(country!=save))
+ loop=TRUE;
+ else if(y>=500) {
+ country=save;
+ return(0);
+ }
+ }
+ sct[ntn[country].capx][ntn[country].capy].owner=save;
+ if(isupdate==1){
+ printf("nation %s magically taken over by %s\n",ntn[country].name,ntn[save].name);
+ fprintf(fnews,"1.\tnation %s magically taken over by %s\n",ntn[country].name,ntn[save].name);
+ }
+ else {
+ DESTROY;
+ if ((fnews=fopen("/dev/null","w"))==NULL){
+ printf("error opening null file\n");
+ exit(FAIL);
+ }
+ }
+ destroy(country);
+ sct[ntn[country].capx][ntn[country].capy].designation=DCITY;
+ if(isupdate!=1) fclose(fnews);
+ y=country;
+ country=save;
+ return(y);
+ }
+ country=save;
+ return(0);
+}
+#endif /* ORCTAKE */
+
+/*execute new magic*/
+void
+exenewmgk(newpower)
+long newpower;
+{
+ short x,armynum;
+#ifdef ADMIN
+ short y;
+#endif
+ if(newpower==WARRIOR) {
+ curntn->aplus+=10;
+ curntn->dplus+=10;
+ return;
+ }
+ if(newpower==CAPTAIN) {
+ curntn->aplus+=10;
+ curntn->dplus+=10;
+ return;
+ }
+ if(newpower==WARLORD) {
+ curntn->aplus+=10;
+ curntn->dplus+=10;
+ return;
+ }
+ if(newpower==RELIGION) {
+ if(curntn->race==ORC) {
+ printf("ORCS CANT HAVE RELIGION POWER\n");
+ abrt();
+ } else if(curntn->repro<=8){
+ curntn->repro+=2;
+ } else if(curntn->repro==9){
+ curntn->repro=10;
+ curntn->dplus+=5;
+ } else if(curntn->repro>=10){
+ curntn->dplus+=10;
+ }
+ return;
+ }
+ if(newpower==DESTROYER) {
+/* this ifdef is so that destroyer only takes place in an update */
+#ifdef ADMIN
+ for(x=(int)curntn->capx-3;x<=(int)curntn->capx+3;x++) {
+ for(y=(int)curntn->capy-3;y<=(int)curntn->capy+3;y++){
+ if((ONMAP(x,y))
+ &&(sct[x][y].altitude!=WATER)
+#ifdef DERVDESG
+ &&((rand()%2)==0)
+#else
+ &&(tofood( &sct[x][y],0)<6)
+#endif /* DERVDESG */
+ &&((x!=curntn->capx)
+ ||(y!=curntn->capy))){
+ sct[x][y].vegetation=DESERT;
+ sct[x][y].designation=DNODESIG;
+ }
+ }
+ }
+ fprintf(fnews,"1.\tnation %s gets destroyer power: land turns to desert\n",curntn->name);
+#endif /* ADMIN */
+ updmove(curntn->race,country);
+ return;
+ }
+ if(newpower==DERVISH) {
+ updmove(curntn->race,country);
+ return;
+ }
+ if((newpower==MI_MONST)
+ ||(newpower==AV_MONST)
+ ||(newpower==MA_MONST)
+ ||(newpower==KNOWALL)
+ ||(newpower==HIDDEN)
+ ||(newpower==THE_VOID)
+ ||(newpower==ARCHITECT))
+ return;
+ if(newpower==MINER) {
+ curntn->mine_ability+=25;
+ return;
+ }
+ if(newpower==VAMPIRE) {
+ curntn->aplus-=35;
+ curntn->dplus-=35;
+ for(armynum=0;armynumrace==ORC) {
+ x=curntn->repro;
+ if(curntn->repro>=14){
+ curntn->maxmove+=3;
+ }
+ else if(curntn->repro>11){
+ curntn->maxmove+= x-11;
+ curntn->repro=14;
+ }
+ else curntn->repro+=3;
+ }
+ else if(curntn->repro<=9){
+ curntn->repro+=3;
+ }
+ else {
+ curntn->maxmove+=2*(curntn->repro-9);
+ curntn->repro=12;
+ }
+ return;
+ }
+ if(newpower==BREEDER) {
+ x=curntn->repro;
+ if(curntn->repro>=14){
+ curntn->maxmove+=3;
+ }
+ else if(curntn->repro>11){
+ curntn->maxmove+= x-11;
+ curntn->repro=14;
+ }
+ else curntn->repro+=3;
+ curntn->dplus-=10;
+ curntn->aplus-=10;
+ return;
+ }
+ if(newpower==DEMOCRACY){
+ curntn->maxmove+=1;
+ curntn->repro+=1;
+ curntn->dplus+=10;
+ curntn->aplus+=10;
+ return;
+ }
+ if(newpower==ROADS){
+ curntn->maxmove+=4;
+ return;
+ }
+ if(newpower==ARMOR){
+ curntn->maxmove-=3;
+ if( curntn->maxmove<4) curntn->maxmove=4;
+ curntn->dplus+=20;
+ }
+ if((newpower==NINJA)
+ ||(newpower==STEEL)
+ ||(newpower==ARCHER)
+ ||(newpower==CAVALRY)
+ ||(newpower==SAILOR)
+ ||(newpower==SUMMON)
+ ||(newpower==WYZARD)
+ ||(newpower==SORCERER)
+ ||(newpower==SAPPER)
+ ||(newpower==AVIAN)){ /* these powers are only for pc's */
+ return;
+ }
+}
+#ifdef CONQUER
+/* returns 0 if summon occurred, 1 else */
+void
+dosummon()
+{
+ int x,count,i,armynum;
+ long e_cost;
+ int newtype,s_cost;
+ char line[LINELTH+1],ch;
+
+ x=0;
+ count=LINES-4;
+ clear_bottom(0);
+ mvaddstr(count,x,"options:");
+ x+=9;
+ for(i=MINMONSTER;i<=MAXMONSTER;i++){
+ if(unitvalid(i)==TRUE) {
+ mvprintw(count,x+2,"%s",*(shunittype+(i%UTYPE)));
+ mvprintw(count,x,"(%c)",*(shunittype+(i%UTYPE))[0]);
+ x+=7;
+ if(x>COLS-20){
+ x=0;
+ count++;
+ }
+ }
+ }
+ count++;
+ mvaddstr(count++,0,"what type of unit do you want to raise:");
+ refresh();
+ ch=getch();
+ for(newtype=MINMONSTER;newtype<=MAXMONSTER;newtype++){
+ if( *(shunittype+(newtype%UTYPE))[0] == ch ) break;
+ }
+
+ if (newtype==MAXMONSTER+1) {
+ /* quick exit */
+ return;
+ }
+ if(unitvalid(newtype)==FALSE) {
+ beep();
+ clear_bottom(0);
+ errormsg("you are unable to summon that monster");
+ return;
+ }
+
+ s_cost= *(u_encost+(newtype%UTYPE));
+ if(s_cost > curntn->spellpts) {
+ sprintf(line,"you dont have %d spell points",s_cost);
+ clear_bottom(0);
+ errormsg(line);
+ return;
+ }
+
+ e_cost= (long) *(u_encost+(newtype%UTYPE)) * *(unitminsth+(newtype%UTYPE));
+ if(e_cost > curntn->tgold) {
+ sprintf(line,"you dont have %ld gold talons in your treasury",e_cost);
+ clear_bottom(0);
+ errormsg(line);
+ return;
+ }
+
+ armynum=0;
+ while(armynum