Commit graph

4741 commits

Author SHA1 Message Date
d1bf11a015 (loan_owed): New, factored out common code.
(coll, fina, repa, shark, disloan): Use it.
2004-08-20 11:46:01 +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
e502056dab (fina, repa, disloan): Fix the previous rev. 2004-08-20 07:11:18 +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
ef0060ec57 (tran_nuke, tran_plane, set, sell, move): Use military_control().
(tran_plane): Fix message for attempting to transport a plane in a
sector not owned by the player.
2004-08-19 18:12:28 +00:00
766538bc2f (ship_bomb): Clarify. 2004-08-19 18:02:30 +00:00
ffeac61020 (SHOULD_PRODUCE): Silly. Simplify and inline at only call site. 2004-08-19 18:01:55 +00:00
5a725c9177 (nullify_objects): Use SCT_MAXDEF instead of sct_maxno. Loop no
longer covers the extra empty slots at the end of the dchr[]; doesn't
matter.

(sct_maxno): Unused, remove.
2004-08-19 17:45:36 +00:00
77a9f94c69 (calc_all): Change all parameters into out-parameters. Previously,
caller had to zero some.  Caller changed.

(goodsect): Remove; use sct_typematch() instead.

(change_prio): New.
(budg): Use it to replace ugly and confusing priority change code.

(budg): Use prexpense() for industries as well.  Fixes cost output
alignment bug.

(budg): Use splur() & friends.
2004-08-19 17:33:29 +00:00
0ebb14c8be (PRI_SMAINT, PRI_PMAINT, PRI_LMAINT, PRI_SBUILD, PRI_PBUILD,
PRI_LBUILD): Turn macros into enumeration constants.  Value
SCT_MAXDEF+1 was previously unused; use it.
(PRI_MAX): New; replacing the horrible SCT_MAXDEF+8.

(show_sect_build): Simply examine all sector types, don't skip the
first five.  The code ignores them just fine.

