mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:21:16 +02:00
add voxel cost amounts to VoxelEditPacketSender
This commit is contained in:
parent
5fd7a11c6b
commit
40e08d5008
2 changed files with 39 additions and 0 deletions
|
@ -142,3 +142,26 @@ void VoxelEditPacketSender::queueVoxelEditMessages(PacketType type, int numberOf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VoxelEditPacketSender::updateVoxelCosts(const QJsonObject& domainSettingsObject) {
|
||||||
|
|
||||||
|
// from the domain-handler, figure out the satoshi cost per voxel and per meter cubed
|
||||||
|
const QString VOXEL_SETTINGS_KEY = "voxels";
|
||||||
|
const QString PER_VOXEL_COST_KEY = "per-voxel-credits";
|
||||||
|
const QString PER_METER_CUBED_COST_KEY = "per-meter-cubed-credits";
|
||||||
|
|
||||||
|
if (!domainSettingsObject.isEmpty()) {
|
||||||
|
float perVoxelCredits = (float) domainSettingsObject[VOXEL_SETTINGS_KEY].toObject()[PER_VOXEL_COST_KEY].toDouble();
|
||||||
|
float perMeterCubedCredits = (float) domainSettingsObject[VOXEL_SETTINGS_KEY].toObject()[PER_METER_CUBED_COST_KEY].toDouble();
|
||||||
|
|
||||||
|
qDebug() << "PV: " << perVoxelCredits << "PMC: " << perMeterCubedCredits;
|
||||||
|
} else {
|
||||||
|
qDebug() << "CALLED WITH EMPTY SETTINGS!";
|
||||||
|
_satoshisPerVoxel = 0;
|
||||||
|
_satoshisPerMeterCubed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 VoxelEditPacketSender::satoshiCostForMessage(PacketType type, int numberOfDetails, VoxelDetail *details) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#define hifi_VoxelEditPacketSender_h
|
#define hifi_VoxelEditPacketSender_h
|
||||||
|
|
||||||
#include <OctreeEditPacketSender.h>
|
#include <OctreeEditPacketSender.h>
|
||||||
|
|
||||||
#include "VoxelDetail.h"
|
#include "VoxelDetail.h"
|
||||||
|
|
||||||
/// Utility for processing, packing, queueing and sending of outbound edit voxel messages.
|
/// Utility for processing, packing, queueing and sending of outbound edit voxel messages.
|
||||||
|
@ -49,5 +50,20 @@ public:
|
||||||
|
|
||||||
// My server type is the voxel server
|
// My server type is the voxel server
|
||||||
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
|
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
|
||||||
|
|
||||||
|
qint64 satoshiCostForMessage(PacketType type, int numberOfDetails, VoxelDetail* details);
|
||||||
|
|
||||||
|
void setSatoshisPerVoxel(qint64 satoshisPerVoxel) { _satoshisPerVoxel = satoshisPerVoxel; }
|
||||||
|
qint64 getSatoshisPerVoxel() const { return _satoshisPerVoxel; }
|
||||||
|
|
||||||
|
void setSatoshisPerMeterCubed(qint64 satoshisPerMeterCubed) { _satoshisPerMeterCubed = satoshisPerMeterCubed; }
|
||||||
|
qint64 getSatoshisPerMeterCubed() const { return _satoshisPerMeterCubed; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateVoxelCosts(const QJsonObject& domainSettingsObject);
|
||||||
|
|
||||||
|
private:
|
||||||
|
qint64 _satoshisPerVoxel;
|
||||||
|
qint64 _satoshisPerMeterCubed;
|
||||||
};
|
};
|
||||||
#endif // hifi_VoxelEditPacketSender_h
|
#endif // hifi_VoxelEditPacketSender_h
|
||||||
|
|
Loading…
Reference in a new issue