Commit graph

71 commits

Author SHA1 Message Date
bb467c335d Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:33:48 +01:00
5f46ced826 Use int instead of long for money
Code dealing with money mixes int and long pretty haphazardly.
Harmless, because practical amounts of money fit into int on any
machine capable of running the server.  Clean up anyway.
2013-05-08 06:57:54 +02:00
5ed02791f5 Fix melting of big piles of stuff by ridiculously heavy fallout
meltitems() computes #items * etus per update * fallout in type long.
Theoretical maximum is ITEM_MAX * etus * FALLOUT_MAX = 99980001 *
etus.  Can overflow 32 bits for etus > 21.  Has been broken since the
introduction of fallout in KSU.

Compute the product in double instead.
2013-05-08 06:57:54 +02:00
8eb78a5a80 Move declarations for chance.c to new chance.h 2013-05-08 06:55:20 +02: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
786e2a99d5 Clean up superfluous includes 2012-04-26 19:57:19 +02: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
7465574195 Break long lines more tastefully 2010-06-20 18:36:44 +02:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
44c36fa7d5 Make sector maintenance cost configurable
Replace the fixed $1 per ETU maintenance for capital/city sectors that
are at least 60% efficient by a configurable maintenance cost, payable
regardless of efficiency.  The only change in the default
configuration is that inefficient capitals now pay maintenance.
Charging sector maintenance regardless of efficiency is consistent
with unit maintenance.

