Commit graph

30 commits

Author SHA1 Message Date
57717b5bc1 Clean up unreadable assignments within if conditionals
Pinpointed assignments within if conditionals with spatch -sp_file
tests/bad_assign.cocci (from coccinelle-0.1.4).  Cherry-picked diff
hunks affecting conditionals split over multiple lines, and cleaned
them up.
2009-03-21 09:24:45 +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
0d139ee1d1 Update lost file from prewrite callbacks
Losses of sectors, ships, planes, land units and nukes are tracked in
the lost file.  To keep it current, makelost() and makenotlost() were
called whenever one of these changed owners.  Cumbersome and
error-prone.  In fact, the lost file was never perfectly accurate.

Detect the ownership change in the prewrite callback and call
makelost() / makenotlost() from there.  Remove lost file updates from
where they're no longer needed: right before a put.  takeover() is a
bit more involved: it doesn't put the sectors, but all callers do,
except for guerrilla().  So remove the lost file update from
takeover(), but add it to guerrilla().

This takes care of lost file update for all ownership changes that go
through ef_write().  It can't take care of any missing updates for
changes that don't go through it.
2008-09-08 21:26:42 -04:00
6e998a46e2 Replace commented out code in coll() by a suitable comment 2008-05-31 18:25:35 +02:00
221e88f106 Distinguish between sacking and obliterating a capital
Make caploss() transfer money, loans and market lots to the player
only if he actually took the capital, not if he obliterated it to
deity.

To make this work, caploss() needs to be called after the sector is
updated for damage and change of ownership.  Change callers
accordingly.

Closes #914049.
2008-05-11 10:48:30 +02:00
0a61f8eb78 Fix some argument prompts to end in one space
Corrects first argument of collect and show, and second argument of
assault, follow, mine, lmine and mobquota.
2008-05-10 18:52:29 +02:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
8544ef0e8d (coll): Fix freeing of repaid loan. The incorrectly freed loan
continued to exist.  Fortunately, both shark and collect refused to
touch it.  fina() and repa() oopsed in loan_owed(), and recovered by
assuming (incorrectly!) a plausible debt.  Before trdsub.c rev. 1.7,
fina() catched and logged the bug, and ignored the loan, and repa()
computed a ridiculous debt.
2007-01-20 15:57:25 +00: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
7a99405942 Do not cast to float where usual arithmetic conversions obviously
convert the cast's result to double.  Such casts are ugly and may lose
precision.
2006-05-06 08:26:31 +00:00
783b00bbad (ichrstr): Rename member i_vtype to i_uid.
(ichr_ca): Rename selector vtype to uid.
2006-02-20 05:35:58 +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
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
Marc Olzheim
c6ef918f3a Cleanup #includes of (mostly a long time) unused header files.
No functional changes.
2004-12-13 16:47:13 +00:00
Marc Olzheim
e9a040adb9 Do not include var.h where no longer needed. Clean up register keywords in these file at the same time. No functional changes. 2004-10-12 20:08:51 +00:00
Marc Olzheim
d30942632b (I_NONE, I_CIVIL, I_MILIT, I_SHELL, I_GUN, I_PETROL, I_IRON, I_DUST,
I_BAR, I_FOOD, I_OIL, I_LCM, I_HCM, I_UW, I_RAD, I_MAX): Turn macros
into enumeration constants.
(i_type): New.  Use where appropriate.  No functional changes, except
that I_NONE is now catched properly in a few places.
2004-09-16 21:18:01 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
2feef76102 Use plain char * instead of s_char *. 2004-08-20 08:55:23 +00:00
bcc4a86944 (fina, repa, shark): Bankers never round down debts!
(repa, coll): Collect interest for the time the debtor is idling at
sub-prompts.
2004-08-20 08:47:00 +00:00
e7c9da21e5 (loan_owed): New, factored out common code.
(coll, fina, repa, shark, disloan): Use it.
2004-08-20 08:16:34 +00:00
fcbe36e76c (coll, fina, repa, shark, disloan): Fix calculation of regular and
extended (beyond due date) loan time.  At the due date, or after a
last payment made at the due date, durations were zero in fina() and
unpredictable elsewhere.  With luck, debtors could abuse this to repay
loans cheap (they couldn't gain cash, though), sharks to purchase
loans cheap, and creditors to collect excessively.
2004-08-20 07:01:26 +00:00
eccc5cb7d7 Sectors need space for items, deliveries and distribution thresholds.
To save space, the ancients invented `variables': a collection of
key-value pairs, missing means zero value, space for `enough' keys.
This complicates the code, as assigning to a `variable' can fail for
lack of space.  Over time, `enough' increased, and for quite some time
now `variables' have been *wasting* space.  This changeset replaces
them, except in struct mchrstr, struct lchrstr and struct pchrstr,
where they are read-only, and will be replaced later.  It is only a
first step; further cleanup is required.  To simplify and minimize
this necessarily huge changeset, the new item[] arrays have an unused
slot 0, and the old variable types V_CIVIL, ... are still defined, but
must have the same values as the item types I_CIVIL, ...
2004-03-03 16:54:22 +00:00
e67dca9d29 Indentation fixes; suspect indent-emp is to blame. 2004-02-28 18:06:11 +00:00
4ae9c417b3 (bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without
effect.  Replace calls by struct assignment where possible.  Replace
clear buffer, copy string to buffer by strncpy().  Use assignment to
clear when that's clearer.  Replace overlapping copy through bounce
buffer by memmove().  Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.
2004-01-08 17:54:28 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00