--- /dev/null
+vms-empire
+*.o
+empsave.dat
--- /dev/null
+chuck@amdahl.com (Chuck Simmons)
--- /dev/null
+
+ EMPIRE GENERAL PUBLIC LICENSE
+
+ Copyright (C) 1987, 1988 Chuck Simmons
+ Copyleft (GNU) 1987, 1988 Chuck Simmons
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license, but changing it is not allowed. You can also
+ use this wording to make the terms for other programs.
+
+ The license agreements of most software companies keep you at the
+mercy of those companies. By contrast, our general public license is
+intended to give everyone the right to share EMPIRE. To make sure that
+you get the rights we want you to have, we need to make restrictions
+that forbid anyone to deny you these rights or to ask you to surrender
+the rights. Hence this license agreement.
+
+ Specifically, we want to make sure that you have the right to give
+away copies of EMPIRE, that you receive source code or else can get it
+if you want it, that you can change EMPIRE or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights. For example, if you distribute
+copies of EMPIRE, you must give the recipients all the rights that you
+have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ Also, for our own protection, we must make certain the4\90everyone
+finds out that there is no warranty for EMPIRE. If EMPIRE is modified by
+someone else and passed on, we want its recipients to know that what
+they have is not what we distributed, so that any problems introduced
+by others will not reflect on our reputation.
+
+ Therefore we (Chuck Simmons) make the following terms which say what
+you must do to be allowed to distribute or change EMPIRE.
+
+
+ COPYING POLICIES
+
+ 1. You may copy and distribute verbatim copies of EMPIRE source code
+as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy a valid copyright notice "Copyright
+(C) 1988 Chuck Simmons" (or with whatever year is appropriate); keep
+intact the notices on all files that refer to this License Agreement
+and to the absence of any warranty; and give any other recipients of
+the EMPIRE program a copy of this License Agreement along with the
+program. You may charge a distribution fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of EMPIRE or any portion of it,
+and copy and distribute such modifications under the terms of
+Paragraph 1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish,
+ that in whole or in part contains or is a derivative of EMPIRE or
+ any part thereof, to be licensed at no charge to all third
+ parties on terms identical to those contained in this License
+ Agreement (except that you may choose to grant more extensive
+ warranty protection to some or all third parties, at your option).
+
+ c) You may charge a distribution fee for the physical act of
+ transferring a copy, and you may at your option offer warranty
+ protection in exchange for a fee.
+
+Mere aggregation of another unrelated program with this program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other program under the scope of these terms.
+
+ 3. You may copy and distribute EMPIRE (or a portion or derivative of it,
+under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal
+ shipping charge) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+For an executable file, complete source code means all the source code for
+all modules it contains; but, as a special exception, it need not include
+source code for modules which are standard libraries that accompany the
+operating system on which the executable file runs.
+
+ 4. You may not copy, sublicense, distribute or transfer EMPIRE
+except as expressly provided under this License Agreement. Any attempt
+otherwise to copy, sublicense, distribute or transfer EMPIRE is void and
+your rights to use the program under this License agreement shall be
+automatically terminated. However, parties who have received computer
+software programs from you with this License Agreement will not have
+their licenses terminated so long as such parties remain in full compliance.
+
+ 5. If you wish to incorporate parts of EMPIRE into other free programs
+whose distribution conditions are different, write to Chuck Simmons
+at 1250 E. Arques Ave (MS 269), Box 3470, Sunnyvale, CA 94088-3470,
+USA. We have not yet worked out a simple rule that can be stated here,
+but we will often permit this. We will be guided by the two goals of
+preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software.
+
+Your comments and suggestions about our licensing policies and our
+software are welcome! This contract was based on the contract made by
+the Free Software Foundation. Please contact the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or call (617)
+876-3296 for details on copylefted materal in general, or contact us
+via electronic mail at amdahl!chuck.
+
+(Please note that the Free Software Foundation is in no way associated
+with EMPIRE, and any lack of quality inherent in EMPIRE should not
+reflect on the reputation of that noble enterprise.)
+
+
+ NO WARRANTY
+
+ BECAUSE EMPIRE IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO
+WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING, CHUCK SIMMONS AND/OR OTHER PARTIES PROVIDE
+EMPIRE "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 EMPIRE IS WITH YOU. SHOULD EMPIRE PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL CHUCK SIMMONS
+AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE EMPIRE AS PERMITTED
+ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST
+MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS
+OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS)
+EMPIRE, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES,
+OR FOR ANY CLAIM BY ANY OTHER PARTY.
--- /dev/null
+/* %W% %G% %U% - (c) Copyright 1987, 1988 Chuck Simmons */
+
+/*
+ * Copyright (C) 1987, 1988 Chuck Simmons
+ *
+ * See the file COPYING, distributed with empire, for restriction
+ * and warranty information.
+ */
+
+/*
+attack.c -- handle an attack between two pieces. We do everything from
+fighting it out between the pieces to notifying the user who won and
+killing off the losing object. Somewhere far above, our caller is
+responsible for actually removing the object from its list and actually
+updating the player's view of the world.
+
+Find object being attacked. If it is a city, attacker has 50% chance
+of taking city. If successful, give city to attacker. Otherwise
+kill attacking piece. Tell user who won.
+
+If attacking object is not a city, loop. On each iteration, select one
+piece to throw a blow. Damage the opponent by the strength of the blow
+thrower. Stop looping when one object has 0 or fewer hits. Kill off
+the dead object. Tell user who won and how many hits her piece has left,
+if any.
+*/
+
+#include "empire.h"
+#include "extern.h"
+
+void
+attack_city (att_obj, loc)
+piece_info_t *att_obj;
+long loc;
+{
+ city_info_t *cityp;
+ int att_owner, city_owner;
+
+ cityp = find_city (loc);
+ ASSERT (cityp);
+
+ att_owner = att_obj->owner;
+ city_owner = cityp->owner;
+
+ if (irand (2) == 0) { /* attack fails? */
+ if (att_owner == USER) {
+ comment ("The scum defending the city crushed your attacking blitzkrieger.",0,0,0,0,0,0,0,0);
+ ksend ("The scum defending the city crushed your attacking blitzkrieger.\n",0,0,0,0,0,0,0,0); //kermyt
+ }
+ else if (city_owner == USER) {
+ ksend ("Your city at %d is under attack.\n",loc_disp(cityp->loc),0,0,0,0,0,0,0); //kermyt
+ comment ("Your city at %d is under attack.",loc_disp(cityp->loc),0,0,0,0,0,0,0);
+ }
+ kill_obj (att_obj, loc);
+ }
+ else { /* attack succeeded */
+ kill_city (cityp);
+ cityp->owner = att_owner;
+ kill_obj (att_obj, loc);
+
+ if (att_owner == USER) {
+ ksend ("City at %d has been subjugated!\n",loc_disp(cityp->loc),0,0,0,0,0,0,0); //kermyt
+ error ("City at %d has been subjugated!",loc_disp(cityp->loc),0,0,0,0,0,0,0);
+
+ extra ("Your army has been dispersed to enforce control.",0,0,0,0,0,0,0,0);
+ ksend ("Your army has been dispersed to enforce control.\n",0,0,0,0,0,0,0,0);
+ set_prod (cityp);
+ }
+ else if (city_owner == USER) {
+ ksend("City at %d has been lost to the enemy!\n",loc_disp(cityp->loc),0,0,0,0,0,0,0); //kermyt
+ comment ("City at %d has been lost to the enemy!",loc_disp(cityp->loc),0,0,0,0,0,0,0);
+ }
+ }
+ /* let city owner see all results */
+ if (city_owner != UNOWNED) scan (MAP(city_owner), loc);
+}
+
+/*
+Attack a piece other than a city. The piece could be anyone's.
+First we have to figure out what is being attacked.
+*/
+
+void
+attack_obj (att_obj, loc)
+piece_info_t *att_obj;
+long loc;
+{
+ void describe(), survive();
+
+ piece_info_t *def_obj; /* defender */
+ int owner;
+
+ def_obj = find_obj_at_loc (loc);
+ ASSERT (def_obj != NULL); /* can't find object to attack? */
+
+ if (def_obj->type == SATELLITE) return; /* can't attack a satellite */
+
+ while (att_obj->hits > 0 && def_obj->hits > 0) {
+ if (irand (2) == 0) /* defender hits? */
+ att_obj->hits -= piece_attr[def_obj->type].strength;
+ else def_obj->hits -= piece_attr[att_obj->type].strength;
+ }
+
+ if (att_obj->hits > 0) { /* attacker won? */
+ describe (att_obj, def_obj, loc);
+ owner = def_obj->owner;
+ kill_obj (def_obj, loc); /* kill loser */
+ survive (att_obj, loc); /* move attacker */
+ }
+ else { /* defender won */
+ describe (def_obj, att_obj, loc);
+ owner = att_obj->owner;
+ kill_obj (att_obj, loc);
+ survive (def_obj, loc);
+ }
+ /* show results to first killed */
+ scan (MAP(owner), loc);
+}
+
+void
+attack (att_obj, loc)
+piece_info_t *att_obj;
+long loc;
+{
+ if (map[loc].contents == '*') /* attacking a city? */
+ attack_city (att_obj, loc);
+ else attack_obj (att_obj, loc); /* attacking a piece */
+}
+
+/*
+Here we look to see if any cargo was killed in the attack. If
+a ships contents exceeds its capacity, some of the survivors
+fall overboard and drown. We also move the survivor to the given
+location.
+*/
+
+void
+survive (obj, loc)
+piece_info_t *obj;
+long loc;
+{
+ while (obj_capacity (obj) < obj->count)
+ kill_obj (obj->cargo, loc);
+
+ move_obj (obj, loc);
+}
+
+void
+describe (win_obj, lose_obj, loc)
+piece_info_t *win_obj, *lose_obj;
+long loc;
+{
+ char buf[STRSIZE];
+ char buf2[STRSIZE];
+ int diff;
+
+ *buf = '\0';
+ *buf2 = '\0';
+
+ if (win_obj->owner != lose_obj->owner) {
+ if (win_obj->owner == USER) {
+ user_score += piece_attr[lose_obj->type].build_time;
+ ksend1 ("Enemy %s at %d destroyed.\n",piece_attr[lose_obj->type].name,loc_disp(loc),0,0,0,0,0,0); //kermyt
+ topmsg1 (1, "Enemy %s at %d destroyed.",piece_attr[lose_obj->type].name,loc_disp(loc),0,0,0,0,0,0);
+ ksend1 ("Your %s has %d hits left\n",piece_attr[win_obj->type].name,win_obj->hits,0,0,0,0,0,0); //kermyt
+ topmsg1 (2, "Your %s has %d hits left.", piece_attr[win_obj->type].name, win_obj->hits,0,0,0,0,0,0);
+
+ diff = win_obj->count - obj_capacity (win_obj);
+ if (diff > 0) switch (win_obj->cargo->type) {
+ case ARMY:
+ ksend("%d armies fell overboard and drowned in the assault.\n",diff,0,0,0,0,0,0,0); //kermyt
+ topmsg (3,"%d armies fell overboard and drowned in the assault.",diff,0,0,0,0,0,0,0);
+ break;
+ case FIGHTER:
+ ksend("%d fighters fell overboard and were lost in the assult.\n",diff,0,0,0,0,0,0,0); //kermyt
+ topmsg (3,"%d fighters fell overboard and were lost in the assault.",diff,0,0,0,0,0,0,0);
+ break;
+ }
+ }
+ else {
+ comp_score += piece_attr[lose_obj->type].build_time;
+ ksend1 ("Your %s at %d destroyed.\n",piece_attr[lose_obj->type].name,loc_disp(loc),0,0,0,0,0,0); //kermyt
+ topmsg1 (3, "Your %s at %d destroyed.",piece_attr[lose_obj->type].name,loc_disp(loc),0,0,0,0,0,0);
+ }
+ set_need_delay ();
+ }
+}
--- /dev/null
+an army has been completed at city 1092.
+Your army at 1192 destroyed.
+Your city at 1092 is under attack.
+an army has been completed at city 1092.
+Your army at 1393 destroyed.
+City at 1092 has been lost to the enemy!
+an army has been completed at city 672.
+an army has been completed at city 672.
+an army has been completed at city 672.
+an army has been completed at city 2057.
+an army has been completed at city 2057.
+an army has been completed at city 2057.
+an army has been completed at city 1095.
+an army has been completed at city 1095.
+City at 1590 has been subjugated!
+Your army has been dispersed to enforce control.an army has been completed at city 1095.
+an army has been completed at city 1095.
+an army has been completed at city 1095.
+an army has been completed at city 1095.
+an army has been completed at city 1095.
+a troop transport has been completed at city 1590.
+an army has been completed at city 980.
+an army has been completed at city 980.
+an army has been completed at city 1526.
+an army has been completed at city 1526.
+City at 1633 has been subjugated!
+Your army has been dispersed to enforce control.
+an army has been completed at city 1526.
+an army has been completed at city 1526.
+a fighter has been completed at city 1633.
+an army has been completed at city 1633.
+an army has been completed at city 1633.
+an army has been completed at city 1633.
+an army has been completed at city 1633.
+a troop transport has been completed at city 1526.
+an army has been completed at city 1633.
+Your fighter at 1825 destroyed.
+an army has been completed at city 1633.
+an army has been completed at city 1633.
+an army has been completed at city 414.
+an army has been completed at city 414.
+City at 307 has been subjugated!
+Your army has been dispersed to enforce control.
+The scum defending the city crushed your attacking blitzkrieger.
+an army has been completed at city 414.
+an army has been completed at city 414.
+City at 911 has been subjugated!
+Your army has been dispersed to enforce control.
+a fighter has been completed at city 307.
+an army has been completed at city 414.
+an army has been completed at city 414.
+a fighter has been completed at city 307.
+an army has been completed at city 414.
+an army has been completed at city 414.
+an army has been completed at city 414.
+a patrol boat has been completed at city 307.
+an army has been completed at city 414.
+a troop transport has been completed at city 911.
+an army has been completed at city 414.
+an army has been completed at city 414.
+The scum defending the city crushed your attacking blitzkrieger.
+a patrol boat has been completed at city 307.
+The scum defending the city crushed your attacking blitzkrieger.
+City at 1506 has been subjugated!
+Your army has been dispersed to enforce control.
+an army has been completed at city 414.
+The scum defending the city crushed your attacking blitzkrieger.
+City at 1422 has been subjugated!
+Your army has been dispersed to enforce control.
+an army has been completed at city 1506.
+The scum defending the city crushed your attacking blitzkrieger.
+an army has been completed at city 414.
+an army has been completed at city 1422.
+an army has been completed at city 1506.
+an army has been completed at city 414.
+City at 1714 has been subjugated!
+Your army has been dispersed to enforce control.
+an army has been completed at city 1422.
+The scum defending the city crushed your attacking blitzkrieger.
+a patrol boat has been completed at city 307.
+an army has been completed at city 1506.
+Your patrol boat at 5037 destroyed.
+an army has been completed at city 414.
+The scum defending the city crushed your attacking blitzkrieger.
+an army has been completed at city 1422.
+an army has been completed at city 1617.
+an army has been completed at city 1617.
+The scum defending the city crushed your attacking blitzkrieger.
+an army has been completed at city 1617.
+an army has been completed at city 1617.
+The scum defending the city crushed your attacking blitzkrieger.
+an army has been completed at city 1617.
+The scum defending the city crushed your attacking blitzkrieger.