New struct dchrstr member d_maint and sector-chr selector maint.  Make
show_sect_build() show it.  Change produce_sect() to record
maintenance in new slot p_sect[SCT_MAINT] instead of abusing
p_sect[SCT_CAPIT].  Replace the "Capital maintenance" line in budget
by "Sector maintenance".
2009-07-19 13:58:47 -04: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
ee20a9cd34 Update known contributors comments 2009-02-18 21:11:33 +01:00
7da69c92e0 Don't use automatic supply to avoid starvation at the update
Food supply during update adds complexity to the update.  How much
good it does to players is highly doubtful; certainly nobody can rely
on it.  It isn't covered by the starvation command.  Starving ships or
land units can steal enough food from their sector to make it starve,
too.  Finally, the supply code is notoriously hard to use correctly.
We don't know of issues with the update's use, but we haven't
convinced ourselves that there aren't any either.
2009-02-15 12:51:05 +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
b7c7fa00e1 Fix capital maintenance to charge at 60% efficiency
produce_sect() started to charge at 61%.  Has always been that way.
2008-08-02 15:46:35 -04:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
265e71efa8 Remove superfluous parenthesis. 2007-12-14 07:49:58 +00:00
09a842c1a0 Consistently consider a nation bankrupt when its treasury is
negative.  Some places considered $0 as bankrupt, some didn't.  Fix
the ones that did:
(repo_list): report command misreported countries with $0 as broke.
(init_nats): If you had $0, logging out and back in bankrupted you.
(produce_sect, upd_ship): Failed to build sectors and produce stuff
for countries with $0.
2007-12-08 14:46:40 +00:00
8c65fbc2be (produce_sect): Use bp_put_items() after calls that may update vec[].
This is more robust than using bp_put_item() for those elements of
vec[] that the call may change.  The old code missed some changes:
upd_buildeff() changing population when tearing down a big city,
enlist(), and produce().  The first two should have been harmless, the
last one made budget mispredict repairs when required materials were
produced in the same update.
2007-01-14 10:07:37 +00:00
502e283ea0 (do_feed, produce_sect): Move bp_put_item() calls from do_feed() to
produce_sect(), for consistency with the other update functions that
update sct_item[].  Parameter bp is now unused, remove.
2007-01-14 10:03:19 +00:00
613e71acb3 (produce_sect): Don't truncate population; that's already done in
do_feed().
2007-01-14 08:59:07 +00:00
c9c06d4fbe (alloc_bp, bp_alloc): Rename.
(fill_update_array, bp_set_from_sect): Rename.
(gt_bg_nmbr, pt_bg_nmbr, bp_get_item, bp_get_avail, bp_put_item,
bp_put_avail): Separate accessor functions for item and avail.
2007-01-13 17:11:17 +00:00
5507e8a1dc Replace the revolting build pointer data structure by a proper data
type.  Make it abstract because that's possible.  Change data layout
so that the slots belonging to a sector are together in memory, it's
nicer to the cache.
(bp): The new type.  Users changed.
(get_wp): Update accordingly.
(alloc_bp): New.
(update_main, calc_all): Use it.  Before, calc_all() allocated 1/7
more than necessary.
2007-01-13 09:07:59 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
25dece0a3d (produce_sect): Game state changes may be changed only if
player->simulation.  Fix a missing guard.  Existing callers should not
need it.
2006-09-23 10:47:58 +00:00
8da88626d5 (produce_sect, finish_sects): Move stop order expiry to end of update,
so that stopped sectors don't repair units.  The update sequence
masked this bug until its change in src/lib/update/main.c rev. 1.25,
but use of budget priorities (gone since rev. 1.24) could unmask it.
2006-09-23 10:37:55 +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
42e7e3e389 Fix the previous revision. 2006-06-23 06:07:36 +00:00
a7393becc0 (produce_sect, update_main): Charge capital maintenance in
produce_sect(), just like all the other sector costs.
2006-06-22 17:16:31 +00:00
15a1a06101 Doc fix. 2006-06-14 18:14:40 +00:00
f284b0beab (P_SHELL, P_GUN, P_PETROL, P_IRON, P_DUST, P_BAR, P_FOOD, P_OIL)
(P_LCM, P_HCM, P_TLEV, P_RLEV, P_ELEV, P_HLEV, P_URAN): Use -1 instead
of 0 for `no product', shift down product indexes and update
product.config and sector.config accordingly.
(budg, prod, show_sect_capab, produce, produce_sect): Adapt test for
no product.
(ef_elt_byname): Remove the hack to hide pchr[0].
(prod_eff): Oops on no product.
2006-06-05 17:44:25 +00:00
520446ef39 Remove budget priorities:
(budg, player_coms): Remove command arguments.
(PRI_SMAINT, PRI_PMAINT, PRI_LMAINT, PRI_SBUILD, PRI_PBUILD)
(PRI_LBUILD, PRI_MAX): Remove.
(natstr): Remove member nat_priorities.
(add, main): Remove its initialization.
(budg, cal_call, prexpense, prod, update_main, upd_land, upd_plane)
(upd_buildeff, produce_sect, upd_ship): Simplify.
(produce_sect): Last parameter now superflous, remove & simplify.
(change_prio, do_prod): Unused, remove.

(budg): Move land units output down, to match update sequence.
2006-05-29 20:43:30 +00:00
cd73a47dfa Remove superflous casts and parenthesis. 2006-05-21 12:24:30 +00:00
d906fd6b99 DEFENSE_INFRA was implemented in an odd way: sct_defense was used
regardless of the option, but forced to sct_effic when disabled.  This
screws up sct_defense when you disable DEFENSE_INFRA.  Implement it
more like FALLOUT: use sct_defense if enabled, else sct_effic.  The
change should be invisible except in xdump, which shows the real
sct_defense.  Closes #804641.
(SCT_DEFENSE): New.
(dump, sinfra, sector_strength): Use it.
(eff_bomb, build_bridge, build_tower, new, buildeff, sect_damage)
(put_combat, checksect, produce_sect): Don't force sct_defense to
sct_effic when DEFENSE_INFRA is disabled.
2006-05-20 11:53:20 +00:00
e09e6e587b Normalize long int and short int to just long and short. 2006-04-30 12:05:23 +00:00
0d0a305bf3 Remove silly superflous parenthesis. 2006-03-26 07:46:49 +00:00
8054aafb9a (u_char, u_short, u_int): BSDisms. Figuring out whether sys/types.h
defines them would be possible, but isn't worth the trouble.  Replace
by unabbreviated types.
2006-03-25 07:05:34 +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
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
Ron Koenderink
a2798857cf (fuel, load, prod, max_population, shp_nav_one_sector,
nav_loadship, upd_buildeff): Identify BIG_CITY
(IS_BIG_CITY) by using packing type of UPKG instead of
opt_BIG_CITY and sector type of SCT_CAPITAL.
2005-11-14 13:52:12 +00:00
Ron Koenderink
fd81bf86eb (meltitems): Remove unnecessary checks. 2005-07-25 13:12:22 +00:00
Ron Koenderink
7920252986 (meltitems): Move melt_item_denom into the ichr structure. 2005-07-24 22:20:05 +00:00
c41c45be61 Delete some code that has been disabled out for ages and looks
useless or wrong.
2005-07-23 18:35:07 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
590cfe674a [GODZILLA]: Incomplete, unused, remove. 2005-03-12 13:27:13 +00:00