/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* material.c: Tries to find materials for production
- *
+ *
* Known contributors to this file:
* Ville Virrankoski, 1996
* Markus Armbruster, 2007
* Return adjusted build percentage.
*/
int
-get_materials(struct sctstr *sp, int *bp, int *mvec, int pct)
+get_materials(struct sctstr *sp, struct bp *bp, int *mvec, int pct)
{
int i, amt;
for (i = I_NONE + 1; i <= I_MAX; i++) {
if (mvec[i] == 0)
continue;
- amt = gt_bg_nmbr(bp, sp, i);
+ amt = bp_get_item(bp, sp, i);
if (amt * 100 < mvec[i] * pct)
pct = amt * 100 / mvec[i];
}
for (i = I_NONE + 1; i <= I_MAX; i++) {
if (mvec[i] == 0)
continue;
- amt = gt_bg_nmbr(bp, sp, i);
+ amt = bp_get_item(bp, sp, i);
amt -= roundavg(mvec[i] * pct / 100.0);
if (CANT_HAPPEN(amt < 0))
amt = 0;
- pt_bg_nmbr(bp, sp, i, amt);
+ bp_put_item(bp, sp, i, amt);
if (!player->simulation)
sp->sct_item[i] = amt;
}