static int build_bridge(char);
static int build_bspan(struct sctstr *sp);
static int build_btower(struct sctstr *sp);
-static void build_material_use(short[], short[], int);
static int sector_can_build(struct sctstr *, short[], int, int, char *);
static void build_charge(struct sctstr *, short[], int, double, int);
static int build_can_afford(double, int, char *);
build_ship(struct sctstr *sp, int type, int tlev)
{
struct mchrstr *mp = &mchr[type];
- short mat[I_MAX+1], mat_100[I_MAX+1];
+ short mat[I_MAX+1];
int work;
struct shpstr ship;
- memset(mat_100, 0, sizeof(mat_100));
- mat_100[I_LCM] = mp->m_lcm;
- mat_100[I_HCM] = mp->m_hcm;
- build_material_use(mat, mat_100, SHIP_MINEFF);
+ memset(mat, 0, sizeof(mat));
+ mat[I_LCM] = mp->m_lcm;
+ mat[I_HCM] = mp->m_hcm;
work = SHP_BLD_WORK(mp->m_lcm, mp->m_hcm);
if (sp->sct_type != SCT_HARBR) {
build_land(struct sctstr *sp, int type, int tlev)
{
struct lchrstr *lp = &lchr[type];
- short mat[I_MAX+1], mat_100[I_MAX+1];
+ short mat[I_MAX+1];
int work;
struct lndstr land;
- memset(mat_100, 0, sizeof(mat_100));
- mat_100[I_LCM] = lp->l_lcm;
- mat_100[I_HCM] = lp->l_hcm;
- build_material_use(mat, mat_100, LAND_MINEFF);
+ memset(mat, 0, sizeof(mat));
+ mat[I_LCM] = lp->l_lcm;
+ mat[I_HCM] = lp->l_hcm;
work = LND_BLD_WORK(lp->l_lcm, lp->l_hcm);
if (sp->sct_type != SCT_HEADQ) {
build_plane(struct sctstr *sp, int type, int tlev)
{
struct plchrstr *pp = &plchr[type];
- short mat[I_MAX+1], mat_100[I_MAX+1];
+ short mat[I_MAX+1];
int work;
struct plnstr plane;
double eff = PLANE_MINEFF / 100.0;
/* Always use at least 1 mil to build a plane */
if (mil == 0 && pp->pl_crew > 0)
mil = 1;
- memset(mat_100, 0, sizeof(mat_100));
- mat_100[I_LCM] = pp->pl_lcm;
- mat_100[I_HCM] = pp->pl_hcm;
- build_material_use(mat, mat_100, PLANE_MINEFF);
+ memset(mat, 0, sizeof(mat));
+ mat[I_LCM] = pp->pl_lcm;
+ mat[I_HCM] = pp->pl_hcm;
work = PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm);
if (sp->sct_type != SCT_AIRPT && !player->god) {
return 1;
}
-static void
-build_material_use(short mat[], short mat_100[], int effic)
-{
- int i;
-
- for (i = I_MAX; i > I_NONE; i--) {
- mat[i] = mat_100[i] ? roundavg(mat_100[i] * (effic / 100.0)) : 0;
- }
-}
-
static int
sector_can_build(struct sctstr *sp, short mat[], int work,
int effic, char *what)
{
int i, avail;
+ double needed;
if (sp->sct_effic < 60 && !player->god) {
pr("Sector %s is not 60%% efficient.\n",
}
for (i = I_NONE + 1; i <= I_MAX; i++) {
- if (sp->sct_item[i] < mat[i]) {
+ needed = mat[i] * (effic / 100.0);
+ if (sp->sct_item[i] < needed) {
pr("Not enough materials in %s\n",
xyas(sp->sct_x, sp->sct_y, player->cnum));
return 0;
}
+ mat[i] = roundavg(needed);
}
avail = (work * effic + 99) / 100;
0 -6 0 0 0 0 0 0 0 0 0 0 0 -6 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
0 -4 0 0 0 0 0 0 0 0 0 0 0 -4 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
1 -2 0 5 100 127 0 0 0 0 0 0 0 -2 0 0 0 0 1 5 0 0 0 0 0 1 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
-2 1 1 14 100 127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 0 0 0 0
+3 4 2 26 60 127 0 0 0 0 0 0 0 4 2 7 0 0 0 26 0 0 0 0 0 3 100 0 0 0 0 0 0 0 0 0 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
3 6 2 26 59 127 0 0 0 0 0 0 0 6 2 11 0 0 1 26 0 0 0 0 0 3 100 50 0 0 0 0 0 0 0 500 500 500 0 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
0 8 2 0 0 0 0 0 0 0 0 0 0 8 2 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
0 -10 2 0 0 0 0 0 0 0 0 0 0 -10 2 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
Play#2 output Play#2 1 Thu Jan 1 00:00:00 1970
Play#2 output Play#2 1 COMMODITIES deliver-- distribute
Play#2 output Play#2 1 sect sgpidbolhr sgpidbolhr sh gun pet iron dust bar oil lcm hcm rad
- Play#2 output Play#2 1 1,1 * .......... .......... 0 0 0 0 0 0 0 3 4 0
- Play#2 output Play#2 1 3,1 * .......... .......... 0 0 0 0 0 0 0 3 3 0
+ Play#2 output Play#2 1 1,1 * .......... .......... 0 0 0 0 0 0 0 2 2 0
+ Play#2 output Play#2 1 3,1 * .......... .......... 0 0 0 0 0 0 0 3 4 0
Play#2 output Play#2 1 5,1 * .......... .......... 0 0 0 0 0 0 500 500 500 500
Play#2 output Play#2 1 3 sectors
Play#2 output Play#2 6 0 621
Play#3 output Play#3 1 Thu Jan 1 00:00:00 1970
Play#3 output Play#3 1 COMMODITIES deliver-- distribute
Play#3 output Play#3 1 sect sgpidbolhr sgpidbolhr sh gun pet iron dust bar oil lcm hcm rad
- Play#3 output Play#3 1 2,2 ! .......... .......... 0 0 0 0 0 0 0 3 3 0
- Play#3 output Play#3 1 4,2 ! .......... .......... 0 0 0 0 0 0 0 3 3 0
+ Play#3 output Play#3 1 2,2 ! .......... .......... 0 0 0 0 0 0 0 2 2 0
+ Play#3 output Play#3 1 4,2 ! .......... .......... 0 0 0 0 0 0 0 3 4 0
Play#3 output Play#3 1 6,2 ! .......... .......... 0 0 0 0 0 0 500 500 500 500
Play#3 output Play#3 1 3 sectors
Play#3 output Play#3 6 0 624
build p -1,1 f2 1 79
| not an airfield, no materials, inefficient
build p -1,1 f2
-| Note: fractional cms are randomly rounded, which can make build
-| succeed, upsetting the rest of the test
build p 3:5,1 f2
| insufficient materials: 1,1 short 1l/1h, 3,1 short 1m
-| Note: fractional cms are randomly rounded, which can make build
-| succeed in 1,1, upsetting the rest of the test
move m -1,1 1 jh
move l -1,1 1 jjh
move h -1,1 1 jjh
build l 0,2 linf 1 101
build l 0,2 linf 1 39
| not an headquarters, no materials, inefficient
-| Note: fractional cms are randomly rounded, which can make build
-| succeed in 4,2, upsetting the rest of the test
build l 0,2 linf
build l 4:6,2 linf
| insufficient materials: 2,2 short 1l, 4,2 short 1h
-| Note: fractional cms are randomly rounded, which can make build
-| succeed in either sector, upsetting the rest of the test
move l 0,2 1 jjh
move h 0,2 1 jh
build l 2:4,2 linf
1 5 -11 10 100 127 0 0 0 0 0 0 0 11 -11 0 93 100 0 10 100 0 0 0 100 1 1000 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
1 7 -11 14 100 127 0 0 0 0 0 0 0 11 -11 657 79 100 1 14 91 0 0 0 68 1 1000 30 180 0 200 0 0 0 0 0 200 200 0 0 0 30 180 0 200 0 0 0 0 0 200 200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
1 9 -11 21 100 127 0 0 0 0 0 0 0 11 -11 490 75 100 1 21 85 0 0 0 57 1 1000 0 0 0 0 0 10 0 0 50 100 0 0 0 0 0 0 0 0 0 10 0 0 50 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
-1 11 -11 13 100 127 0 0 0 0 0 0 0 11 -11 667 71 100 1 13 78 0 0 0 45 1 1000 105 181 0 1226 2071 473 0 0 740 4113 4521 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
+1 11 -11 13 100 127 0 0 0 0 0 0 0 11 -11 667 71 100 1 13 78 0 0 0 45 1 1000 105 181 0 1226 2071 473 0 0 740 4114 4522 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
1 13 -11 31 100 127 0 12 0 0 0 0 0 11 -11 649 64 100 1 31 67 0 0 0 25 1 967 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
1 15 -11 26 100 127 0 0 0 0 0 0 0 11 -11 656 57 100 1 26 56 0 0 0 5 1 1000 25 200 17 0 0 0 0 0 0 200 200 0 0 0 25 200 25 0 0 0 0 0 0 200 200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 1 0 0 0 0 0
0 17 -11 0 0 0 0 0 0 0 0 0 0 17 -11 0 -9 0 1 0 0 0 50 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0
Play#0 output Play#0 1
Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money
Play#0 output Play#0 1 1 33 100% 31K 210 514 22 0 9.1K 849 1.2K 3 5 4 46K
- Play#0 output Play#0 1 639.34
+ Play#0 output Play#0 1 639.37
Play#0 output Play#0 1 8 29 91% 25K 110 101 0 0 14K 2.8K 527 0 0 0 21K
Play#0 output Play#0 1 329.62
Play#0 output Play#0 1 2 30 28% 4.9K 0 0 0 0 1.7K 1.3K 170 0 0 0 35K
Play#0 output Play#0 1 10 -11,-11 g .......... .......... 0 0 0 0 225 0 0 0 0 0
Play#0 output Play#0 1 1 3,-11 i .......... 0......63. 1 0 0 0 0 0 0 600 300 0
Play#0 output Play#0 1 1 5,-11 m .......... ...0...... 0 0 0 1 0 0 0 0 0 0
- Play#0 output Play#0 1 1 7,-11 * .......... 1.2....22. 0 0 0 0 0 0 0 197 199 0
+ Play#0 output Play#0 1 1 7,-11 * .......... 1.2....22. 0 0 0 0 0 0 0 198 200 0
Play#0 output Play#0 1 1 9,-11 r .......... ....0.01.. 0 0 0 0 10 0 50 100 0 0
Play#0 output Play#0 1 1 11,-11 w .......... .......... 273 0 0 2519 523 0 849 2514 3122 0
Play#0 output Play#0 1 1 13,-11 e .......... .......... 0 0 0 0 0 0 0 0 0 0
Play#0 output Play#0 1
Play#0 output Play#0 1 sects eff civ mil shell gun pet iron dust oil pln ship unit money
Play#0 output Play#0 1 1 33 100% 31K 232 659 30 994 8.9K 524 1.0K 3 5 4 51K
- Play#0 output Play#0 1 756.23
+ Play#0 output Play#0 1 756.27
Play#0 output Play#0 1 8 29 100% 29K 105 215 5 0 15K 2.5K 541 0 0 0 23K
Play#0 output Play#0 1 447.37
Play#0 output Play#0 1 2 30 33% 6.3K 0 0 0 0 3.2K 1.2K 523 0 0 0 36K
Play#0 output Play#0 1 1 5,-11 m .......... ...0...... 0 0 0 1 0 0 0 0 0 0
Play#0 output Play#0 1 1 7,-11 * .......... 1.2....22. 180 0 200 0 0 0 0 200 200 0
Play#0 output Play#0 1 1 9,-11 r .......... ....0.01.. 0 0 0 0 10 0 50 100 0 0
- Play#0 output Play#0 1 1 11,-11 w .......... .......... 25 0 778 2295 498 0 828 3245 3775 0
+ Play#0 output Play#0 1 1 11,-11 w .......... .......... 25 0 778 2295 498 0 828 3246 3776 0
Play#0 output Play#0 1 1 13,-11 e .......... .......... 0 0 0 0 0 0 0 0 0 0
Play#0 output Play#0 1 1 15,-11 ! .......... 20.....22. 200 11 0 0 0 0 0 200 200 0
Play#0 output Play#0 1 8 21,-11 p .......... .......0.. 0 0 0 0 1 0 0 75 0 0