Commit graph

54 commits

Author SHA1 Message Date
eaa678c903 reject: Move reject state from struct natstr to rejectstr
Reject state is relatively bulky: it's a big chunk of struct natstr,
and adds almost 200 bytes per country to xdump nat.

Reject state changes rarely.  Rewriting it to disk on every nation
update and retransmitting it in every xdump nat is wasteful.

To avoid this waste, move reject state to its own struct rejectstr.

This is of course an xdump compatibility break.  We're not maintaining
xdump compatibility in this release.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:21 +02:00
4628661b40 reject: New enum rej_comm for REJ_TELE & friends
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:21 +02:00
9d153f547c reject: Replace getrejects() by nat_accepts()
All callers of getrejects() also check whether the sender is a deity.
Factor out the common code into nat_accepts(), and drop getrejects().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:21 +02:00
8a129dee20 reject: Inline putreject() into its only caller setrej()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:20 +02:00
d35303d426 contact: Change in_contact()'s first parameter to natid
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:20 +02:00
c8e7548f24 contact: Move contact state from struct natstr to contactstr
Contact state is relatively bulky: it's a big chunk of struct natstr,
and adds almost 200 bytes per country to xdump nat for deities.

Contact changes rarely.  Since we avoid unnecessary updates, it
doesn't change at all unless option HIDDEN is enabled.  Rewriting it
to disk on every nation update and retransmitting it in every deity
xdump nat is wasteful.

To avoid this waste, move contact state to its own struct contactstr.

This is of course an xdump compatibility break.  We're not maintaining
xdump compatibility in this release.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:20 +02:00
7cc34abaca contact: Rename getcontact() to in_contact()
The next commit will create a contact file, and the macro to get a
contact entry will be named getcontact().  Rename the existing
getcontact() out of the way.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:20 +02:00
00d0664bcd contact: Inline putcontact() into its only caller setcont()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:20 +02:00
549561ff03 Include "file.h" where it's needed
Several headers define macros that use ef_ptr() without including
"file.h".  Fix that.  Drop redundant inclusions elsewhere.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:08:31 +02:00
bae3f5447e Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-07-02 17:45:44 +02:00
9f25de3dce Change comment style to use @foo rather than FOO
... when referring to a function's parameter or a struct/union's
member.

The idea of using FOO comes from the GNU coding standards:

    The comment on a function is much clearer if you use the argument
    names to speak about the argument values.  The variable name
    itself should be lower case, but write it in upper case when you
    are speaking about the value rather than the variable itself.
    Thus, "the inode number NODE_NUM" rather than "an inode".

Upcasing names is problematic for a case-sensitive language like C,
because it can create ambiguity.  Moreover, it's too much shouting for
my taste.

GTK-Doc's convention to prefix the identifier with @ makes references
to variables stand out nicely.  The rest of the GTK-Doc conventions
make no sense for us, however.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-12-05 12:13:17 +01:00
b14f5276ab Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-28 16:21:34 +01:00
4877a2f024 accept: rejectname() makes no sense outside acce(); inline
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-03 20:45:25 +01:00
bb467c335d Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:33:48 +01:00
df4925d696 Update copyright notice 2013-01-12 17:45:01 +01:00
1118f1c0ca Update copyright notice 2012-06-10 10:52:22 +02:00
c4337f7aec Factor mailbox_create() out of nat_reset() and files.c 2011-12-29 11:47:07 +01:00
37e9b6aa9c Create all deities with $123456789, not just POGO 2011-12-29 11:47:06 +01:00
ad308c5de8 Move setting nat_cnam, nat_pnam into nat_reset() 2011-12-29 11:47:06 +01:00
bb442abdcd Use nat_reset() for POGO in files.c
Requires moving it from subs/natsub.c to common/nat.c.
2011-12-29 11:47:06 +01:00
98cd2a3a70 Update known contributors comments 2011-04-14 20:21:23 +02:00
7e2008e7f4 License upgrade to GPL version 3 or later
Why upgrade?  I'm not a lawyer, but here's my take on the differences
to version 2:

* Software patents: better protection against abuse of patents to
  prevent users from exercising the rights under the GPL.  I doubt
  we'll get hit with a patent suit, but it's a good move just on
  general principles.

* License compatibility: compatible with more free licenses, i.e. can
  "steal" more free software for use in Empire.  I don't expect to steal
  much, but it's nice to have the option.

* Definition of "source code": modernization of some details for today's
  networked world, to make it easier to distribute the software.  Not
  really relevant to us now, as we normally distribute full source code.

* Tivoization: this is about putting GPL-licensed software in hardware,
  then make the hardware refuse to run modified software.  "Neat" trick
  to effectively deny its users their rights under the GPL.  Abuse was
  "pioneered" by TiVo (popular digital video recorders).  GPLv3 forbids
  it.  Unlikely to become a problem for us.

