Commit graph

128 commits

Author SHA1 Message Date
Ron Koenderink
87eab4e63a (pln_sel): Remove unused local variables. 2007-11-22 03:21:27 +00:00
6992bcfe9a (carriersatxy): Remove parameters wantflags, nowantflags, and use
carrier_planes() instead, ignoring carriers that can only operate
x-light planes.  No functional change.
(carrier_planes): External linkage.
2007-11-04 16:05:06 +00:00
d5afd757a9 (carrier_planes): New.
(pln_onewaymission): Use it.  No functional change.
(pln_airbase_ok): Use it to enforce capabilities.  Before, a plane
could fly once it got on the ship.  Because ships can load only planes
that can fly from them, this has no effect other than make that sanity
check redundant; remove it.

(pln_airbase_ok): Update land unit case to keep it similar to the ship
case.
2007-11-04 15:07:43 +00:00
4ced91fe3f (pln_airbase_ok): New parameter noisy to allow suppressing messages.
Check player->cnum only when noisy.  Update existing caller to pass 1.
No functional change.

(mission_pln_airbase_ok): Remove, use pln_airbase_ok() instead.  No
functional change.
2007-11-03 09:29:45 +00:00
6110e08772 Comment and white-space cleanup. 2007-11-03 08:57:05 +00:00
5d41e56aee (pln_airbase_ok): Check pp->pln_own instead of player->cnum, in
preparation of replacing mission_pln_airbase_ok().  No functional
change.
2007-11-03 08:53:21 +00:00
26721aa9d1 (pln_airbase_ok): Plug information leak: carrier owner was checked
last, so when it was (no longer) allied, attempting to fly off it let
you test the conditions checked before that.  Check owner first.
(mission_pln_airbase_ok): Matching change, to avoid diverging from
pln_airbase_ok().
2007-11-03 08:20:54 +00:00
446f19913d (pln_airbase_ok, mission_pln_airbase_ok): Oops when plane's carrier is
bad.  Before, the plane was destroyed, and the player got a message.

(pln_airbase_ok, mission_pln_airbase_ok): Oops when plane's base
sector is bad.

