#include <config.h>
#include <limits.h>
+#include <math.h>
#include "chance.h"
#include "commands.h"
#include "game.h"
sector_can_build(struct sctstr *sp, short mat[], int work,
int effic, char *what)
{
- int i, avail;
+ int i, avail, ret;
double needed;
if (sp->sct_effic < 60 && !player->god) {
return 0;
}
- for (i = I_NONE + 1; i <= I_MAX; 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;
if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a %s\n",
return 0;
}
- return 1;
+ ret = 1;
+ for (i = I_NONE + 1; i <= I_MAX; i++) {
+ needed = mat[i] * (effic / 100.0);
+ if (sp->sct_item[i] < needed) {
+ pr("Not enough %s in %s (need %g more)\n",
+ ichr[i].i_name, xyas(sp->sct_x, sp->sct_y, player->cnum),
+ ceil(needed - sp->sct_item[i]));
+ ret = 0;
+ }
+ mat[i] = roundavg(needed);
+ }
+
+ return ret;
}
static void
Play#1 output Play#1 6 0 635
Play#1 input build s 4:6,0 pt
Play#1 command build
- Play#1 output Play#1 1 Not enough materials in 4,0
+ Play#1 output Play#1 1 Not enough light products in 4,0 (need 4 more)
+ Play#1 output Play#1 1 Not enough heavy products in 4,0 (need 2 more)
Play#1 output Play#1 1 Sector 6,0 is not 60% efficient.
Play#1 output Play#1 6 0 634
Play#1 input move l 0,0 4 jh
Play#1 output Play#1 6 0 630
Play#1 input build s 2:4,0 pt
Play#1 command build
- Play#1 output Play#1 1 Not enough materials in 2,0
- Play#1 output Play#1 1 Not enough materials in 4,0
+ Play#1 output Play#1 1 Not enough heavy products in 2,0 (need 1 more)
+ Play#1 output Play#1 1 Not enough light products in 4,0 (need 1 more)
Play#1 output Play#1 6 0 629
Play#1 input move l 0,0 12 jh
Play#1 command move
Play#2 output Play#2 6 0 635
Play#2 input build p 3:5,1 f2
Play#2 command build
- Play#2 output Play#2 1 Not enough materials in 3,1
+ Play#2 output Play#2 1 Not enough light products in 3,1 (need 1 more)
+ Play#2 output Play#2 1 Not enough heavy products in 3,1 (need 1 more)
Play#2 output Play#2 1 Sector 5,1 is not 60% efficient.
Play#2 output Play#2 6 0 634
Play#2 input move m -1,1 1 jh
Play#2 output Play#2 6 0 631
Play#2 input build p 1:3,1 f2
Play#2 command build
- Play#2 output Play#2 1 Not enough materials in 1,1
+ Play#2 output Play#2 1 Not enough light products in 1,1 (need 1 more)
+ Play#2 output Play#2 1 Not enough heavy products in 1,1 (need 1 more)
Play#2 output Play#2 1 Not enough military for crew in 3,1
Play#2 output Play#2 6 0 630
Play#2 input move m -1,1 3 jh
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 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 3,1 * .......... .......... 0 0 0 0 0 0 0 3 3 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 6 0 635
Play#3 input build l 4:6,2 linf
Play#3 command build
- Play#3 output Play#3 1 Not enough materials in 4,2
+ Play#3 output Play#3 1 Not enough light products in 4,2 (need 1 more)
+ Play#3 output Play#3 1 Not enough heavy products in 4,2 (need 1 more)
Play#3 output Play#3 1 Sector 6,2 is not 60% efficient.
Play#3 output Play#3 6 0 634
Play#3 input move l 0,2 1 jjh
Play#3 output Play#3 6 0 632
Play#3 input build l 2:4,2 linf
Play#3 command build
- Play#3 output Play#3 1 Not enough materials in 2,2
- Play#3 output Play#3 1 Not enough materials in 4,2
+ Play#3 output Play#3 1 Not enough light products in 2,2 (need 1 more)
+ Play#3 output Play#3 1 Not enough heavy products in 4,2 (need 1 more)
Play#3 output Play#3 6 0 631
Play#3 input move l 0,2 4 jh
Play#3 command move