Esempio n. 1
0
    private void _DistributeContractToAssignedDesks()
    {
        CContract contract = null;

        for (int i = 0; i < mWorld.mContracts.Count; ++i)
        {
            CContract c = mWorld.mContracts[i];
            if (c.mOwner == mPlayerId && c.GetUndistributedStacks() > 0)
            {
                contract = c;
                break;
            }
        }

        if (contract == null)
        {
            return;
        }

        for (int i = 0; i < mWorld.mItemProxies[mPlayerId].Count; ++i)
        {
            CItemProxy proxy = mWorld.mItemProxies[mPlayerId][i];

            if (proxy.mAsset.mItemType == EItemType.DESK && !proxy.mBlueprint && proxy.mAssignedUnitID != -1)
            {
                if (proxy.mAssignedPaperStacks.Count < proxy.mMaxPaperStackSlots)
                {
                    mWorld.ControllerDistributeContract(mPlayerId, contract.mID, proxy.mID);
                    return;
                }
            }
        }
    }