repairs to cost calculations for voxels

This commit is contained in:
Stephen Birarda 2014-07-30 09:45:33 -07:00
parent ff889882ce
commit 2c8808e922
2 changed files with 7 additions and 6 deletions

View file

@ -171,7 +171,8 @@ void DomainHandler::settingsRequestFinished() {
qDebug() << "Error getting domain settings -" << settingsReply->errorString() << "- retrying";
if (++_failedSettingsRequests >= MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS) {
qDebug() << "Failed to retreive domain-server settings" << MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS << "times. Re-setting connection to domain.";
qDebug() << "Failed to retreive domain-server settings" << MAX_SETTINGS_REQUEST_FAILED_ATTEMPTS
<< "times. Re-setting connection to domain.";
clearSettings();
clearConnectionInfo();
emit settingsReceiveFail();

View file

@ -147,14 +147,14 @@ qint64 VoxelEditPacketSender::satoshiCostForMessage(const VoxelDetail& details)
const DomainHandler& domainHandler = NodeList::getInstance()->getDomainHandler();
qint64 totalSatoshiCost = domainHandler.getSatoshisPerVoxel();
qint64 costPerMeterCubed = domainHandler.getSatoshisPerMeterCubed();
if (totalSatoshiCost == 0 && costPerMeterCubed == 0) {
float totalVolume = details.s * details.s * details.s;
return totalSatoshiCost + floorf(totalVolume * costPerMeterCubed);
} else {
return 0;
} else {
float meterScale = details.s * TREE_SCALE;
float totalVolume = meterScale * meterScale * meterScale;
return totalSatoshiCost + (qint64) floorf(totalVolume * costPerMeterCubed);
}
}