forked from mirror/openmw-tes3mp
[General] Make most ActorPackets smaller by not including refIds in them
This commit is contained in:
parent
7177d56cfb
commit
73b9683182
13 changed files with 16 additions and 58 deletions
|
@ -168,34 +168,6 @@ void ActorList::sendCellChangeActors()
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Finish this
|
||||
void ActorList::editActorsInCell(MWWorld::CellStore* cellStore)
|
||||
{
|
||||
BaseActor actor;
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
actor = baseActors.at(i);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, %i, %i", actor.refId.c_str(), actor.refNumIndex, actor.mpNum);
|
||||
|
||||
return;
|
||||
|
||||
MWWorld::Ptr ptrFound = cellStore->searchExact(actor.refId, actor.refNumIndex, actor.mpNum);
|
||||
|
||||
if (ptrFound)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "-- Found %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "-- Could not find %s, %i, %i", ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum(), ptrFound.getCellRef().getMpNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
|
||||
{
|
||||
reset();
|
||||
|
|
|
@ -39,8 +39,6 @@ namespace mwmp
|
|||
void sendAttackActors();
|
||||
void sendCellChangeActors();
|
||||
|
||||
void editActorsInCell(MWWorld::CellStore* cellStore);
|
||||
|
||||
void sendActorsInCell(MWWorld::CellStore* cellStore);
|
||||
|
||||
private:
|
||||
|
|
|
@ -208,9 +208,9 @@ bool CellController::isLocalActor(MWWorld::Ptr ptr)
|
|||
return (localActorsToCells.count(mapIndex) > 0);
|
||||
}
|
||||
|
||||
bool CellController::isLocalActor(std::string refId, int refNumIndex, int mpNum)
|
||||
bool CellController::isLocalActor(int refNumIndex, int mpNum)
|
||||
{
|
||||
std::string mapIndex = generateMapIndex(refId, refNumIndex, mpNum);
|
||||
std::string mapIndex = generateMapIndex(refNumIndex, mpNum);
|
||||
return (localActorsToCells.count(mapIndex) > 0);
|
||||
}
|
||||
|
||||
|
@ -222,9 +222,9 @@ LocalActor *CellController::getLocalActor(MWWorld::Ptr ptr)
|
|||
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
|
||||
}
|
||||
|
||||
LocalActor *CellController::getLocalActor(std::string refId, int refNumIndex, int mpNum)
|
||||
LocalActor *CellController::getLocalActor(int refNumIndex, int mpNum)
|
||||
{
|
||||
std::string actorIndex = generateMapIndex(refId, refNumIndex, mpNum);
|
||||
std::string actorIndex = generateMapIndex(refNumIndex, mpNum);
|
||||
std::string cellIndex = localActorsToCells.at(actorIndex);
|
||||
|
||||
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
|
||||
|
@ -240,9 +240,9 @@ void CellController::removeDedicatedActorRecord(std::string actorIndex)
|
|||
dedicatedActorsToCells.erase(actorIndex);
|
||||
}
|
||||
|
||||
bool CellController::isDedicatedActor(std::string refId, int refNumIndex, int mpNum)
|
||||
bool CellController::isDedicatedActor(int refNumIndex, int mpNum)
|
||||
{
|
||||
std::string mapIndex = generateMapIndex(refId, refNumIndex, mpNum);
|
||||
std::string mapIndex = generateMapIndex(refNumIndex, mpNum);
|
||||
return (dedicatedActorsToCells.count(mapIndex) > 0);
|
||||
}
|
||||
|
||||
|
@ -264,18 +264,17 @@ DedicatedActor *CellController::getDedicatedActor(MWWorld::Ptr ptr)
|
|||
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
|
||||
}
|
||||
|
||||
DedicatedActor *CellController::getDedicatedActor(std::string refId, int refNumIndex, int mpNum)
|
||||
DedicatedActor *CellController::getDedicatedActor(int refNumIndex, int mpNum)
|
||||
{
|
||||
std::string actorIndex = generateMapIndex(refId, refNumIndex, mpNum);
|
||||
std::string actorIndex = generateMapIndex(refNumIndex, mpNum);
|
||||
std::string cellIndex = dedicatedActorsToCells.at(actorIndex);
|
||||
|
||||
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
|
||||
}
|
||||
|
||||
std::string CellController::generateMapIndex(std::string refId, int refNumIndex, int mpNum)
|
||||
std::string CellController::generateMapIndex(int refNumIndex, int mpNum)
|
||||
{
|
||||
std::string mapIndex = "";
|
||||
mapIndex += refId;
|
||||
mapIndex += "-" + Utils::toString(refNumIndex);
|
||||
mapIndex += "-" + Utils::toString(mpNum);
|
||||
return mapIndex;
|
||||
|
@ -283,13 +282,12 @@ std::string CellController::generateMapIndex(std::string refId, int refNumIndex,
|
|||
|
||||
std::string CellController::generateMapIndex(MWWorld::Ptr ptr)
|
||||
{
|
||||
return generateMapIndex(ptr.getCellRef().getRefId(),
|
||||
ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum());
|
||||
return generateMapIndex(ptr.getCellRef().getRefNum().mIndex, ptr.getCellRef().getMpNum());
|
||||
}
|
||||
|
||||
std::string CellController::generateMapIndex(BaseActor baseActor)
|
||||
{
|
||||
return generateMapIndex(baseActor.refId, baseActor.refNumIndex, baseActor.mpNum);
|
||||
return generateMapIndex(baseActor.refNumIndex, baseActor.mpNum);
|
||||
}
|
||||
|
||||
bool CellController::hasLocalAuthority(const ESM::Cell& cell)
|
||||
|
|
|
@ -33,19 +33,19 @@ namespace mwmp
|
|||
void removeLocalActorRecord(std::string actorIndex);
|
||||
|
||||
bool isLocalActor(MWWorld::Ptr ptr);
|
||||
bool isLocalActor(std::string refId, int refNumIndex, int mpNum);
|
||||
bool isLocalActor(int refNumIndex, int mpNum);
|
||||
virtual LocalActor *getLocalActor(MWWorld::Ptr ptr);
|
||||
virtual LocalActor *getLocalActor(std::string refId, int refNumIndex, int mpNum);
|
||||
virtual LocalActor *getLocalActor(int refNumIndex, int mpNum);
|
||||
|
||||
void setDedicatedActorRecord(std::string actorIndex, std::string cellIndex);
|
||||
void removeDedicatedActorRecord(std::string actorIndex);
|
||||
|
||||
bool isDedicatedActor(MWWorld::Ptr ptr);
|
||||
bool isDedicatedActor(std::string refId, int refNumIndex, int mpNum);
|
||||
bool isDedicatedActor(int refNumIndex, int mpNum);
|
||||
virtual DedicatedActor *getDedicatedActor(MWWorld::Ptr ptr);
|
||||
virtual DedicatedActor *getDedicatedActor(std::string refId, int refNumIndex, int mpNum);
|
||||
virtual DedicatedActor *getDedicatedActor(int refNumIndex, int mpNum);
|
||||
|
||||
std::string generateMapIndex(std::string refId, int refNumindex, int mpNum);
|
||||
std::string generateMapIndex(int refNumindex, int mpNum);
|
||||
std::string generateMapIndex(MWWorld::Ptr ptr);
|
||||
std::string generateMapIndex(mwmp::BaseActor baseActor);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorAnimFlags::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorAnimPlay::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,11 +34,9 @@ void PacketActorAttack::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
RW(actor.attack.target.refId, send);
|
||||
RW(actor.attack.target.refNumIndex, send);
|
||||
RW(actor.attack.target.mpNum, send);
|
||||
RW(actor.attack.target.guid, send);
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorCellChange::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorEquipment::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorPosition::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorSpeech::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ void PacketActorStatsDynamic::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ void PacketActorTest::Packet(RakNet::BitStream *bs, bool send)
|
|||
actor = actorList->baseActors.at(i);
|
||||
}
|
||||
|
||||
RW(actor.refId, send);
|
||||
RW(actor.refNumIndex, send);
|
||||
RW(actor.mpNum, send);
|
||||
|
||||
|
|
Loading…
Reference in a new issue