forked from teamnwah/openmw-tes3coop
[General] Change regular enums to enum class
This commit is contained in:
parent
8f5d31cb03
commit
c4949ac5d9
36 changed files with 167 additions and 155 deletions
|
@ -140,7 +140,7 @@ void CellController::update(Player *player)
|
||||||
{
|
{
|
||||||
for (auto cell : player->cellStateChanges.cellStates)
|
for (auto cell : player->cellStateChanges.cellStates)
|
||||||
{
|
{
|
||||||
if (cell.type == mwmp::CellState::LOAD)
|
if (cell.type == mwmp::CellState::Type::Load)
|
||||||
{
|
{
|
||||||
Cell *c = addCell(cell.cell);
|
Cell *c = addCell(cell.cell);
|
||||||
c->addPlayer(player);
|
c->addPlayer(player);
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "CellState.hpp"
|
#include "CellState.hpp"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
void CellState::Init(LuaState &lua)
|
void CellState::Init(LuaState &lua)
|
||||||
{
|
{
|
||||||
lua.getState()->new_usertype<CellState>("CellState",
|
lua.getState()->new_usertype<CellState>("CellState",
|
||||||
|
@ -14,12 +16,12 @@ void CellState::Init(LuaState &lua)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
CellState::CellState(mwmp::CellState state) : state(state)
|
CellState::CellState(mwmp::CellState state) : state(std::move(state))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellState::getStateType() const
|
mwmp::CellState::Type CellState::getStateType() const
|
||||||
{
|
{
|
||||||
return state.type;
|
return state.type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
|
|
||||||
explicit CellState(mwmp::CellState state);
|
explicit CellState(mwmp::CellState state);
|
||||||
public:
|
public:
|
||||||
int getStateType() const;
|
mwmp::CellState::Type getStateType() const;
|
||||||
std::string getDescription() const;
|
std::string getDescription() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -40,12 +40,12 @@ void Factions::processUpdate()
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Factions::getFactionChangesAction() const
|
mwmp::FactionChanges::Type Factions::getFactionChangesAction() const
|
||||||
{
|
{
|
||||||
return player->factionChanges.action;
|
return player->factionChanges.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Factions::setFactionChangesAction(int action)
|
void Factions::setFactionChangesAction(mwmp::FactionChanges::Type action)
|
||||||
{
|
{
|
||||||
player->factionChanges.action = action;
|
player->factionChanges.action = action;
|
||||||
setChanged();
|
setChanged();
|
||||||
|
|
|
@ -43,8 +43,8 @@ public:
|
||||||
~Factions();
|
~Factions();
|
||||||
|
|
||||||
|
|
||||||
int getFactionChangesAction() const;
|
mwmp::FactionChanges::Type getFactionChangesAction() const;
|
||||||
void setFactionChangesAction(int action);
|
void setFactionChangesAction(mwmp::FactionChanges::Type action);
|
||||||
|
|
||||||
void addFaction(Faction faction);
|
void addFaction(Faction faction);
|
||||||
Faction getFaction(int id) const;
|
Faction getFaction(int id) const;
|
||||||
|
|
|
@ -39,7 +39,7 @@ void GUI::messageBox(int id, const char *label)
|
||||||
{
|
{
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
|
player->guiMessageBox.type = Player::GUIMessageBox::Type::MessageBox;
|
||||||
|
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ void GUI::customMessageBox(int id, const char *label, const char *buttons)
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
player->guiMessageBox.buttons = buttons;
|
player->guiMessageBox.buttons = buttons;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
|
player->guiMessageBox.type = Player::GUIMessageBox::Type::CustomMessageBox;
|
||||||
|
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ void GUI::inputDialog(int id, const char *label)
|
||||||
{
|
{
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
|
player->guiMessageBox.type = Player::GUIMessageBox::Type::InputDialog;
|
||||||
|
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void GUI::passwordDialog(int id, const char *label, const char *note)
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
player->guiMessageBox.note = note;
|
player->guiMessageBox.note = note;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::PasswordDialog;
|
player->guiMessageBox.type = Player::GUIMessageBox::Type::PasswordDialog;
|
||||||
|
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ void GUI::listBox(int id, const char *label, const char *items)
|
||||||
player->guiMessageBox.id = id;
|
player->guiMessageBox.id = id;
|
||||||
player->guiMessageBox.label = label;
|
player->guiMessageBox.label = label;
|
||||||
player->guiMessageBox.data = items;
|
player->guiMessageBox.data = items;
|
||||||
player->guiMessageBox.type = Player::GUIMessageBox::ListBox;
|
player->guiMessageBox.type = Player::GUIMessageBox::Type::ListBox;
|
||||||
|
|
||||||
setChanged();
|
setChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void Inventory::Init(LuaState &lua)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Inventory::Inventory(NetActor *actor) : netActor(actor), equipmentChanged(false), inventoryChanged(0)
|
Inventory::Inventory(NetActor *actor) : netActor(actor), equipmentChanged(false), inventoryChanged(mwmp::InventoryChanges::Type::None)
|
||||||
{
|
{
|
||||||
printf("Inventory::Inventory()\n");
|
printf("Inventory::Inventory()\n");
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ void Inventory::update()
|
||||||
void Inventory::InitializeInventoryChanges()
|
void Inventory::InitializeInventoryChanges()
|
||||||
{
|
{
|
||||||
netActor->getNetCreature()->inventoryChanges.items.clear();
|
netActor->getNetCreature()->inventoryChanges.items.clear();
|
||||||
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::SET;
|
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::Type::Set;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Inventory::getChangesSize() const
|
int Inventory::getChangesSize() const
|
||||||
|
@ -121,9 +121,9 @@ void Inventory::unequipItem( unsigned short slot)
|
||||||
|
|
||||||
void Inventory::addItem(const std::string &refId, unsigned int count, int charge, int enchantmentCharge)
|
void Inventory::addItem(const std::string &refId, unsigned int count, int charge, int enchantmentCharge)
|
||||||
{
|
{
|
||||||
if (inventoryChanged == mwmp::InventoryChanges::REMOVE)
|
if (inventoryChanged == mwmp::InventoryChanges::Type::Remove)
|
||||||
return;
|
return;
|
||||||
if (inventoryChanged == 0)
|
if (inventoryChanged == mwmp::InventoryChanges::Type::None)
|
||||||
InitializeInventoryChanges();
|
InitializeInventoryChanges();
|
||||||
|
|
||||||
mwmp::Item item;
|
mwmp::Item item;
|
||||||
|
@ -133,17 +133,17 @@ void Inventory::addItem(const std::string &refId, unsigned int count, int charge
|
||||||
item.enchantmentCharge = enchantmentCharge;
|
item.enchantmentCharge = enchantmentCharge;
|
||||||
|
|
||||||
netActor->getNetCreature()->inventoryChanges.items.push_back(item);
|
netActor->getNetCreature()->inventoryChanges.items.push_back(item);
|
||||||
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::ADD;
|
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::Type::Add;
|
||||||
if (inventoryChanged == 0 && netActor->isPlayer())
|
if (inventoryChanged == mwmp::InventoryChanges::Type::None && netActor->isPlayer())
|
||||||
netActor->toPlayer()->addToUpdateQueue();
|
netActor->toPlayer()->addToUpdateQueue();
|
||||||
inventoryChanged = netActor->getNetCreature()->inventoryChanges.action;
|
inventoryChanged = netActor->getNetCreature()->inventoryChanges.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inventory::removeItem(const std::string &refId, unsigned short count)
|
void Inventory::removeItem(const std::string &refId, unsigned short count)
|
||||||
{
|
{
|
||||||
if (inventoryChanged == mwmp::InventoryChanges::ADD)
|
if (inventoryChanged == mwmp::InventoryChanges::Type::Add)
|
||||||
return;
|
return;
|
||||||
if (inventoryChanged == 0)
|
if (inventoryChanged == mwmp::InventoryChanges::Type::None)
|
||||||
InitializeInventoryChanges();
|
InitializeInventoryChanges();
|
||||||
|
|
||||||
mwmp::Item item;
|
mwmp::Item item;
|
||||||
|
@ -151,8 +151,8 @@ void Inventory::removeItem(const std::string &refId, unsigned short count)
|
||||||
item.count = count;
|
item.count = count;
|
||||||
|
|
||||||
netActor->getNetCreature()->inventoryChanges.items.push_back(item);
|
netActor->getNetCreature()->inventoryChanges.items.push_back(item);
|
||||||
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::REMOVE;
|
netActor->getNetCreature()->inventoryChanges.action = mwmp::InventoryChanges::Type::Remove;
|
||||||
if (inventoryChanged == 0 && netActor->isPlayer())
|
if (inventoryChanged == mwmp::InventoryChanges::Type::None && netActor->isPlayer())
|
||||||
netActor->toPlayer()->addToUpdateQueue();
|
netActor->toPlayer()->addToUpdateQueue();
|
||||||
inventoryChanged = netActor->getNetCreature()->inventoryChanges.action;
|
inventoryChanged = netActor->getNetCreature()->inventoryChanges.action;
|
||||||
}
|
}
|
||||||
|
@ -191,10 +191,10 @@ bool Inventory::isEquipmentChanged()
|
||||||
|
|
||||||
void Inventory::resetInventoryFlag()
|
void Inventory::resetInventoryFlag()
|
||||||
{
|
{
|
||||||
inventoryChanged = 0;
|
inventoryChanged = mwmp::InventoryChanges::Type::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Inventory::inventoryChangeType()
|
mwmp::InventoryChanges::Type Inventory::inventoryChangeType()
|
||||||
{
|
{
|
||||||
return inventoryChanged;
|
return inventoryChanged;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
static void Init(LuaState &lua);
|
static void Init(LuaState &lua);
|
||||||
bool isEquipmentChanged();
|
bool isEquipmentChanged();
|
||||||
void resetEquipmentFlag();
|
void resetEquipmentFlag();
|
||||||
int inventoryChangeType();
|
mwmp::InventoryChanges::Type inventoryChangeType();
|
||||||
void resetInventoryFlag();
|
void resetInventoryFlag();
|
||||||
public:
|
public:
|
||||||
explicit Inventory(NetActor *netActor);
|
explicit Inventory(NetActor *netActor);
|
||||||
|
@ -57,7 +57,7 @@ private:
|
||||||
// not controlled pointer
|
// not controlled pointer
|
||||||
NetActor *netActor;
|
NetActor *netActor;
|
||||||
bool equipmentChanged;
|
bool equipmentChanged;
|
||||||
int inventoryChanged;
|
mwmp::InventoryChanges::Type inventoryChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ void ObjectController::sendObjects(shared_ptr<Player> player, shared_ptr<vector<
|
||||||
|
|
||||||
for (auto &e : events)
|
for (auto &e : events)
|
||||||
{
|
{
|
||||||
e.action = mwmp::BaseEvent::SET;
|
e.action = mwmp::BaseEvent::Action::Set;
|
||||||
e.guid = player->guid;
|
e.guid = player->guid;
|
||||||
e.cell = cell;
|
e.cell = cell;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,7 @@ void ObjectController::sendContainers(shared_ptr<Player> player, shared_ptr<vect
|
||||||
|
|
||||||
mwmp::BaseEvent event;
|
mwmp::BaseEvent event;
|
||||||
event.cell = cell;
|
event.cell = cell;
|
||||||
event.action = mwmp::BaseEvent::SET;
|
event.action = mwmp::BaseEvent::Action::Set;
|
||||||
event.guid = player->guid;
|
event.guid = player->guid;
|
||||||
|
|
||||||
for (auto &object : *objects)
|
for (auto &object : *objects)
|
||||||
|
@ -535,7 +535,7 @@ void ObjectController::sendContainers(shared_ptr<Player> player, shared_ptr<vect
|
||||||
void ObjectController::requestContainers(shared_ptr<Player> player)
|
void ObjectController::requestContainers(shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
mwmp::BaseEvent event;
|
mwmp::BaseEvent event;
|
||||||
event.action = mwmp::BaseEvent::REQUEST;
|
event.action = mwmp::BaseEvent::Action::Request;
|
||||||
event.guid = player->guid;
|
event.guid = player->guid;
|
||||||
event.cell = player->cell;
|
event.cell = player->cell;
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ void Player::update()
|
||||||
inventory.resetEquipmentFlag();
|
inventory.resetEquipmentFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory.inventoryChangeType() != 0)
|
if (inventory.inventoryChangeType() != mwmp::InventoryChanges::Type::None)
|
||||||
{
|
{
|
||||||
auto packet = plPCtrl->GetPacket(ID_PLAYER_INVENTORY);
|
auto packet = plPCtrl->GetPacket(ID_PLAYER_INVENTORY);
|
||||||
packet->setPlayer(this);
|
packet->setPlayer(this);
|
||||||
|
|
|
@ -50,12 +50,12 @@ void JournalItem::setIndex(int index)
|
||||||
item.index = index;
|
item.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JournalItem::getType() const
|
mwmp::JournalItem::Type JournalItem::getType() const
|
||||||
{
|
{
|
||||||
return item.type;
|
return item.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JournalItem::setType(int type)
|
void JournalItem::setType(mwmp::JournalItem::Type type)
|
||||||
{
|
{
|
||||||
item.type = type;
|
item.type = type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ public:
|
||||||
int getIndex() const;
|
int getIndex() const;
|
||||||
void setIndex(int index);
|
void setIndex(int index);
|
||||||
|
|
||||||
int getType() const;
|
mwmp::JournalItem::Type getType() const;
|
||||||
void setType(int type);
|
void setType(mwmp::JournalItem::Type type);
|
||||||
|
|
||||||
std::string getActorRefId() const;
|
std::string getActorRefId() const;
|
||||||
void setActorRefId(const std::string &refid);
|
void setActorRefId(const std::string &refid);
|
||||||
|
|
|
@ -18,12 +18,12 @@ namespace mwmp
|
||||||
void Do(WorldPacket &packet, const std::shared_ptr<Player> &player, BaseEvent &event) override
|
void Do(WorldPacket &packet, const std::shared_ptr<Player> &player, BaseEvent &event) override
|
||||||
{
|
{
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player->npc.mName.c_str());
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID.c_str(), player->npc.mName.c_str());
|
||||||
LOG_APPEND(Log::LOG_INFO, "- action: %i", event.action);
|
LOG_APPEND(Log::LOG_INFO, "- action: %i", (int) event.action);
|
||||||
|
|
||||||
// Until we have a timestamp-based system, send packets pertaining to more
|
// Until we have a timestamp-based system, send packets pertaining to more
|
||||||
// than one container (i.e. replies to server requests for container contents)
|
// than one container (i.e. replies to server requests for container contents)
|
||||||
// only to players who have the container's cell loaded
|
// only to players who have the container's cell loaded
|
||||||
if (event.action == BaseEvent::SET && event.worldObjects.size() > 1)
|
if (event.action == BaseEvent::Action::Set && event.worldObjects.size() > 1)
|
||||||
{
|
{
|
||||||
Cell *serverCell = CellController::get().getCell(event.cell);
|
Cell *serverCell = CellController::get().getCell(event.cell);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace MWGui
|
||||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||||
worldEvent->reset();
|
worldEvent->reset();
|
||||||
worldEvent->cell = *mPtr.getCell()->getCell();
|
worldEvent->cell = *mPtr.getCell()->getCell();
|
||||||
worldEvent->action = mwmp::BaseEvent::REMOVE;
|
worldEvent->action = mwmp::BaseEvent::Action::Remove;
|
||||||
|
|
||||||
mwmp::WorldObject worldObject;
|
mwmp::WorldObject worldObject;
|
||||||
worldObject.refId = mPtr.getCellRef().getRefId();
|
worldObject.refId = mPtr.getCellRef().getRefId();
|
||||||
|
@ -160,7 +160,7 @@ namespace MWGui
|
||||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||||
worldEvent->reset();
|
worldEvent->reset();
|
||||||
worldEvent->cell = *mPtr.getCell()->getCell();
|
worldEvent->cell = *mPtr.getCell()->getCell();
|
||||||
worldEvent->action = mwmp::BaseEvent::ADD;
|
worldEvent->action = mwmp::BaseEvent::Action::Add;
|
||||||
|
|
||||||
mwmp::WorldObject worldObject;
|
mwmp::WorldObject worldObject;
|
||||||
worldObject.refId = mPtr.getCellRef().getRefId();
|
worldObject.refId = mPtr.getCellRef().getRefId();
|
||||||
|
@ -330,7 +330,7 @@ namespace MWGui
|
||||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||||
worldEvent->reset();
|
worldEvent->reset();
|
||||||
worldEvent->cell = *mPtr.getCell()->getCell();
|
worldEvent->cell = *mPtr.getCell()->getCell();
|
||||||
worldEvent->action = mwmp::BaseEvent::SET;
|
worldEvent->action = mwmp::BaseEvent::Action::Set;
|
||||||
|
|
||||||
mwmp::WorldObject worldObject;
|
mwmp::WorldObject worldObject;
|
||||||
worldObject.refId = mPtr.getCellRef().getRefId();
|
worldObject.refId = mPtr.getCellRef().getRefId();
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ namespace MWMechanics
|
||||||
if (localAttack->pressed != state)
|
if (localAttack->pressed != state)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MELEE;
|
localAttack->type = mwmp::Attack::Type::Melee;
|
||||||
localAttack->pressed = state;
|
localAttack->pressed = state;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ namespace MWMechanics
|
||||||
if (localAttack && localAttack->pressed != storage.mAttack)
|
if (localAttack && localAttack->pressed != storage.mAttack)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MELEE;
|
localAttack->type = mwmp::Attack::Type::Melee;
|
||||||
localAttack->pressed = storage.mAttack;
|
localAttack->pressed = storage.mAttack;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
@ -291,10 +291,10 @@ namespace MWMechanics
|
||||||
*/
|
*/
|
||||||
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(actor);
|
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(actor);
|
||||||
|
|
||||||
if (localAttack && localAttack->pressed != false)
|
if (localAttack && localAttack->pressed)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MELEE;
|
localAttack->type = mwmp::Attack::Type::Melee;
|
||||||
localAttack->pressed = false;
|
localAttack->pressed = false;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
@ -644,10 +644,10 @@ namespace MWMechanics
|
||||||
*/
|
*/
|
||||||
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(actor);
|
mwmp::Attack *localAttack = MechanicsHelper::getLocalAttack(actor);
|
||||||
|
|
||||||
if (localAttack && localAttack->pressed != true)
|
if (localAttack && !localAttack->pressed)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MELEE;
|
localAttack->type = mwmp::Attack::Type::Melee;
|
||||||
localAttack->pressed = true;
|
localAttack->pressed = true;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1098,7 +1098,7 @@ bool CharacterController::updateCreatureState()
|
||||||
if (localAttack)
|
if (localAttack)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MAGIC;
|
localAttack->type = mwmp::Attack::Type::Magic;
|
||||||
localAttack->pressed = true;
|
localAttack->pressed = true;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
@ -1379,7 +1379,7 @@ bool CharacterController::updateWeaponState()
|
||||||
if (localAttack)
|
if (localAttack)
|
||||||
{
|
{
|
||||||
MechanicsHelper::resetAttack(localAttack);
|
MechanicsHelper::resetAttack(localAttack);
|
||||||
localAttack->type = mwmp::Attack::MAGIC;
|
localAttack->type = mwmp::Attack::Type::Magic;
|
||||||
localAttack->pressed = true;
|
localAttack->pressed = true;
|
||||||
localAttack->shouldSend = true;
|
localAttack->shouldSend = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,12 +255,12 @@ void Cell::readAttack(ActorList& actorList)
|
||||||
|
|
||||||
// Set the correct drawState here if we've somehow we've missed a previous
|
// Set the correct drawState here if we've somehow we've missed a previous
|
||||||
// AnimFlags packet
|
// AnimFlags packet
|
||||||
if (actor->attack.type == mwmp::Attack::MELEE && actor->drawState != 1)
|
if (actor->attack.type == mwmp::Attack::Type::Melee && actor->drawState != 1)
|
||||||
{
|
{
|
||||||
actor->drawState = 1;
|
actor->drawState = 1;
|
||||||
actor->setAnimFlags();
|
actor->setAnimFlags();
|
||||||
}
|
}
|
||||||
else if (actor->attack.type == mwmp::Attack::MAGIC && actor->drawState != 2)
|
else if (actor->attack.type == mwmp::Attack::Type::Magic && actor->drawState != 2)
|
||||||
{
|
{
|
||||||
actor->drawState = 2;
|
actor->drawState = 2;
|
||||||
actor->setAnimFlags();
|
actor->setAnimFlags();
|
||||||
|
|
|
@ -177,7 +177,7 @@ void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessa
|
||||||
mInputBox = 0;
|
mInputBox = 0;
|
||||||
mInputBox = new TextInputDialog();
|
mInputBox = new TextInputDialog();
|
||||||
|
|
||||||
mInputBox->setEditPassword(guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog);
|
mInputBox->setEditPassword(guiMessageBox.type == BasePlayer::GUIMessageBox::Type::PasswordDialog);
|
||||||
|
|
||||||
mInputBox->setTextLabel(guiMessageBox.label);
|
mInputBox->setTextLabel(guiMessageBox.label);
|
||||||
mInputBox->setTextNote(guiMessageBox.note);
|
mInputBox->setTextNote(guiMessageBox.note);
|
||||||
|
|
|
@ -31,7 +31,7 @@ LocalActor::LocalActor()
|
||||||
wasForceMoveJumping = false;
|
wasForceMoveJumping = false;
|
||||||
wasFlying = false;
|
wasFlying = false;
|
||||||
|
|
||||||
attack.type = Attack::MELEE;
|
attack.type = Attack::Type::Melee;
|
||||||
attack.shouldSend = false;
|
attack.shouldSend = false;
|
||||||
attack.instant = false;
|
attack.instant = false;
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ void LocalActor::updateAttack()
|
||||||
{
|
{
|
||||||
if (attack.shouldSend)
|
if (attack.shouldSend)
|
||||||
{
|
{
|
||||||
if (attack.type == Attack::MAGIC)
|
if (attack.type == Attack::Type::Magic)
|
||||||
{
|
{
|
||||||
MWMechanics::CreatureStats &attackerStats = ptr.getClass().getCreatureStats(ptr);
|
MWMechanics::CreatureStats &attackerStats = ptr.getClass().getCreatureStats(ptr);
|
||||||
attack.spellId = attackerStats.getSpells().getSelectedSpell();
|
attack.spellId = attackerStats.getSpells().getSelectedSpell();
|
||||||
|
|
|
@ -538,7 +538,7 @@ void LocalPlayer::updateAttack()
|
||||||
{
|
{
|
||||||
if (attack.shouldSend)
|
if (attack.shouldSend)
|
||||||
{
|
{
|
||||||
if (attack.type == Attack::MAGIC)
|
if (attack.type == Attack::Type::Magic)
|
||||||
{
|
{
|
||||||
attack.spellId = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
attack.spellId = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ void LocalPlayer::addJournalItems()
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptrFound;
|
MWWorld::Ptr ptrFound;
|
||||||
|
|
||||||
if (journalItem.type == JournalItem::ENTRY)
|
if (journalItem.type == JournalItem::Type::Entry)
|
||||||
{
|
{
|
||||||
ptrFound = MWBase::Environment::get().getWorld()->searchPtr(journalItem.actorRefId, false);
|
ptrFound = MWBase::Environment::get().getWorld()->searchPtr(journalItem.actorRefId, false);
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ void LocalPlayer::addJournalItems()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (journalItem.type == JournalItem::ENTRY)
|
if (journalItem.type == JournalItem::Type::Entry)
|
||||||
MWBase::Environment::get().getJournal()->addEntry(journalItem.quest, journalItem.index, ptrFound);
|
MWBase::Environment::get().getJournal()->addEntry(journalItem.quest, journalItem.index, ptrFound);
|
||||||
else
|
else
|
||||||
MWBase::Environment::get().getJournal()->setJournalIndex(journalItem.quest, journalItem.index);
|
MWBase::Environment::get().getJournal()->setJournalIndex(journalItem.quest, journalItem.index);
|
||||||
|
@ -1080,7 +1080,7 @@ void LocalPlayer::setFactions()
|
||||||
if (!ptrNpcStats.isInFaction(faction.factionId))
|
if (!ptrNpcStats.isInFaction(faction.factionId))
|
||||||
ptrNpcStats.joinFaction(faction.factionId);
|
ptrNpcStats.joinFaction(faction.factionId);
|
||||||
|
|
||||||
if (factionChanges.action == mwmp::FactionChanges::RANK)
|
if (factionChanges.action == mwmp::FactionChanges::Type::Rank)
|
||||||
{
|
{
|
||||||
// While the faction rank is different in the packet than in the NpcStats,
|
// While the faction rank is different in the packet than in the NpcStats,
|
||||||
// adjust the NpcStats accordingly
|
// adjust the NpcStats accordingly
|
||||||
|
@ -1092,7 +1092,7 @@ void LocalPlayer::setFactions()
|
||||||
ptrNpcStats.lowerRank(faction.factionId);
|
ptrNpcStats.lowerRank(faction.factionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (factionChanges.action == mwmp::FactionChanges::EXPULSION)
|
else if (factionChanges.action == mwmp::FactionChanges::Type::Expulsion)
|
||||||
{
|
{
|
||||||
// If the expelled state is different in the packet than in the NpcStats,
|
// If the expelled state is different in the packet than in the NpcStats,
|
||||||
// adjust the NpcStats accordingly
|
// adjust the NpcStats accordingly
|
||||||
|
@ -1105,7 +1105,7 @@ void LocalPlayer::setFactions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (factionChanges.action == mwmp::FactionChanges::REPUTATION)
|
else if (factionChanges.action == mwmp::FactionChanges::Type::Reputation)
|
||||||
ptrNpcStats.setFactionReputation(faction.factionId, faction.reputation);
|
ptrNpcStats.setFactionReputation(faction.factionId, faction.reputation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1183,7 @@ void LocalPlayer::sendInventory()
|
||||||
inventoryChanges.items.push_back(item);
|
inventoryChanges.items.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryChanges.action = InventoryChanges::SET;
|
inventoryChanges.action = InventoryChanges::Type::Set;
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->setPlayer(this);
|
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->setPlayer(this);
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_INVENTORY)->Send();
|
||||||
}
|
}
|
||||||
|
@ -1202,7 +1202,7 @@ void LocalPlayer::sendSpellbook()
|
||||||
spellbookChanges.spells.push_back(*spell.first);
|
spellbookChanges.spells.push_back(*spell.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
spellbookChanges.action = SpellbookChanges::SET;
|
spellbookChanges.action = SpellbookChanges::Type::Set;
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
||||||
}
|
}
|
||||||
|
@ -1225,7 +1225,7 @@ void LocalPlayer::sendSpellAddition(std::string id)
|
||||||
spell.mId = id;
|
spell.mId = id;
|
||||||
spellbookChanges.spells.push_back(spell);
|
spellbookChanges.spells.push_back(spell);
|
||||||
|
|
||||||
spellbookChanges.action = SpellbookChanges::ADD;
|
spellbookChanges.action = SpellbookChanges::Type::Add;
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
||||||
}
|
}
|
||||||
|
@ -1241,7 +1241,7 @@ void LocalPlayer::sendSpellRemoval(std::string id)
|
||||||
spell.mId = id;
|
spell.mId = id;
|
||||||
spellbookChanges.spells.push_back(spell);
|
spellbookChanges.spells.push_back(spell);
|
||||||
|
|
||||||
spellbookChanges.action = SpellbookChanges::REMOVE;
|
spellbookChanges.action = SpellbookChanges::Type::Remove;
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->setPlayer(this);
|
||||||
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
getNetworking()->getPlayerPacket(ID_PLAYER_SPELLBOOK)->Send();
|
||||||
}
|
}
|
||||||
|
@ -1295,7 +1295,7 @@ void LocalPlayer::sendJournalEntry(const std::string& quest, int index, const MW
|
||||||
journalChanges.journalItems.clear();
|
journalChanges.journalItems.clear();
|
||||||
|
|
||||||
mwmp::JournalItem journalItem;
|
mwmp::JournalItem journalItem;
|
||||||
journalItem.type = JournalItem::ENTRY;
|
journalItem.type = JournalItem::Type::Entry;
|
||||||
journalItem.quest = quest;
|
journalItem.quest = quest;
|
||||||
journalItem.index = index;
|
journalItem.index = index;
|
||||||
journalItem.actorRefId = actor.getCellRef().getRefId();
|
journalItem.actorRefId = actor.getCellRef().getRefId();
|
||||||
|
@ -1311,7 +1311,7 @@ void LocalPlayer::sendJournalIndex(const std::string& quest, int index)
|
||||||
journalChanges.journalItems.clear();
|
journalChanges.journalItems.clear();
|
||||||
|
|
||||||
mwmp::JournalItem journalItem;
|
mwmp::JournalItem journalItem;
|
||||||
journalItem.type = JournalItem::INDEX;
|
journalItem.type = JournalItem::Type::Index;
|
||||||
journalItem.quest = quest;
|
journalItem.quest = quest;
|
||||||
journalItem.index = index;
|
journalItem.index = index;
|
||||||
|
|
||||||
|
@ -1324,7 +1324,7 @@ void LocalPlayer::sendJournalIndex(const std::string& quest, int index)
|
||||||
void LocalPlayer::sendFactionRank(const std::string& factionId, int rank)
|
void LocalPlayer::sendFactionRank(const std::string& factionId, int rank)
|
||||||
{
|
{
|
||||||
factionChanges.factions.clear();
|
factionChanges.factions.clear();
|
||||||
factionChanges.action = FactionChanges::RANK;
|
factionChanges.action = FactionChanges::Type::Rank;
|
||||||
|
|
||||||
mwmp::Faction faction;
|
mwmp::Faction faction;
|
||||||
faction.factionId = factionId;
|
faction.factionId = factionId;
|
||||||
|
@ -1339,7 +1339,7 @@ void LocalPlayer::sendFactionRank(const std::string& factionId, int rank)
|
||||||
void LocalPlayer::sendFactionExpulsionState(const std::string& factionId, bool isExpelled)
|
void LocalPlayer::sendFactionExpulsionState(const std::string& factionId, bool isExpelled)
|
||||||
{
|
{
|
||||||
factionChanges.factions.clear();
|
factionChanges.factions.clear();
|
||||||
factionChanges.action = FactionChanges::EXPULSION;
|
factionChanges.action = FactionChanges::Type::Expulsion;
|
||||||
|
|
||||||
mwmp::Faction faction;
|
mwmp::Faction faction;
|
||||||
faction.factionId = factionId;
|
faction.factionId = factionId;
|
||||||
|
@ -1354,7 +1354,7 @@ void LocalPlayer::sendFactionExpulsionState(const std::string& factionId, bool i
|
||||||
void LocalPlayer::sendFactionReputation(const std::string& factionId, int reputation)
|
void LocalPlayer::sendFactionReputation(const std::string& factionId, int reputation)
|
||||||
{
|
{
|
||||||
factionChanges.factions.clear();
|
factionChanges.factions.clear();
|
||||||
factionChanges.action = FactionChanges::REPUTATION;
|
factionChanges.action = FactionChanges::Type::Reputation;
|
||||||
|
|
||||||
mwmp::Faction faction;
|
mwmp::Faction faction;
|
||||||
faction.factionId = factionId;
|
faction.factionId = factionId;
|
||||||
|
@ -1439,7 +1439,7 @@ void LocalPlayer::clearCurrentContainer()
|
||||||
currentContainer.mpNum = 0;
|
currentContainer.mpNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::storeCellState(const ESM::Cell& cell, int stateType)
|
void LocalPlayer::storeCellState(const ESM::Cell& cell, mwmp::CellState::Type stateType)
|
||||||
{
|
{
|
||||||
std::vector<CellState>::iterator iter;
|
std::vector<CellState>::iterator iter;
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace mwmp
|
||||||
void clearCurrentContainer();
|
void clearCurrentContainer();
|
||||||
|
|
||||||
void storeCurrentContainer(const MWWorld::Ptr& container);
|
void storeCurrentContainer(const MWWorld::Ptr& container);
|
||||||
void storeCellState(const ESM::Cell& cell, int stateType);
|
void storeCellState(const ESM::Cell& cell, mwmp::CellState::Type stateType);
|
||||||
|
|
||||||
void playAnimation();
|
void playAnimation();
|
||||||
void playSpeech();
|
void playSpeech();
|
||||||
|
|
|
@ -167,7 +167,7 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the weapon used (if hand-to-hand, weapon = inv.end())
|
// Get the weapon used (if hand-to-hand, weapon = inv.end())
|
||||||
if (attack.type == attack.MELEE)
|
if (attack.type == Attack::Type::Melee)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr weapon;
|
MWWorld::Ptr weapon;
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
|
||||||
attack.success);
|
attack.success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attack.type == attack.MAGIC)
|
else if (attack.type == Attack::Type::Magic)
|
||||||
{
|
{
|
||||||
if (attack.instant)
|
if (attack.instant)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,13 +69,13 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
||||||
MWWorld::ContainerStore& containerStore = ptrFound.getClass().getContainerStore(ptrFound);
|
MWWorld::ContainerStore& containerStore = ptrFound.getClass().getContainerStore(ptrFound);
|
||||||
|
|
||||||
// If we are setting the entire contents, clear the current ones
|
// If we are setting the entire contents, clear the current ones
|
||||||
if (action == BaseEvent::SET)
|
if (action == BaseEvent::Action::Set)
|
||||||
containerStore.clear();
|
containerStore.clear();
|
||||||
|
|
||||||
MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr ownerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
for (const auto &containerItem : worldObject.containerItems)
|
for (const auto &containerItem : worldObject.containerItems)
|
||||||
{
|
{
|
||||||
if (action == BaseEvent::ADD || action == BaseEvent::SET)
|
if (action == BaseEvent::Action::Add || action == BaseEvent::Action::Set)
|
||||||
{
|
{
|
||||||
// Create a ManualRef to be able to set item charge
|
// Create a ManualRef to be able to set item charge
|
||||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), containerItem.refId, 1);
|
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), containerItem.refId, 1);
|
||||||
|
@ -92,7 +92,7 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
||||||
|
|
||||||
containerStore.add(newPtr, containerItem.count, ownerPtr, true);
|
containerStore.add(newPtr, containerItem.count, ownerPtr, true);
|
||||||
}
|
}
|
||||||
else if (action == BaseEvent::REMOVE)
|
else if (action == BaseEvent::Action::Remove)
|
||||||
{
|
{
|
||||||
// We have to find the right item ourselves because ContainerStore has no method
|
// We have to find the right item ourselves because ContainerStore has no method
|
||||||
// accounting for charge
|
// accounting for charge
|
||||||
|
@ -122,8 +122,8 @@ void WorldEvent::editContainers(MWWorld::CellStore* cellStore)
|
||||||
|
|
||||||
// Was this a SET or ADD action on an actor's container, and are we the authority
|
// Was this a SET or ADD action on an actor's container, and are we the authority
|
||||||
// over the actor? If so, autoequip the actor
|
// over the actor? If so, autoequip the actor
|
||||||
if ((action == BaseEvent::ADD || action == BaseEvent::SET) && ptrFound.getClass().isActor() &&
|
if ((action == BaseEvent::Action::Add || action == BaseEvent::Action::Set) && ptrFound.getClass().isActor()
|
||||||
mwmp::Main::get().getCellController()->isLocalActor(ptrFound))
|
&& mwmp::Main::get().getCellController()->isLocalActor(ptrFound))
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);
|
MWWorld::InventoryStore& invStore = ptrFound.getClass().getInventoryStore(ptrFound);
|
||||||
invStore.autoEquip(ptrFound);
|
invStore.autoEquip(ptrFound);
|
||||||
|
@ -941,7 +941,7 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
cell = *cellStore->getCell();
|
cell = *cellStore->getCell();
|
||||||
action = BaseEvent::SET;
|
action = BaseEvent::Action::Set;
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
|
MWWorld::CellRefList<ESM::Container> *containerList = cellStore->getContainers();
|
||||||
|
|
||||||
|
|
|
@ -22,22 +22,22 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
if (isLocal())
|
if (isLocal())
|
||||||
{
|
{
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", player->guiMessageBox.type,
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "ID_GUI_MESSAGEBOX, Type %d, MSG %s", (int) player->guiMessageBox.type,
|
||||||
player->guiMessageBox.label.c_str());
|
player->guiMessageBox.label.c_str());
|
||||||
|
|
||||||
switch(player->guiMessageBox.type)
|
switch(player->guiMessageBox.type)
|
||||||
{
|
{
|
||||||
case BasePlayer::GUIMessageBox::MessageBox:
|
case BasePlayer::GUIMessageBox::Type::MessageBox:
|
||||||
Main::get().getGUIController()->showMessageBox(player->guiMessageBox);
|
Main::get().getGUIController()->showMessageBox(player->guiMessageBox);
|
||||||
break;
|
break;
|
||||||
case BasePlayer::GUIMessageBox::CustomMessageBox:
|
case BasePlayer::GUIMessageBox::Type::CustomMessageBox:
|
||||||
Main::get().getGUIController()->showCustomMessageBox(player->guiMessageBox);
|
Main::get().getGUIController()->showCustomMessageBox(player->guiMessageBox);
|
||||||
break;
|
break;
|
||||||
case BasePlayer::GUIMessageBox::InputDialog:
|
case BasePlayer::GUIMessageBox::Type::InputDialog:
|
||||||
case BasePlayer::GUIMessageBox::PasswordDialog:
|
case BasePlayer::GUIMessageBox::Type::PasswordDialog:
|
||||||
Main::get().getGUIController()->showInputBox(player->guiMessageBox);
|
Main::get().getGUIController()->showInputBox(player->guiMessageBox);
|
||||||
break;
|
break;
|
||||||
case BasePlayer::GUIMessageBox::ListBox:
|
case BasePlayer::GUIMessageBox::Type::ListBox:
|
||||||
Main::get().getGUIController()->showDialogList(player->guiMessageBox);
|
Main::get().getGUIController()->showDialogList(player->guiMessageBox);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,10 @@ namespace mwmp
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
|
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
|
||||||
int inventoryAction = localPlayer.inventoryChanges.action;
|
|
||||||
|
|
||||||
if (inventoryAction == InventoryChanges::ADD)
|
if (localPlayer.inventoryChanges.action == InventoryChanges::Type::Add)
|
||||||
localPlayer.addItems();
|
localPlayer.addItems();
|
||||||
else if (inventoryAction == InventoryChanges::REMOVE)
|
else if (localPlayer.inventoryChanges.action == InventoryChanges::Type::Remove)
|
||||||
localPlayer.removeItems();
|
localPlayer.removeItems();
|
||||||
else // InventoryChanges::SET
|
else // InventoryChanges::SET
|
||||||
localPlayer.setInventory();
|
localPlayer.setInventory();
|
||||||
|
|
|
@ -30,11 +30,10 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
|
LocalPlayer &localPlayer = static_cast<LocalPlayer&>(*player);
|
||||||
|
|
||||||
int spellbookAction = localPlayer.spellbookChanges.action;
|
|
||||||
|
|
||||||
if (spellbookAction == SpellbookChanges::ADD)
|
if (localPlayer.spellbookChanges.action == SpellbookChanges::Type::Add)
|
||||||
localPlayer.addSpells();
|
localPlayer.addSpells();
|
||||||
else if (spellbookAction == SpellbookChanges::REMOVE)
|
else if (localPlayer.spellbookChanges.action == SpellbookChanges::Type::Remove)
|
||||||
localPlayer.removeSpells();
|
localPlayer.removeSpells();
|
||||||
else // SpellbookChanges::SET
|
else // SpellbookChanges::SET
|
||||||
localPlayer.setSpellbook();
|
localPlayer.setSpellbook();
|
||||||
|
|
|
@ -17,10 +17,10 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
BaseObjectProcessor::Do(packet, event);
|
BaseObjectProcessor::Do(packet, event);
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i", event.action);
|
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i", (int)event.action);
|
||||||
|
|
||||||
// If we've received a request for information, comply with it
|
// If we've received a request for information, comply with it
|
||||||
if (event.action == mwmp::BaseEvent::REQUEST)
|
if (event.action == mwmp::BaseEvent::Action::Request)
|
||||||
event.sendContainers(ptrCellStore);
|
event.sendContainers(ptrCellStore);
|
||||||
// Otherwise, edit containers based on the information received
|
// Otherwise, edit containers based on the information received
|
||||||
else
|
else
|
||||||
|
|
|
@ -266,7 +266,7 @@ namespace MWWorld
|
||||||
|
|
||||||
Store a cell unload for the LocalPlayer
|
Store a cell unload for the LocalPlayer
|
||||||
*/
|
*/
|
||||||
mwmp::Main::get().getLocalPlayer()->storeCellState(*(*iter)->getCell(), mwmp::CellState::UNLOAD);
|
mwmp::Main::get().getLocalPlayer()->storeCellState(*(*iter)->getCell(), mwmp::CellState::Type::Unload);
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
@ -347,7 +347,7 @@ namespace MWWorld
|
||||||
|
|
||||||
Store a cell load for the LocalPlayer
|
Store a cell load for the LocalPlayer
|
||||||
*/
|
*/
|
||||||
mwmp::Main::get().getLocalPlayer()->storeCellState(*cell->getCell(), mwmp::CellState::LOAD);
|
mwmp::Main::get().getLocalPlayer()->storeCellState(*cell->getCell(), mwmp::CellState::Type::Load);
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -76,12 +76,12 @@ namespace mwmp
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum WORLD_ACTION
|
enum class Action : uint8_t
|
||||||
{
|
{
|
||||||
SET = 0,
|
Set = 0,
|
||||||
ADD = 1,
|
Add,
|
||||||
REMOVE = 2,
|
Remove,
|
||||||
REQUEST = 3
|
Request
|
||||||
};
|
};
|
||||||
|
|
||||||
RakNet::RakNetGUID guid;
|
RakNet::RakNetGUID guid;
|
||||||
|
@ -91,7 +91,7 @@ namespace mwmp
|
||||||
ESM::Cell cell;
|
ESM::Cell cell;
|
||||||
std::string consoleCommand;
|
std::string consoleCommand;
|
||||||
|
|
||||||
unsigned char action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item, 3 - Request items
|
Action action;
|
||||||
|
|
||||||
bool isValid;
|
bool isValid;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,15 +46,15 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
std::string quest;
|
std::string quest;
|
||||||
int index;
|
int index;
|
||||||
enum JOURNAL_ITEM_TYPE
|
enum class Type
|
||||||
{
|
{
|
||||||
ENTRY = 0,
|
Entry = 0,
|
||||||
INDEX = 1
|
Index = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string actorRefId;
|
std::string actorRefId;
|
||||||
|
|
||||||
int type; // 0 - An entire entry, 1 - An index
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Faction
|
struct Faction
|
||||||
|
@ -101,13 +101,13 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
ESM::Cell cell;
|
ESM::Cell cell;
|
||||||
|
|
||||||
enum CELL_STATE_ACTION
|
enum class Type: uint8_t
|
||||||
{
|
{
|
||||||
LOAD = 0,
|
Load = 0,
|
||||||
UNLOAD = 1
|
Unload
|
||||||
};
|
};
|
||||||
|
|
||||||
int type; // 0 - Cell load, 1 - Cell unload
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct JournalChanges
|
struct JournalChanges
|
||||||
|
@ -119,14 +119,14 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
std::vector<Faction> factions;
|
std::vector<Faction> factions;
|
||||||
|
|
||||||
enum FACTION_ACTION
|
enum class Type: uint8_t
|
||||||
{
|
{
|
||||||
RANK = 0,
|
Rank = 0,
|
||||||
EXPULSION = 1,
|
Expulsion,
|
||||||
REPUTATION = 2
|
Reputation
|
||||||
};
|
};
|
||||||
|
|
||||||
int action; // 0 - Rank, 1 - Expulsion state, 2 - Both
|
Type action;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TopicChanges
|
struct TopicChanges
|
||||||
|
@ -153,13 +153,14 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
std::vector<ESM::Spell> spells;
|
std::vector<ESM::Spell> spells;
|
||||||
|
|
||||||
enum ACTION_TYPE
|
enum class Type: int8_t
|
||||||
{
|
{
|
||||||
SET = 0,
|
None = -1,
|
||||||
ADD,
|
Set = 0,
|
||||||
REMOVE
|
Add,
|
||||||
|
Remove
|
||||||
};
|
};
|
||||||
int action; // 0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
Type action;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QuickKeyChanges
|
struct QuickKeyChanges
|
||||||
|
@ -191,9 +192,7 @@ namespace mwmp
|
||||||
|
|
||||||
struct GUIMessageBox
|
struct GUIMessageBox
|
||||||
{
|
{
|
||||||
int id;
|
enum class Type: uint8_t
|
||||||
int type;
|
|
||||||
enum GUI_TYPE
|
|
||||||
{
|
{
|
||||||
MessageBox = 0,
|
MessageBox = 0,
|
||||||
CustomMessageBox,
|
CustomMessageBox,
|
||||||
|
@ -201,6 +200,10 @@ namespace mwmp
|
||||||
PasswordDialog,
|
PasswordDialog,
|
||||||
ListBox
|
ListBox
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int id;
|
||||||
|
Type type;
|
||||||
|
|
||||||
std::string label;
|
std::string label;
|
||||||
std::string note;
|
std::string note;
|
||||||
std::string buttons;
|
std::string buttons;
|
||||||
|
@ -237,8 +240,8 @@ namespace mwmp
|
||||||
|
|
||||||
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
|
BasePlayer(RakNet::RakNetGUID guid) : guid(guid)
|
||||||
{
|
{
|
||||||
inventoryChanges.action = 0;
|
inventoryChanges.action = InventoryChanges::Type::None;
|
||||||
spellbookChanges.action = 0;
|
spellbookChanges.action = SpellbookChanges::Type::None;
|
||||||
useCreatureName = false;
|
useCreatureName = false;
|
||||||
isWerewolf = false;
|
isWerewolf = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,14 @@ namespace mwmp
|
||||||
struct InventoryChanges
|
struct InventoryChanges
|
||||||
{
|
{
|
||||||
std::vector<Item> items;
|
std::vector<Item> items;
|
||||||
enum ACTION_TYPE
|
enum class Type: int8_t
|
||||||
{
|
{
|
||||||
SET = 0,
|
None = -1,
|
||||||
ADD,
|
Set = 0,
|
||||||
REMOVE
|
Add,
|
||||||
|
Remove
|
||||||
};
|
};
|
||||||
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
Type action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Target
|
struct Target
|
||||||
|
@ -47,14 +48,15 @@ namespace mwmp
|
||||||
|
|
||||||
Target target;
|
Target target;
|
||||||
|
|
||||||
char type; // 0 - melee, 1 - magic, 2 - throwable
|
enum class Type: uint8_t
|
||||||
enum TYPE
|
|
||||||
{
|
{
|
||||||
MELEE = 0,
|
Melee = 0,
|
||||||
MAGIC,
|
Magic,
|
||||||
THROWABLE
|
Throwable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Type type;
|
||||||
|
|
||||||
std::string spellId; // id of spell (e.g. "fireball")
|
std::string spellId; // id of spell (e.g. "fireball")
|
||||||
|
|
||||||
float damage;
|
float damage;
|
||||||
|
|
|
@ -15,30 +15,37 @@ void mwmp::PacketPreInit::Packet(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, send);
|
BasePacket::Packet(bs, send);
|
||||||
|
|
||||||
size_t size = checksums->size();
|
uint16_t size = checksums->size();
|
||||||
RW(size, send);
|
RW(size, send);
|
||||||
|
|
||||||
for (size_t i = 0; i < size; i++)
|
if(!send)
|
||||||
{
|
{
|
||||||
PluginPair ppair;
|
if(size > 256)
|
||||||
if (send)
|
return;
|
||||||
ppair = (*checksums)[i];
|
checksums->clear();
|
||||||
|
checksums->resize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (auto &&ppair : *checksums)
|
||||||
|
{
|
||||||
RW(ppair.first, send);
|
RW(ppair.first, send);
|
||||||
|
|
||||||
size_t hashSize = ppair.second.size();
|
uint8_t hashSize = ppair.second.size();
|
||||||
|
|
||||||
RW(hashSize, send);
|
RW(hashSize, send);
|
||||||
for (size_t j = 0; j < hashSize; j++)
|
|
||||||
|
if(!send)
|
||||||
{
|
{
|
||||||
unsigned hash;
|
if(hashSize > 16)
|
||||||
if (send)
|
return;
|
||||||
hash = ppair.second[j];
|
ppair.second.resize(hashSize);
|
||||||
RW(hash, send);
|
}
|
||||||
if (!send)
|
|
||||||
ppair.second.push_back(hash);
|
for (auto &&hash :ppair.second)
|
||||||
|
{
|
||||||
|
RW(hash, send);
|
||||||
}
|
}
|
||||||
if (!send)
|
|
||||||
checksums->push_back(ppair);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@ void PacketGUIBoxes::Packet(RakNet::BitStream *bs, bool send)
|
||||||
|
|
||||||
RW(player->guiMessageBox.data, send);
|
RW(player->guiMessageBox.data, send);
|
||||||
|
|
||||||
if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox)
|
if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::Type::CustomMessageBox)
|
||||||
RW(player->guiMessageBox.buttons, send);
|
RW(player->guiMessageBox.buttons, send);
|
||||||
else if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog)
|
else if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::Type::PasswordDialog)
|
||||||
RW(player->guiMessageBox.note, send);
|
RW(player->guiMessageBox.note, send);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,13 @@ void PacketPlayerFaction::Packet(RakNet::BitStream *bs, bool send)
|
||||||
{
|
{
|
||||||
RW(faction.factionId, send, true);
|
RW(faction.factionId, send, true);
|
||||||
|
|
||||||
if (player->factionChanges.action == FactionChanges::RANK)
|
if (player->factionChanges.action == FactionChanges::Type::Rank)
|
||||||
RW(faction.rank, send);
|
RW(faction.rank, send);
|
||||||
|
|
||||||
if (player->factionChanges.action == FactionChanges::EXPULSION)
|
if (player->factionChanges.action == FactionChanges::Type::Expulsion)
|
||||||
RW(faction.isExpelled, send);
|
RW(faction.isExpelled, send);
|
||||||
|
|
||||||
if (player->factionChanges.action == FactionChanges::REPUTATION)
|
if (player->factionChanges.action == FactionChanges::Type::Reputation)
|
||||||
RW(faction.reputation, send);
|
RW(faction.reputation, send);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ void PacketPlayerJournal::Packet(RakNet::BitStream *bs, bool send)
|
||||||
RW(journalItem.quest, send, true);
|
RW(journalItem.quest, send, true);
|
||||||
RW(journalItem.index, send);
|
RW(journalItem.index, send);
|
||||||
|
|
||||||
if (journalItem.type == JournalItem::ENTRY)
|
if (journalItem.type == JournalItem::Type::Entry)
|
||||||
RW(journalItem.actorRefId, send, true);
|
RW(journalItem.actorRefId, send, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue