patch #981: Fixes factory production to display # units correctly, by Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4147 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
ae39f1886a
commit
31d449c8ed
|
@ -419,7 +419,7 @@ void intAddProdQuantity(WIDGET *psWidget, W_CONTEXT *psContext)
|
|||
DROID_TEMPLATE *psTemplate = (DROID_TEMPLATE *)psStat;
|
||||
STRUCTURE *psStructure = NULL;
|
||||
BASE_OBJECT *psObj = getCurrentSelected();
|
||||
UDWORD quantity = 0;
|
||||
UDWORD quantity = 0, remaining = 0;
|
||||
|
||||
if (psObj != NULL && psObj->type == OBJ_STRUCTURE && !isDead(psObj))
|
||||
{
|
||||
|
@ -431,6 +431,16 @@ void intAddProdQuantity(WIDGET *psWidget, W_CONTEXT *psContext)
|
|||
quantity = getProductionQuantity(psStructure, psTemplate);
|
||||
}
|
||||
|
||||
// now find out how many we have built
|
||||
remaining = getProductionBuilt(psStructure, psTemplate);
|
||||
if (quantity > remaining)
|
||||
{
|
||||
quantity -= remaining;
|
||||
}
|
||||
else
|
||||
{
|
||||
quantity = 0;
|
||||
}
|
||||
if (quantity != 0)
|
||||
{
|
||||
snprintf(Label->aText, sizeof(Label->aText), "%u", quantity);
|
||||
|
|
|
@ -6814,6 +6814,7 @@ void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, BOOL
|
|||
UDWORD inc, factoryType, factoryInc;
|
||||
FACTORY *psFactory;
|
||||
BOOL bAssigned = FALSE, bCheckForCancel = FALSE;
|
||||
UBYTE built, quantity, remaining;
|
||||
|
||||
CHECK_STRUCTURE(psStructure);
|
||||
ASSERT( psStructure->player == productionPlayer,
|
||||
|
@ -6829,10 +6830,14 @@ void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, BOOL
|
|||
if (asProductionRun[factoryType][factoryInc][inc].psTemplate == psTemplate)
|
||||
{
|
||||
//adjust the prod run
|
||||
if (add)
|
||||
if (add) //user left clicked, so increase # in queue
|
||||
{
|
||||
asProductionRun[factoryType][factoryInc][inc].quantity++;
|
||||
if (asProductionRun[factoryType][factoryInc][inc].quantity > MAX_IN_RUN)
|
||||
// Allows us to queue up more units up to MAX_IN_RUN instead of ignoring how many we have built from that queue
|
||||
quantity = ++asProductionRun[factoryType][factoryInc][inc].quantity;
|
||||
built = asProductionRun[factoryType][factoryInc][inc].built;
|
||||
remaining = quantity - built;
|
||||
// check to see if user canceled all orders in queue
|
||||
if (remaining > MAX_IN_RUN)
|
||||
{
|
||||
asProductionRun[factoryType][factoryInc][inc].quantity = 0;
|
||||
//initialise the template
|
||||
|
@ -6847,7 +6852,7 @@ void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, BOOL
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else //user right clicked, so we subtract form queue
|
||||
{
|
||||
if (asProductionRun[factoryType][factoryInc][inc].quantity == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue