mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
[General] Include charge int in WorldObject & send it w/ ID_OBJECT_PLACE
This commit is contained in:
parent
04d45b9dbb
commit
ecc456fea9
7 changed files with 21 additions and 1 deletions
|
@ -33,6 +33,7 @@ void WorldFunctions::AddWorldObject() noexcept
|
||||||
WorldObject worldObject;
|
WorldObject worldObject;
|
||||||
worldObject.refId = tempWorldObject.refId;
|
worldObject.refId = tempWorldObject.refId;
|
||||||
worldObject.refNumIndex = tempWorldObject.refNumIndex;
|
worldObject.refNumIndex = tempWorldObject.refNumIndex;
|
||||||
|
worldObject.charge = tempWorldObject.charge;
|
||||||
worldObject.count = tempWorldObject.count;
|
worldObject.count = tempWorldObject.count;
|
||||||
worldObject.goldValue = tempWorldObject.goldValue;
|
worldObject.goldValue = tempWorldObject.goldValue;
|
||||||
worldObject.scale = tempWorldObject.scale;
|
worldObject.scale = tempWorldObject.scale;
|
||||||
|
@ -76,6 +77,11 @@ void WorldFunctions::SetObjectRefNumIndex(int refNumIndex) noexcept
|
||||||
tempWorldObject.refNumIndex = refNumIndex;
|
tempWorldObject.refNumIndex = refNumIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldFunctions::SetObjectCharge(int charge) noexcept
|
||||||
|
{
|
||||||
|
tempWorldObject.charge = charge;
|
||||||
|
}
|
||||||
|
|
||||||
void WorldFunctions::SetObjectCount(int count) noexcept
|
void WorldFunctions::SetObjectCount(int count) noexcept
|
||||||
{
|
{
|
||||||
tempWorldObject.count = count;
|
tempWorldObject.count = count;
|
||||||
|
@ -130,6 +136,11 @@ int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex;
|
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WorldFunctions::GetObjectCharge(unsigned int i) noexcept
|
||||||
|
{
|
||||||
|
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).charge;
|
||||||
|
}
|
||||||
|
|
||||||
int WorldFunctions::GetObjectCount(unsigned int i) noexcept
|
int WorldFunctions::GetObjectCount(unsigned int i) noexcept
|
||||||
{
|
{
|
||||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count;
|
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
\
|
\
|
||||||
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
|
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\
|
||||||
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
|
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
|
||||||
|
{"SetObjectCharge", WorldFunctions::SetObjectCharge},\
|
||||||
{"SetObjectCount", WorldFunctions::SetObjectCount},\
|
{"SetObjectCount", WorldFunctions::SetObjectCount},\
|
||||||
{"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\
|
{"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\
|
||||||
{"SetObjectScale", WorldFunctions::SetObjectScale},\
|
{"SetObjectScale", WorldFunctions::SetObjectScale},\
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
\
|
\
|
||||||
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
||||||
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
||||||
|
{"GetObjectCharge", WorldFunctions::GetObjectCharge},\
|
||||||
{"GetObjectCount", WorldFunctions::GetObjectCount},\
|
{"GetObjectCount", WorldFunctions::GetObjectCount},\
|
||||||
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
|
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
|
||||||
{"GetObjectScale", WorldFunctions::GetObjectScale},\
|
{"GetObjectScale", WorldFunctions::GetObjectScale},\
|
||||||
|
@ -55,6 +57,7 @@ public:
|
||||||
|
|
||||||
static void SetObjectRefId(const char* refId) noexcept;
|
static void SetObjectRefId(const char* refId) noexcept;
|
||||||
static void SetObjectRefNumIndex(int refNumIndex) noexcept;
|
static void SetObjectRefNumIndex(int refNumIndex) noexcept;
|
||||||
|
static void SetObjectCharge(int charge) noexcept;
|
||||||
static void SetObjectCount(int count) noexcept;
|
static void SetObjectCount(int count) noexcept;
|
||||||
static void SetObjectGoldValue(int goldValue) noexcept;
|
static void SetObjectGoldValue(int goldValue) noexcept;
|
||||||
static void SetObjectScale(double scale) noexcept;
|
static void SetObjectScale(double scale) noexcept;
|
||||||
|
@ -67,6 +70,7 @@ public:
|
||||||
|
|
||||||
static const char *GetObjectRefId(unsigned int i) noexcept;
|
static const char *GetObjectRefId(unsigned int i) noexcept;
|
||||||
static int GetObjectRefNumIndex(unsigned int i) noexcept;
|
static int GetObjectRefNumIndex(unsigned int i) noexcept;
|
||||||
|
static int GetObjectCharge(unsigned int i) noexcept;
|
||||||
static int GetObjectCount(unsigned int i) noexcept;
|
static int GetObjectCount(unsigned int i) noexcept;
|
||||||
static int GetObjectGoldValue(unsigned int i) noexcept;
|
static int GetObjectGoldValue(unsigned int i) noexcept;
|
||||||
static double GetObjectScale(unsigned int i) noexcept;
|
static double GetObjectScale(unsigned int i) noexcept;
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace MWGui
|
||||||
mwmp::WorldObject worldObject;
|
mwmp::WorldObject worldObject;
|
||||||
worldObject.refId = dropped.getCellRef().getRefId();
|
worldObject.refId = dropped.getCellRef().getRefId();
|
||||||
worldObject.refNumIndex = dropped.getCellRef().getRefNum().mIndex;
|
worldObject.refNumIndex = dropped.getCellRef().getRefNum().mIndex;
|
||||||
|
worldObject.charge = dropped.getCellRef().getCharge();
|
||||||
|
|
||||||
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
||||||
// we actually see on this client
|
// we actually see on this client
|
||||||
|
|
|
@ -59,6 +59,7 @@ void LocalEvent::placeObjects(MWWorld::CellStore* cellStore)
|
||||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), worldObject.refId, 1);
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), worldObject.refId, 1);
|
||||||
|
|
||||||
MWWorld::Ptr newPtr = ref.getPtr();
|
MWWorld::Ptr newPtr = ref.getPtr();
|
||||||
|
newPtr.getCellRef().setCharge(worldObject.charge);
|
||||||
|
|
||||||
if (worldObject.count > 1)
|
if (worldObject.count > 1)
|
||||||
newPtr.getRefData().setCount(worldObject.count);
|
newPtr.getRefData().setCount(worldObject.count);
|
||||||
|
|
|
@ -558,6 +558,7 @@ namespace MWScript
|
||||||
mwmp::WorldObject worldObject;
|
mwmp::WorldObject worldObject;
|
||||||
worldObject.refId = ptr.getCellRef().getRefId();
|
worldObject.refId = ptr.getCellRef().getRefId();
|
||||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||||
|
worldObject.charge = ptr.getCellRef().getCharge();
|
||||||
worldObject.count = 1;
|
worldObject.count = 1;
|
||||||
|
|
||||||
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
||||||
|
|
|
@ -11,8 +11,9 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
std::string refId;
|
std::string refId;
|
||||||
int refNumIndex;
|
int refNumIndex;
|
||||||
int goldValue;
|
int charge;
|
||||||
int count;
|
int count;
|
||||||
|
int goldValue;
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
|
|
|
@ -35,6 +35,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
|
||||||
|
|
||||||
RW(worldObject.refId, send);
|
RW(worldObject.refId, send);
|
||||||
RW(worldObject.refNumIndex, send);
|
RW(worldObject.refNumIndex, send);
|
||||||
|
RW(worldObject.charge, send);
|
||||||
RW(worldObject.count, send);
|
RW(worldObject.count, send);
|
||||||
RW(worldObject.goldValue, send);
|
RW(worldObject.goldValue, send);
|
||||||
RW(worldObject.pos, send);
|
RW(worldObject.pos, send);
|
||||||
|
|
Loading…
Reference in a new issue