diff --git a/include/chance.h b/include/chance.h new file mode 100644 index 00000000..194dcf02 --- /dev/null +++ b/include/chance.h @@ -0,0 +1,40 @@ +/* + * Empire - A multi-player, client/server Internet based war game. + * Copyright (C) 1986-2012, Dave Pare, Jeff Bailey, Thomas Ruschak, + * Ken Stevens, Steve McClure, Markus Armbruster + * + * Empire is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --- + * + * See files README, COPYING and CREDITS in the root of the source + * tree for related information and legal notices. It is expected + * that future projects/authors will amend these files as needed. + * + * --- + * + * chance.h: Roll dice + * + * Known contributors to this file: + * Markus Armbruster, 2012 + */ + +#ifndef CHANCE_H +#define CHANCE_H + +extern int chance(double); +extern int roll(int); +extern int roundavg(double); + +#endif diff --git a/include/prototypes.h b/include/prototypes.h index 7eb82df6..5514d3ab 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -306,9 +306,6 @@ extern int fsize(int); extern int blksize(int); extern time_t fdate(int); -extern int roll(int); -extern int roundavg(double); -extern int chance(double); extern int disassoc(void); extern char *effadv(int); extern int parse(char *, char *, char **, char **, char **, char **); diff --git a/src/lib/commands/anti.c b/src/lib/commands/anti.c index 0da59209..174b1dd2 100644 --- a/src/lib/commands/anti.c +++ b/src/lib/commands/anti.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "commands.h" #include "item.h" #include "optlist.h" diff --git a/src/lib/commands/assa.c b/src/lib/commands/assa.c index bc794ae7..1ff03601 100644 --- a/src/lib/commands/assa.c +++ b/src/lib/commands/assa.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "combat.h" #include "commands.h" #include "empobj.h" diff --git a/src/lib/commands/bomb.c b/src/lib/commands/bomb.c index 6ae775b9..9ebd780c 100644 --- a/src/lib/commands/bomb.c +++ b/src/lib/commands/bomb.c @@ -36,6 +36,7 @@ #include #include +#include "chance.h" #include "commands.h" #include "damage.h" #include "item.h" diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index c4c76c1c..58bafa32 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -34,6 +34,7 @@ #include #include +#include "chance.h" #include "commands.h" #include "game.h" #include "land.h" diff --git a/src/lib/commands/buy.c b/src/lib/commands/buy.c index 33ab044e..e7a8ef70 100644 --- a/src/lib/commands/buy.c +++ b/src/lib/commands/buy.c @@ -34,6 +34,7 @@ #include +#include "chance.h" #include "commands.h" #include "commodity.h" #include "item.h" diff --git a/src/lib/commands/conv.c b/src/lib/commands/conv.c index d442e9ab..e2dfbe81 100644 --- a/src/lib/commands/conv.c +++ b/src/lib/commands/conv.c @@ -36,6 +36,7 @@ #include +#include "chance.h" #include "commands.h" #include "land.h" diff --git a/src/lib/commands/enli.c b/src/lib/commands/enli.c index b6061354..7986ed52 100644 --- a/src/lib/commands/enli.c +++ b/src/lib/commands/enli.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "commands.h" #include "treaty.h" diff --git a/src/lib/commands/laun.c b/src/lib/commands/laun.c index 2cdfb996..3078782a 100644 --- a/src/lib/commands/laun.c +++ b/src/lib/commands/laun.c @@ -35,6 +35,7 @@ #include +#include "chance.h" #include "commands.h" #include "damage.h" #include "mission.h" diff --git a/src/lib/commands/look.c b/src/lib/commands/look.c index f3b716a5..d5d2d668 100644 --- a/src/lib/commands/look.c +++ b/src/lib/commands/look.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "commands.h" #include "empobj.h" #include "map.h" diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index 31a22d3a..b6c7da2f 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "commands.h" #include "empobj.h" #include "news.h" diff --git a/src/lib/commands/move.c b/src/lib/commands/move.c index c83de66e..95f6c885 100644 --- a/src/lib/commands/move.c +++ b/src/lib/commands/move.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "commands.h" #include "item.h" #include "map.h" diff --git a/src/lib/commands/rea.c b/src/lib/commands/rea.c index 1b927bc1..aaf57350 100644 --- a/src/lib/commands/rea.c +++ b/src/lib/commands/rea.c @@ -39,6 +39,7 @@ #include #include #include +#include "chance.h" #include "commands.h" #include "match.h" #include "misc.h" diff --git a/src/lib/commands/sabo.c b/src/lib/commands/sabo.c index 6af8a1a7..44ff4c76 100644 --- a/src/lib/commands/sabo.c +++ b/src/lib/commands/sabo.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "commands.h" #include "land.h" diff --git a/src/lib/commands/shoo.c b/src/lib/commands/shoo.c index 04148953..3261a982 100644 --- a/src/lib/commands/shoo.c +++ b/src/lib/commands/shoo.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "commands.h" #include "item.h" #include "land.h" diff --git a/src/lib/commands/sona.c b/src/lib/commands/sona.c index 6206577e..0f27f300 100644 --- a/src/lib/commands/sona.c +++ b/src/lib/commands/sona.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "commands.h" #include "map.h" #include "optlist.h" diff --git a/src/lib/commands/spy.c b/src/lib/commands/spy.c index f9783010..60505d50 100644 --- a/src/lib/commands/spy.c +++ b/src/lib/commands/spy.c @@ -34,6 +34,7 @@ #include +#include "chance.h" #include "commands.h" #include "item.h" #include "land.h" diff --git a/src/lib/commands/torp.c b/src/lib/commands/torp.c index 1cdd7ba6..cddf1c46 100644 --- a/src/lib/commands/torp.c +++ b/src/lib/commands/torp.c @@ -36,6 +36,7 @@ #include +#include "chance.h" #include "commands.h" #include "news.h" #include "retreat.h" diff --git a/src/lib/commands/trad.c b/src/lib/commands/trad.c index a524b65f..ed587962 100644 --- a/src/lib/commands/trad.c +++ b/src/lib/commands/trad.c @@ -35,6 +35,7 @@ #include #include +#include "chance.h" #include "commands.h" #include "commodity.h" #include "empobj.h" diff --git a/src/lib/commands/work.c b/src/lib/commands/work.c index ddf6c6c0..8675b64a 100644 --- a/src/lib/commands/work.c +++ b/src/lib/commands/work.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "commands.h" #include "land.h" #include "optlist.h" diff --git a/src/lib/common/btu.c b/src/lib/common/btu.c index 4c23c152..d3796b69 100644 --- a/src/lib/common/btu.c +++ b/src/lib/common/btu.c @@ -32,10 +32,10 @@ #include +#include "chance.h" #include "file.h" #include "nat.h" #include "optlist.h" -#include "prototypes.h" #include "sect.h" /* diff --git a/src/lib/gen/chance.c b/src/lib/gen/chance.c index 535f4f34..284680b1 100644 --- a/src/lib/gen/chance.c +++ b/src/lib/gen/chance.c @@ -33,7 +33,8 @@ #include #include -#include "prototypes.h" +#include +#include "chance.h" int chance(double d) diff --git a/src/lib/player/player.c b/src/lib/player/player.c index b68622f8..5f2719ed 100644 --- a/src/lib/player/player.c +++ b/src/lib/player/player.c @@ -34,6 +34,7 @@ #include +#include "chance.h" #include "empio.h" #include "empthread.h" #include "file.h" diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index 7d477319..abc35153 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -35,6 +35,7 @@ #include +#include "chance.h" #include "file.h" #include "land.h" #include "map.h" diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index 5f3bbe71..292c71f7 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -36,6 +36,7 @@ #include #include +#include "chance.h" #include "combat.h" #include "empobj.h" #include "file.h" diff --git a/src/lib/subs/damage.c b/src/lib/subs/damage.c index 43d42489..4c0f8f9c 100644 --- a/src/lib/subs/damage.c +++ b/src/lib/subs/damage.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "damage.h" #include "land.h" #include "misc.h" diff --git a/src/lib/subs/detonate.c b/src/lib/subs/detonate.c index a60923ad..4204d262 100644 --- a/src/lib/subs/detonate.c +++ b/src/lib/subs/detonate.c @@ -33,6 +33,7 @@ #include +#include "chance.h" #include "file.h" #include "land.h" #include "map.h" diff --git a/src/lib/subs/landgun.c b/src/lib/subs/landgun.c index 14ebcdf9..fc6f3607 100644 --- a/src/lib/subs/landgun.c +++ b/src/lib/subs/landgun.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "damage.h" #include "file.h" #include "land.h" diff --git a/src/lib/subs/list.c b/src/lib/subs/list.c index fd6366ec..32f1997e 100644 --- a/src/lib/subs/list.c +++ b/src/lib/subs/list.c @@ -33,6 +33,7 @@ #include #include +#include "chance.h" #include "file.h" #include "land.h" #include "misc.h" diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index a4bc04ac..8c4f6c3f 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -36,6 +36,7 @@ #include #include +#include "chance.h" #include "combat.h" #include "damage.h" #include "empobj.h" diff --git a/src/lib/subs/mission.c b/src/lib/subs/mission.c index 04685dd0..08debd42 100644 --- a/src/lib/subs/mission.c +++ b/src/lib/subs/mission.c @@ -35,6 +35,7 @@ #include #include +#include "chance.h" #include "empobj.h" #include "file.h" #include "item.h" diff --git a/src/lib/subs/move.c b/src/lib/subs/move.c index ac06d7d2..61fd3a41 100644 --- a/src/lib/subs/move.c +++ b/src/lib/subs/move.c @@ -33,6 +33,7 @@ #include #include +#include "chance.h" #include "damage.h" #include "file.h" #include "map.h" diff --git a/src/lib/subs/mslsub.c b/src/lib/subs/mslsub.c index a8a5ddec..f2aaf01c 100644 --- a/src/lib/subs/mslsub.c +++ b/src/lib/subs/mslsub.c @@ -35,6 +35,7 @@ #include #include +#include "chance.h" #include "file.h" #include "misc.h" #include "nat.h" diff --git a/src/lib/subs/nreport.c b/src/lib/subs/nreport.c index c6797b88..b1020b75 100644 --- a/src/lib/subs/nreport.c +++ b/src/lib/subs/nreport.c @@ -35,6 +35,7 @@ #include +#include "chance.h" #include "file.h" #include "nat.h" #include "news.h" diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index f0ce3334..b0a4bd3b 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -35,6 +35,7 @@ #include +#include "chance.h" #include "empobj.h" #include "file.h" #include "item.h" diff --git a/src/lib/subs/retreat.c b/src/lib/subs/retreat.c index ce210bc7..c62aca55 100644 --- a/src/lib/subs/retreat.c +++ b/src/lib/subs/retreat.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "damage.h" #include "file.h" #include "land.h" diff --git a/src/lib/subs/satmap.c b/src/lib/subs/satmap.c index 58512a45..e016e54d 100644 --- a/src/lib/subs/satmap.c +++ b/src/lib/subs/satmap.c @@ -34,6 +34,7 @@ #include #include +#include "chance.h" #include "file.h" #include "land.h" #include "map.h" diff --git a/src/lib/subs/shpsub.c b/src/lib/subs/shpsub.c index e7963f73..364e5487 100644 --- a/src/lib/subs/shpsub.c +++ b/src/lib/subs/shpsub.c @@ -35,6 +35,7 @@ #include #include +#include "chance.h" #include "damage.h" #include "empobj.h" #include "file.h" diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index 398096ea..ff084dc2 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -33,6 +33,7 @@ #include #include +#include "chance.h" #include "empobj.h" #include "file.h" #include "land.h" diff --git a/src/lib/subs/takeover.c b/src/lib/subs/takeover.c index e754c40b..3a2ec8ea 100644 --- a/src/lib/subs/takeover.c +++ b/src/lib/subs/takeover.c @@ -34,6 +34,7 @@ #include +#include "chance.h" #include "file.h" #include "empobj.h" #include "game.h" diff --git a/src/lib/update/age.c b/src/lib/update/age.c index 1ee6f48e..4f572a73 100644 --- a/src/lib/update/age.c +++ b/src/lib/update/age.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "update.h" int diff --git a/src/lib/update/human.c b/src/lib/update/human.c index f5f4905b..56d0a8fd 100644 --- a/src/lib/update/human.c +++ b/src/lib/update/human.c @@ -35,6 +35,7 @@ #include #include +#include "chance.h" #include "item.h" #include "news.h" #include "player.h" diff --git a/src/lib/update/land.c b/src/lib/update/land.c index 27c0ff10..8b8a783f 100644 --- a/src/lib/update/land.c +++ b/src/lib/update/land.c @@ -37,6 +37,7 @@ #include #include "budg.h" +#include "chance.h" #include "land.h" #include "lost.h" #include "news.h" diff --git a/src/lib/update/material.c b/src/lib/update/material.c index 024c36fe..f4487996 100644 --- a/src/lib/update/material.c +++ b/src/lib/update/material.c @@ -34,6 +34,7 @@ #include #include "budg.h" +#include "chance.h" #include "player.h" #include "update.h" diff --git a/src/lib/update/plague.c b/src/lib/update/plague.c index d2c3a622..0cfbfe37 100644 --- a/src/lib/update/plague.c +++ b/src/lib/update/plague.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "item.h" #include "lost.h" #include "news.h" diff --git a/src/lib/update/plane.c b/src/lib/update/plane.c index d6ae2894..e5be2988 100644 --- a/src/lib/update/plane.c +++ b/src/lib/update/plane.c @@ -35,6 +35,7 @@ #include #include "budg.h" +#include "chance.h" #include "lost.h" #include "plane.h" #include "player.h" diff --git a/src/lib/update/populace.c b/src/lib/update/populace.c index 57a948e7..e87da3ce 100644 --- a/src/lib/update/populace.c +++ b/src/lib/update/populace.c @@ -32,6 +32,7 @@ #include +#include "chance.h" #include "lost.h" #include "update.h" diff --git a/src/lib/update/produce.c b/src/lib/update/produce.c index e88bb3f8..f0dec1ed 100644 --- a/src/lib/update/produce.c +++ b/src/lib/update/produce.c @@ -33,6 +33,7 @@ #include #include "budg.h" +#include "chance.h" #include "player.h" #include "product.h" #include "update.h" diff --git a/src/lib/update/revolt.c b/src/lib/update/revolt.c index f93c783e..4818f1d9 100644 --- a/src/lib/update/revolt.c +++ b/src/lib/update/revolt.c @@ -34,6 +34,7 @@ #include +#include "chance.h" #include "land.h" #include "lost.h" #include "news.h" diff --git a/src/lib/update/sect.c b/src/lib/update/sect.c index 2723c8c6..99310647 100644 --- a/src/lib/update/sect.c +++ b/src/lib/update/sect.c @@ -35,6 +35,7 @@ #include #include "budg.h" +#include "chance.h" #include "item.h" #include "land.h" #include "lost.h" diff --git a/src/lib/update/ship.c b/src/lib/update/ship.c index 876be4f9..e28c8c2f 100644 --- a/src/lib/update/ship.c +++ b/src/lib/update/ship.c @@ -37,6 +37,7 @@ #include #include "budg.h" +#include "chance.h" #include "land.h" #include "lost.h" #include "news.h"