(pln_airbase_ok): Oops when the player doesn't own the plane.  Before,
this was checked only for planes on carriers, and the plane was
destroyed, and the player got a misleading message.
2007-11-03 08:09:38 +00:00
79c2a10b30 (pln_airbase_ok, mission_pln_airbase_ok): Simplify conditional. Don't
check a land carrier when the plane is already on a ship.
2007-11-03 07:52:50 +00:00
e8efc3e1a0 (pln_airbase_ok): New, factored out of pln_sel(). No functional
change.
2007-11-02 19:39:06 +00:00
4d663ddbd6 (pln_wanted, pln_capable): Rename. 2007-11-02 19:13:10 +00:00
98105c9561 (mission_pln_wanted): Broken like its cousin pln_wanted() was, only
more so: additionally, any of P_E, P_K, P_L satisfied any subset of
P_E, P_K, P_L.  Chainsaw fixed this one in plnsub.c, but not here.
Remove, use the fixed pln_wanted() instead.
(pln_wanted): External linkage.
2007-11-01 19:50:37 +00:00
684bac5b1d (pln_wanted): Rewrite. Old version was incomprehensible, slow and
buggy: any P_E, P_L, P_K in wantflags were ignored when the plane
lacked P_ESC.  The bug bit only when non-escort interceptors escorted
a one-way mission to a carrier.  pln_oneway_to_carrier_ok() then could
not fit the plane on the carrier, and the command failed complaining
about lack of room on the carrier.  Broken since Chainsaw added
escorts, abusable before 4.2.17 catched it.  Also change behavior when
only one of P_F and P_ESC is in wantflags: new version requires that
flag, while old version treats it as if both flags were in wantflags:
a plane having either is okay.  Current code never passes such
wantflags.
2007-11-01 19:16:29 +00:00
213cf19ec5 (pln_wanted): New, factored out of pln_sel(). No functional change. 2007-11-01 16:54:02 +00:00
041ad4ced9 (fit_plane_on_ship, fit_plane_off_ship): Change how planes are fit on
ships, so that order of loading no longer matters: choppers can use
chopper or plane slots, x-lights can use x-light or plane slots, light
planes can use plane slots.  However, plane slots require M_FLY or
M_MSL to hold missiles or x-lights, and M_FLY to hold anything else.
Choppers and x-lights can now use plane slots even when not light.
X-light choppers, which don't exist in the stock game, can no longer
use x-light slots.
2007-11-01 11:59:28 +00:00
32bd205362 (could_be_on_ship): Fix rev. 1.61. 2007-11-01 10:15:54 +00:00
55df03f4ff (fit_plane_on_ship, fit_plane_off_ship): Don't require M_CHOPPER for
use of chopper slot.  Same for M_XLIGHT and x-light slot.  No
functional change, because presence of slots implies the flags (see
init_mchr()).
2007-11-01 07:25:21 +00:00
9c98b7b14b (could_be_on_ship): Not consistent with fit_plane_on_ship(). Fix by
using that.  Less efficient, but that doesn't really matter here.
2007-11-01 06:35:50 +00:00
d3fcc89f56 (can_be_on_ship, could_be_on_ship): Take pointer rather than UID
arguments.  Rename.  Callers changed.
2007-10-31 06:39:37 +00:00
51165cf3fc Collect the test whether a plane fits on a carrier in one place:
(fit_plane_on_ship, fit_plane_on_land): New.
(pln_oneway_to_carrier_ok, put_plane_on_ship, count_planes)
(put_plane_on_land, count_land_planes): Use them.  No functional
change.
(fit_plane_off_ship, fit_plane_off_land): New.
(take_plane_off_ship, take_plane_off_land): Use them.  This oopses
when the carriers plane counter underflows.

(take_plane_off_ship): Document that carrier's plane counters may be
screwed up.

(take_plane_off_ship, take_plane_off_land): Oops when the plane isn't
on the carrier.

(take_plane_off_ship, take_plane_off_land): Don't fail when the plane
to be taken off can't go on this type of carrier, just take it off.
No error condition left, so return void.  Callers couldn't do anything
useful with the status anyway, and most didn't bother.  Change those
that did.
2007-10-30 07:09:31 +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
4c4fdca42b Line breaks and other formatting issues. No functional changes. 2006-05-21 13:05:24 +00:00
281840b604 (pln_hitchance): Change tfact from float to double, because it is used
as double.
2006-05-21 13:03:40 +00:00
cd73a47dfa Remove superflous casts and parenthesis. 2006-05-21 12:24:30 +00:00
ebe030feba (pln_sel): Clarification. No functional change.
(pln_mobcost): Don't round cost computation intermediate values.

(pln_mobcost): Don't limit cost to current mobility + 32.  No
airworthy plane can possibly use more than 55 mobility in one sortie,
and mobility going that much negative is fine.
2006-05-21 09:08:57 +00:00
5b4b3a13cb Break lines more tastefully. 2006-05-14 07:52:20 +00:00
89694cd468 (detonate): Change parameters from carrying plane to nuke and
airburst.  Leave taking nuke off the plane to caller.  Use coord for
coordinate parameters.
(pln_damage): Take nuke off the plane.

