コード例 #1
0
ファイル: 1106.php プロジェクト: rwruss/ib3
if ($checkCount != $passedCheck) {
    exit('error 1-6011-' . $checkCount . '/' . $passedCheck);
}
// Confirm that the unit that is receiving the resources has enough space for what is being given.
$dstSupply = new itemSlot($dstUnit->get('carrySlot'), $slotFile, 40);
$dstStorageUsed = 0;
print_r($dstSupply->slotData);
for ($i = 1; $i < sizeof($dstSupply->slotData); $i += 2) {
    $dstStorageUsed += $dstSupply->slotData[$i + 1];
}
if ($dstStorageUsed + $neededSpace > $dstUnit->get('carryCap') && $dstStorageUsed + $neededSpace > 100000) {
    exit('error 2-6011-' . ($dstStorageUsed + $neededSpace) . '/' . $dstUnit->get('carryCap'));
}
// Remove the resources from the source listUnitID
for ($i = 3; $i < $pvSize; $i += 2) {
    $srcSupply->addItemAtSpot($srcSupply->slotData[$spotList[$postVals[$i]]] - $postVals[$i + 1], $spotList[$postVals[$i]], $slotFile);
}
// Index the spots for the destination slot
$dstSpotList = [];
for ($i = 3; $i < sizeof($postVals); $i += 2) {
    $dstSpotList[$postVals[$i]] = 0;
    for ($j = 1; $j <= sizeof($dstSupply->slotData); $j += 2) {
        if ($postVals[$i] == $dstSupply->slotData[$j]) {
            $dstSpotList[$postVals[$i]] = $j + 1;
            break;
        }
    }
}
echo 'DestSpotList';
print_r($dstSpotList);
// Add the resources to the destination list