Commit graph

56 commits

Author SHA1 Message Date
ed9da7cf06 Update known contributors comments 2008-08-03 08:04:08 -04:00
3cc8de8aef Fix extra prompt after abort due to misuse of snxtitem()
The old code used getstarg() to get an argument with a different
prompt than snxtitem() uses, then passed the value to snxtitem()
unchecked.  If the player aborts, getstarg() returns a null pointer,
and snxtitem() prompts again.  Affected:

* load/lload plane/land third argument; load_plane_ship(),
  load_land_ship(), load_plane_land(), load_land_land()

* bomb, drop, fly, paradrop, recon and sweep second argument;
  get_planes()

* tend and ltend second and fourth argument; ltend(), tend(),
  tend_land()

* mission second argument; mission()

Fix by making snxtitem() taking a prompt argument, null pointer
requests the old prompt.

Use that to simplify multifire() and torp().  Change the other callers
to pass NULL.
2008-07-26 21:36:37 -04:00
9eda5f87b8 Fix command abortion after getting player input
The old code didn't honor command abortion at the following prompts:

* arm third argument

* deliver fourth argument (also simplify)

* fire third argument

* fly and recon prompt for carrier to land on: pln_onewaymission()
  treated abort like empty input, which made planes attempt landing in
  the sector.

* lmine second argument

* order d fourth argument

* power c nat(s) argument

* range second argument

* sail second argument

* shutdown both arguments (first one was broken in commit 84cfd670,
  v4.3.10, second one never worked).

* tend third argument
2008-07-21 07:19:18 -04:00
Ron Koenderink
aab015c641 Allow deity to display power report for all types of countries
Relax country status check of power c for deities.  Can be useful to
display NPCs.
2008-04-20 15:11:09 +02:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
Ron Koenderink
5cb735f3a7 Fix how tech is factored into power. Broken in 1.31 and almost fixed
in 1.33.
2007-09-20 02:48:52 +00:00
c940c76a01 (gen_power) [!_WIN32]: Previous revision inserted fsync(), where
previously something equivalent was done only for _WIN32.  Revert
that.
2007-08-24 17:22:12 +00:00
Ron Koenderink
4bbc3f4286 Simple POSIX I/O emulation layer to work around Windows's defective
Unix I/O:
[_WIN32] (socklen_t, accept, posix_accept, bind. posix_bind, listen)
(posix_listen, setsockopt, posix_setsockopt, shutdown, posix_shutdown)
(socket, posix_socket, close, posix_close, creat, fstat, posix_fstat)
(lseek, posix_lseek, open, posix_open, read, posix_read, write)
(posix_write, fileno, posix_fileno, fcntl, O_NONBLOCK, F_RDLCK)
(F_WRLCK, F_GETFL, F_SETFL, F_SETLK, EWOULDBLOCK, ENOTSOCK)
(flock, fsync, posix_fsync):
New.
(ef_open, io_close, io_input, io_output, io_shutdown, io_noblocking)
(player_accept): Use them to simplify.
[_WIN32] (posix_fd2socket): New.
(empth_select): Use it.
(gen_power): Use it.
2007-08-14 03:33:28 +00:00
f691a07814 Fix the previous revision. 2007-07-25 19:35:09 +00:00
2e3ca36369 (powe): Don't tell user to run power new when it is disabled by
AUTO_POWER.
2007-03-24 17:31:36 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
6b70720318 New option AUTO_POWER; closes #1009993:
(opt_AUTO_POWER, update_power): New.
(update_main): Implement AUTO_POWER.
(powe): Disable power new when AUTO_POWER is on.