(detonate): Destroy the nuke.  This is required since arming doesn't
remove nukes from the nuke file anymore (arm.c rev. 1.15).
2006-05-13 14:04:03 +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
384555b811 (pln_arm): Change parameter mission from int to char to clearly
document its use.
2006-04-30 16:15:33 +00:00
e28851b8e9 Normalize unsigned int to just unsigned. 2006-04-30 12:26:07 +00:00
0c8c169f88 (s_char): Remove. Use signed char for small integers, plain char for
characters.
2006-04-29 16:25:17 +00:00
4c6fb12377 Code formatting. No functional changes. 2006-03-26 13:52:23 +00:00
79714720cc (ontradingblock, trdswitchown): Second parameter is a generic pointer,
change it from int * to void *.  Callers changed not to cast to int *.
2006-03-25 15:11:17 +00:00
f5a9284867 Update known contributors comment. 2006-02-24 21:35:27 +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
Ron Koenderink
04a8b84592 (ship_bomb, deli, do_demo, fuel, grin, look_ship)
(ltend, multifire, quite_bigdef, mine, landmine)
(do_loan, prod, printdiff, sell, sona, stre)
(tend, fire_dchrg, vers, work, ac_planedamage)
(ac_shipflak, ask_off, get_mine_dsupport, att_fight)
(ask_move_in_off, detonate, sd, land_gun)
(land_unitgun, lnd_fort_interdiction, lnd_fortify)
(perform_mission, pln_mine, pln_mobcost)
(retreat_ship1, retreat_land1, shp_sweep)
(shp_fort_interdiction, shp_missle_defense)
(new_work, growfood, upd_land, land_repair)
(get_materials, do_mob_ship, do_mob_land)
(load_it, unload_it, prod_plane, produce)
(guerrilla, upd_buildeff, spread_fallout)
(upd_ship, ship_repair, min, dmin, MIN):
Remove min() and dmin() functions and replace
with a MIN macro in misc.h.  Remove local MIN
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.

(fuel, look_ship, multifire, mission, sona)
(plane_sona, ef_open, player_accept, player_main)
(ac_dog, att_get_combat, calc_mobcost)
(ask_move_in_off, intelligence_report)
(build_mission_list_type, perform_mission)
(show_mission, use_supply, dodistribute)
(allocate_memory, max, dmax, MAX):
Remove max() and dmax() functions and replace
with a MAX macro in misc.h.  Remove local MAX
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.
2006-01-12 14:23:55 +00:00
Ron Koenderink
e28c14f023 (L_XLIGHT, lchr[], land_chr_flags[], take_plane_off_land,
put_plane_on_land, load_plane_land, can_fly):
Remove L_XLIGHT flag and replace with checks of lnd_maxlight.
Closes #758459.
2006-01-08 19:12:04 +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
cc0c3e4f3f (drop): A mining mission targeting land called pln_dropoff() instead
of pln_mine().  pln_dropoff() happens to do pretty much the right
thing, but...
(pln_mine): Refuse to mine land.
2005-12-23 19:37:52 +00:00
ea93842927 (pln_equip): New mission argument 'm' for mining. 'd' is now for
cargo drops only.  Callers changed.
2005-12-22 19:48:33 +00:00
8e12bb8574 Previous rev. assumes would_abandon() returns 0 or 1. Correct, but
unmodular.  Don't.
2005-12-22 19:27:26 +00:00
Ron Koenderink
9113969208 (pln_equip): Do not abandon sector for paradrop, drop or fly.
Closes #982226
2005-11-22 20:10:15 +00:00
af32304af0 (get_assembly_point): Close loophole that allowed players to find all
unowned sectors.  The assembly point must now be owned or allied, or
have an owned or allied ship.

Info pages didn't match the old rule.  Fix them to match the new rule.
2005-10-04 07:20:37 +00:00
caac6e41ca (get_assembly_point): New.
(bomb, drop, fly, para, reco): Use it.
2005-10-01 14:07:35 +00:00
1d88b8783a (plist): Member state is used write-only, remove.
(P_OK, P_FIRED, P_DEL): Unused, remove.
2005-09-30 20:44:43 +00:00
4d25aa9f03 (pln_equip): Fix the previous rev. 2005-07-09 13:59:01 +00:00
f7b444721b (mission_pln_equip, pln_equip): Fix the previous rev. 2005-07-09 13:32:54 +00:00