(show_sect_build, show_sect_stats, show_sect_capab): Don't try to show
sector types beyond SCT_MAXDEF.  The table has some empty extra slots,
for whatever reasons; no use examining them.
2004-08-19 16:59:36 +00:00
cff2deba4a (main): Don't initialize budget priorities of unused nations; leave
that to add() like all the other initializations.
2004-08-19 15:49:43 +00:00
48a9ef7c04 (deliver): Grant packing bonus only to efficient sectors, as
everywhere else.
2004-08-19 12:40:35 +00:00
95d1d10591 Use plain char * instead of s_char *. Doc clarifications. 2004-08-17 19:22:43 +00:00
ec752ac390 Silence harmless compiler warning. 2004-08-17 19:00:18 +00:00
ed5c1b00ee Remove dead code. 2004-08-17 18:59:52 +00:00
e1ebe41686 (M_TORP_SHELLS, SHP_TORP_SHELLS): Rename. 2004-08-17 18:45:04 +00:00
cdad6db4ac (pln_onewaymission, carriersatxy): Change to match ordinary sorties:
offer carriers regardless of the sector they're in, require carriers
to be efficient.  Closes #875376.
2004-08-17 18:34:53 +00:00
4fd7da248a (SHP_AIROPS_EFF, LND_AIROPS_EFF): New. Use it instead of literal 50. 2004-08-17 18:31:32 +00:00
90a61e245f (real): Support argument #' in addition to <NUMBER>' and
`#<NUMBER>'.
2004-08-17 17:12:44 +00:00
91c316afaa (msl_intercept): msl_hit() expects plain WHAT argument, without owner.
Passing it with owner gets the owner printed twice.  Fix.
2004-08-17 16:57:43 +00:00
8ef7f35a56 (V_CIVIL, V_MILIT, V_SHELL, V_GUN, V_PETROL, V_IRON, V_DUST, V_BAR,
V_FOOD, V_OIL, V_LCM, V_HCM, V_UW, V_RAD, V_ITEM): Remove, use item
types instead.
2004-08-17 16:12:31 +00:00
09def8f156 (show_sect_capab, V_ITEM): The difference between variable and
item types was removed some time ago.  Simplify.
(VT_ITEM, VT_TYPE, V_MAX): Unused, remove.

(show_sect_capab): Properly use ichr[] member i_mnem to print item
characters.
2004-08-17 16:07:01 +00:00
4d154753b8 (pchrstr, MAXPRCON): Simplify variable-style storage of constituents.
Store only up to MAXPRCON constituents, not MAXCHRNV; code doesn't
fully support more than three anyway.  Remove member p_nv, use item
type I_NONE for unused slots.  Rename members p_vtype, p_vamt to
p_ctype, p_camt to avoid confusion with variable-style storage.
(pchr): Initializers adapted.
(nullify_objects, materials_cost, materials_charge, prod,
show_sect_capab, grind): Adapt, simplify where possible, protect
against bad item types in pchr[].
(MAXCHRNV): Unused, remove.
2004-08-17 15:19:46 +00:00
15d4f89951 (max_pop): Clarify code. No functional changes. 2004-08-17 14:46:40 +00:00
921a55d508 (ldump, ndump, pdump, sdump): Remove leading spaces in deity dumps;
they waste bandwidth and don't match dump().
2004-08-17 14:44:06 +00:00
8a0854b6b8 (mchrstr, lchrstr): Change from variable-style storage of load
capacities to straight arrays.  Users now subscript the array instead
of calling vl_find() or walking the variable data structure.
(mchr, lchr): Initializers adapted.
(vl_find): No longer used.  Remove file.
2004-08-17 14:09:04 +00:00
Ron Koenderink
a965b2d25e (prod_eff): New, factored out of produce() and prod().
(upd_ship): Oil and food production used special rules that didn't
match ordinary production and didn't make much sense.  Made them
follow ordinary production rules.  This puts uw and mil to work, and
makes ship tech and efficiency relevant to production.  Closes #917461
and #955072.
2004-08-17 13:17:50 +00:00
09486ad3ed (lchr, pchr): Initializers depended on ETUS instead of etu_per_update.
ETUS is just the default for etu_per_update.  Deities don't change
ETUS, they change etu_per_update by editing econfig.  This nonsense
dates back at least to chainsaw 3.31, where it was just as broken as
now.  Replace ETUS by 60 and simplify.
2004-08-17 12:38:00 +00:00
Ron Koenderink
3ca767fc88 (prod_eff): New, factored out of produce() and prod().
(upd_ship): Oil and food production used special rules that didn't
match ordinary production and didn't make much sense.  Made them
follow ordinary production rules.  This puts uw and mil to work, and
makes ship tech and efficiency relevant to production.  Closes #917461
and #955072.
2004-08-17 02:31:10 +00:00
9f226fe05f 4.2.17 last minute changes. 2004-08-16 16:24:56 +00:00
20199b2236 (drop, fly): Fix previous rev. not to prohibit flying civilians to an
ally.  Since you can load them onto their ships, you should be able to
fly them over.
2004-08-16 14:35:06 +00:00
98a7936c08 Update for 4.2.17. 2004-08-14 20:03:08 +00:00
Ron Koenderink
1fcc9f68fd Added srand call to thread startup as each thread needs to be seeded in Windows. 2004-08-14 19:35:38 +00:00
d993fdef90 (pln_mine, pln_dropoff): Split off aerial mining into new pln_mine().
Callers changed.

(drop): Do not disclose anything about target sector before planes
actually got there, unless the target sector is owned by the player or
an ally.  This plugs a major loophole.  Consequently, the command can
no longer always refuse to attempt to drop stuff where it won't work.
Instead, the planes fly out to try.  Other plane commands (para, bomb)
behave exactly the same.  Also closes #909859.
(pln_dropoff): Cope with planes trying to drop where they can't.

(drop): Refuse to drop civilians into allied sectors, for consistency
with other means to move around stuff.
2004-08-14 17:12:20 +00:00
003e068615 Making directories worked only when CVS was the first sub-directory
found by find.
2004-08-14 08:23:37 +00:00
3588722250 (fly): Prohibit flying of civilians into occupied or allied sectors.
Before, civilians magically changed allegiance on disembarking planes.
2004-08-14 07:27:05 +00:00
a878a40a7b (fly): Failed to re-get target sector after asking for cargo, and thus
passed potentially invalid argument to pln_onewaymission().
2004-08-13 21:00:11 +00:00
1127762cc1 (pln_oneway_to_carrier_ok): New.
(fly, reco): Use it to prevent flying to a carrier that doesn't have
space for the planes.  Previously, planes that did this were
teleported home, which could be abused.

(fly): Fail if pln_sel() comes up empty, just like the other commands
to fly planes.
2004-08-13 20:22:03 +00:00
ab0d5a87bd (bomb): Don't tell the player that target is a sanctuary before his
planes got there.  This closes a loophole that allowed players with
any planes to find all sanctuaries.
2004-08-13 12:02:35 +00:00
73308d9c57 (move, explore): Return early when interdiction destroys everything
moved.  Without that, loyalty computation divided by zero and crashed
when moving civilians to a sector without civilians.  Found and
debugged by Jeff Cotter.  Closes #1005005.
2004-08-13 10:05:32 +00:00
9549adefdc No C99/C++ comments. 2004-08-13 09:57:58 +00:00
a5a8b52afd (gamedown): Printed down message with pr(), as a printf()-like format
string!  This reads and formats junk from the stack when message
contains '%', and can even crash.  Use prnf() instead.  Catched by Ron
Koenderink.
2004-08-10 13:34:41 +00:00
298ba998e4 (infect_people): Use max_pop() to compute space. This makes all
crowded sectors equally vulnerable, including mountains, plains, and
inefficient big cities.  Closes #917488.
Update info.
2004-08-10 07:56:34 +00:00
d721ba3b5c (show_motd): Printed motd with pr(), as a printf()-like format string!
This reads and formats junk from the stack when motd contains '%', and
can even crash.  Use prnf() instead.
2004-08-10 05:52:58 +00:00
Ron Koenderink
743be658c8 Don't drill (and deplete) more oil than the ship can hold.
Closes #955071.
2004-08-05 01:32:09 +00:00
8ce25abc1f (sarg_xy, sarg_getrange, sarg_range, sarg_list): These choke on
trailing junk since the previous rev.  That's too strict.  Silently
ignore trailing junk as long as it starts with whitespace.  That's
somewhat lax, but will do for now.  Closes #982018.
2004-08-04 20:04:37 +00:00
c8afd40eb8 (nstr_comp_val): Since rev. 1.10, selectors were always preferred to
type literals, unless type inference rejects the selector.  This
doesn't work for NSC_TYPE selectors: `?des=n' is interpreted as
`?des=newdes'.  Prefer type literal to NSC_TYPE selector.  Closes
#982021.
2004-08-04 14:47:24 +00:00
Marc Olzheim
153595a253 Now that src/scripts/nightly/patches/All/prng.patch:1.5 makes sure that
all randomness is predictable and repeatable, we're ready for some
real scripts.
2004-06-20 17:58:10 +00:00