(powe): New power update.
(gen_power): Compute power into buffer passed by caller, make write to
power file optional.
2006-12-31 16:56:34 +00:00
2c0416135e (genpower, powcmp): Sort struct powstr powbuf[] instead of struct
powsort order[].  Marginally less efficient, but simpler.
(powsort): Unused, remove.
2006-12-31 13:38:46 +00:00
7d90028f20 (out5): Rev. 1.36. didn't fully fix the format conditional.
Fold negative cases into positive ones.
2006-09-23 15:47:40 +00:00
Ron Koenderink
911a553a65 (powe): Remove unused local variable.
Remove CR's.
2006-07-13 21:17:00 +00:00
Ron Koenderink
d413884a37 [_WIN32, __GNUC__]: Reorganize the include files for WIN32 to
separate the MinGW environment from the MSVC environment and
WIN32 environment.  Reorganize the order of the includes so
the system files are always loaded first to prevent with misc.h defines.
Remove system file includes from misc.h.
2006-07-13 21:14:16 +00:00
51baf40e90 (powe): Fix `pow n' not to ignore second argument when BTUs don't
suffice for `n'.
2006-07-13 20:07:41 +00:00
b27c7ea77d (powe): Simplify evaluation of arg 1. No functional change. 2006-07-13 19:57:56 +00:00
7282d4d639 (prpower): New, factored out of powe(). No functional change. 2006-07-13 19:41:05 +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
5091956480 (out5): Conditional chose formats incorrectly, e.g. 9999 was printed
as 10.0K instead of 10K.  Could make power report columns run
together.
2006-06-24 17:09:20 +00:00
039907d306 Update known contributors comment. 2006-05-29 21:23:33 +00:00
9e15c62d7d (powe): Simplify.
(gen_power): Remove redundant parenthesis.
2006-05-16 20:06:24 +00:00
5258e63b48 Fix rev. 1.31. 2006-05-16 19:54:33 +00:00
6e3b478377 (powe): Rewrite computation of targets[] for power c using
snxtitem()/nxtitem(), for simplicity and more uniform syntax.  Country
names no longer work when specifying more than one country (snxtitem()
restriction).  As usual with nxtitem(), silently ignore unsuitable
items (the old code complained and failed).  Don't skip powerless
countries for power c.  Closes #1025607.
(set_target): Unused, remove.
2006-05-16 18:59:19 +00:00
e94c6e5a3e (gen_power): Simplify. 2006-04-30 18:25:50 +00:00
a988b907fc s_char purge directed by compiler warnings. 2006-04-29 06:41:45 +00:00
Ron Koenderink
3db7e6201f (powe_cost): Remove powe_cost and replace with a fixed cost of 10. 2006-02-04 19:36:51 +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
d21d7a0230 (set_target): Simplify using natarg(). 2006-01-06 18:07:30 +00:00
57808ef10c (set_target): Improve rejection message. 2006-01-06 14:20:03 +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
41c2c27376 (powe): Simplify. 2006-01-04 22:04:52 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
Ron Koenderink
4799984997 (gen_power): Do not include land units with spy capability in the
land unit count. Closes #910398.
2005-12-17 12:41:39 +00:00
e29f288289 Remove silly superflous parenthesis. 2005-12-03 21:14:26 +00:00
4f59fc9967 Remove a bunch of redundant casts. 2005-06-12 06:31:48 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
0aaf0084aa (as_extend, as_costcomp, gen_power, powcmp): Fix non-portable function
cast.
(qsort_func_t): Unused, remove.
2005-02-24 18:47:26 +00:00
Ron Koenderink
bca00f35f5 (powe): Do not round totals for deity countries. 2005-02-22 01:28:43 +00:00
Ron Koenderink
aebdf80864 (powe): Fix the deity check to use player->god instead of
player->cnum == 0.  Partial Fix for #863419.
2005-02-21 20:35:37 +00:00
ff67d93711 (max_population): New, factored out of max_pop().
(max_pop): Use it.  Don't support null argument anymore.
(nati, gen_power): Use max_population() instead of max_pop() with null
argument.
(show_sect_stats): Use max_population() to simplify the code.
(prod, upd_buildeff): Use max_population() to get correct new maximum
population for limiting work when tearing down a big city.
Previously, this was broken in upd_buildeff().  In prod(), it was
broken when the new designation had odd maximum population, which
should not occur.
2005-02-17 21:04:08 +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
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
b387ed3b6c (gen_power): Force mtime update under Windows. From Ron Koenderink. 2004-03-17 06:40:44 +00:00
d64fa8d529 (opt_NEWPOWER, Options, gen_power): Remove nooption NEWPOWER.
(opt_NEW_STARVE, Options, feed_ship, feed_people): Remove nooption
NEW_STARVE.

(opt_NEW_WORK, Options, move, explore): Remove nooption NEW_WORK.
2004-03-11 10:36:55 +00:00
e6ffdb71ee (gen_power, addtopow): Call addtopow() directly on item arrays instead
of copies made by getvec().  This is obviously correct, since there
are no writes.
2004-03-05 13:20:11 +00:00
46da1aec7a deity.h is redundant, remove it. 2004-02-20 20:34:43 +00:00