* Internationalization: more careful wording, to harden the license
  outside the US.  The lawyers tell us it better be done that way.

* License violations: friendlier way to deal with license violations.
  This has come out of past experience enforcing the GPL.

* Additional permissions: Probably not relevant to us.

Also include myself in the list of principal authors.
2011-04-12 21:20:58 +02:00
bb5cd07ce5 New relations_with()
Relations checking with getrel() often needs a special case for "is
same country".  If you forget, you get behavior appropriate for a
neutral foreign country, which is usually very wrong (see commit
16c68eb4 for an example).

Unlike getrel(), relations_with() considers countries allied to
themselves.  Less dangerous.  In fact, allied behavior is typically
just right, so the special case isn't even needed.
2011-02-13 17:48:58 +01:00
439f111f98 Remove option SLOW_WAR
SLOW_WAR has issues:

* The check whether the attacker old-owns the attacked sector is
  broken, because att_abort() uses sect.sct_oldown uninitialized.

  Spotted by the Clang Static Analyzer.

* Its implementation in setrel() is somewhat scary.  It's actually
  okay, because that part of setrel() only runs within decl().  Other
  callers don't reach it: update_main() because player->god != 0
  there, and the rest because they never pass a rel < HOSTILE.

* Documentation is a bit vague.

SLOW_WAR hasn't been used in a public game in years.  Fixing it is not
worth it, so remove it instead.
2011-02-13 15:59:49 +01:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
c528fcbe3e Update known contributors comments 2009-12-13 17:34:28 +01:00
6ae4eca045 Don't use 0 as null pointer constant, part 3
This part replaces E == 0 by !E, where E has pointer type.
2009-03-24 21:46:01 +01:00
615681ce16 Don't use 0 as null pointer constant, part 1
Use NULL instead of 0, for clarity.  Except in pointer comparisons;
leave that to the next two commits.
2009-03-24 21:45:44 +01:00
6a1078f8a0 Fix reject accept
Instead of accepting the listed nations, rejected the nation listed
last, and accepted all the others.  Broken in commit 6844c94b, v4.3.4.
2009-02-08 09:33:19 +01:00
35ef345ecb Update copyright notice 2009-02-08 09:33:18 +01:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
6844c94b4a (natstr, add, getrejects, putreject): Simplify rejections storage.
The space savings of nibble storage are not worth the hassle,
especially for xdump.

(nat_ca): New selector rejects.
2006-05-18 18:43:38 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
c791849595 (rejectname): Use static storage duration for rejects[]. 2006-01-06 17:58:21 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
8b16c31223 Change nation status from bits to a simple enum:
(nat_status, STAT_UNUSED, STAT_VIS, STAT_ACTIVE): New.
(STAT_NEW, STAT_SANCT, STAT_GOD): Change into nat_status members.
(STAT_INUSE, STAT_NORM): Remove.
(natstr): Use new nat_status for nat_stat.
    New value       Old value
    STAT_UNUSED     0
    STAT_NEW        STAT_INUSE | STAT_NEW
    STAT_VIS        STAT_INUSE
    STAT_SANCT      STAT_INUSE | STAT_SANCT
    STAT_ACTIVE     STAT_INUSE | STAT_NORM
    STAT_GOD        STAT_INUSE | STAT_NORM | STAT_GOD
Users changed.
2006-01-04 22:49:42 +00:00
bea83adb93 Some s_char killings. 2006-01-04 21:40:30 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
Ron Koenderink
16d0f5d133 (natstate): Add STAT_SANCT case so the nation report properly
shows SANCTUARY instead of VISITOR for countries in sanctuary.
2005-12-20 01:49:55 +00:00
Ron Koenderink
6157409f20 (influx): Remove carriage return. 2005-12-18 03:53:52 +00:00
Ron Koenderink
5ffef496ea (coun_list, repo_list, nati): Replace in-flux determination code with influx().
(influx): New.
2005-12-17 20:18:54 +00:00
Ron Koenderink
3fd64ccb48 (getcontact,putcontact): Generalize the interface back to an int.
Add range checks to prevent unexpected results.
2005-11-19 14:55:03 +00:00
Ron Koenderink
762d39d905 (getcontact, putcontact, nat_contact): Change nat_contact
to unsigned char to reduce the space required for natstr.
2005-11-18 23:40:30 +00:00
Ron Koenderink
974af7130c (agecontact): Remove the opt_LOSE_CONTACT, the calling
procedure update_main() already has opt_LOSE_CONTACT check.
2005-11-18 23:02:51 +00:00
Ron Koenderink
09b2530d97 (getcontact, putcontact): Remove the bit shifting that was in the
function to save space.  opt_LOSE_CONTACT changes negated
any space saving.
2005-11-18 22:58:54 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00