Use lowerCamelCase in tes3mp client function names like OpenMW does

pull/112/merge
David Cernat 8 years ago
parent 527024a026
commit fa9d6e810e

@ -108,7 +108,7 @@ void OMW::Engine::frame(float frametime)
if (mUseSound)
mEnvironment.getSoundManager()->update(frametime);
mwmp::Main::Frame(frametime);
mwmp::Main::frame(frametime);
// Main menu opened? Then scripts are also paused.
bool paused = /*mEnvironment.getWindowManager()->containsMode(MWGui::GM_MainMenu);*/ false;
@ -240,10 +240,10 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
OMW::Engine::~Engine()
{
mwmp::Main::get().getGUIController()->cleanup();
mwmp::Main::get().getGUIController()->cleanUp();
mEnvironment.cleanup();
mwmp::Main::Destroy();
mwmp::Main::destroy();
delete mScriptContext;
mScriptContext = NULL;
@ -660,9 +660,9 @@ void OMW::Engine::go()
ToUTF8::Utf8Encoder encoder (mEncoding);
mEncoder = &encoder;
mwmp::Main::Init(mContentFiles);
mwmp::Main::init(mContentFiles);
prepareEngine (settings);
mwmp::Main::PostInit();
mwmp::Main::postInit();
mSkipMenu = true;
if (!mSaveGameFile.empty())

@ -157,7 +157,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
("activate-dist", bpo::value <int> ()->default_value (-1), "activation distance override");
mwmp::Main::OptionsDesc(&desc);
mwmp::Main::optionsDesc(&desc);
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv)
.options(desc).allow_unregistered().run();
@ -256,7 +256,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
engine.setActivationDistanceOverride (variables["activate-dist"].as<int>());
engine.enableFontExport(variables["export-fonts"].as<bool>());
mwmp::Main::Configure(&variables);
mwmp::Main::configure(&variables);
return true;
}

@ -596,17 +596,17 @@ namespace MWClass
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{
mwmp::Main::get().getLocalPlayer()->GetAttack()->success = true;
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::GetPlayer(victim);
mwmp::Main::get().getLocalPlayer()->getAttack()->success = true;
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(victim);
if (dedicatedPlayer != nullptr)
mwmp::Main::get().getLocalPlayer()->GetAttack()->target = dedicatedPlayer->guid;
mwmp::Main::get().getLocalPlayer()->getAttack()->target = dedicatedPlayer->guid;
}
if(Misc::Rng::roll0to99() >= hitchance)
{
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{
mwmp::Main::get().getLocalPlayer()->GetAttack()->success = false;
mwmp::Main::get().getLocalPlayer()->getAttack()->success = false;
mwmp::Main::get().getLocalPlayer()->sendAttack(mwmp::Attack::MELEE);
}
@ -734,11 +734,11 @@ namespace MWClass
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
* gmst.iKnockDownOddsMult->getInt() * 0.01f + gmst.iKnockDownOddsBase->getInt();
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::GetPlayer(attacker);
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(attacker);
bool isDedicated = dedicatedPlayer != nullptr;
bool _knockdown = false;
if(isDedicated)
_knockdown = dedicatedPlayer->GetAttack()->knockdown;
_knockdown = dedicatedPlayer->getAttack()->knockdown;
if ((!isDedicated && ishealth && agilityTerm <= damage && knockdownTerm <= Misc::Rng::roll0to99()) || _knockdown)
{
@ -845,10 +845,10 @@ namespace MWClass
}
mwmp::DedicatedPlayer *victimPlayer = mwmp::Players::GetPlayer(ptr);
mwmp::DedicatedPlayer *victimPlayer = mwmp::Players::getPlayer(ptr);
if (attacker == MWMechanics::getPlayer() && victimPlayer != nullptr)
{
mwmp::Attack *_atk = mwmp::Main::get().getLocalPlayer()->GetAttack();
mwmp::Attack *_atk = mwmp::Main::get().getLocalPlayer()->getAttack();
_atk->damage = damage;
_atk->attacker = mwmp::Main::get().getLocalPlayer()->guid;
_atk->target = victimPlayer->guid;

@ -80,7 +80,7 @@ namespace MWGui
// Get the real count of gold in a stack
event->cellRef.mGoldValue = dropped.getCellRef().getGoldValue();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(event);
printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n",
event->cellRef.mRefID.c_str(),

@ -638,7 +638,7 @@ namespace MWGui
event->cell = *object.getCell()->getCell();
event->cellRef.mRefID = object.getCellRef().getRefId();
event->cellRef.mRefNum = object.getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_DELETE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
// remove from world
MWBase::Environment::get().getWorld()->deleteObject (object);

@ -664,7 +664,7 @@ namespace MWInput
void InputManager::keyPressed( const SDL_KeyboardEvent &arg )
{
mwmp::Main::PressedKey(arg.keysym.sym);
mwmp::Main::pressedKey(arg.keysym.sym);
// HACK: to make Morrowind's default keybinding for the console work without printing an extra "^" upon closing
// This assumes that SDL_TextInput events always come *after* the key event
// (which is somewhat reasonable, and hopefully true for all SDL platforms)

@ -1041,7 +1041,7 @@ namespace MWMechanics
mwmp::Main::get().getLocalPlayer()->prepareAttack(mwmp::Attack::MELEE, state);
}
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::GetPlayer(iter->first);
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(iter->first);
if (dedicatedPlayer != nullptr)
dedicatedPlayer->updateActor(iter->second);

@ -116,16 +116,16 @@ namespace MWMechanics
x = std::min(iBlockMaxChance, std::max(iBlockMinChance, x));
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::GetPlayer(blocker);
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(blocker);
bool isDedicated = dedicatedPlayer != nullptr;
if (attacker == MWMechanics::getPlayer())
mwmp::Main::get().getLocalPlayer()->GetAttack()->block = false;
mwmp::Main::get().getLocalPlayer()->getAttack()->block = false;
if ((!isDedicated && Misc::Rng::roll0to99() < x) ||
(isDedicated && dedicatedPlayer->GetAttack()->block == 1))
(isDedicated && dedicatedPlayer->getAttack()->block == 1))
{
if (attacker == MWMechanics::getPlayer())
mwmp::Main::get().getLocalPlayer()->GetAttack()->block = true;
mwmp::Main::get().getLocalPlayer()->getAttack()->block = true;
// Reduce shield durability by incoming damage
int shieldhealth = shield->getClass().getItemHealth(*shield);
@ -204,12 +204,12 @@ namespace MWMechanics
weapon.getClass().getEquipmentSkill(weapon));
if (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
mwmp::Main::get().getLocalPlayer()->GetAttack()->success = true;
mwmp::Main::get().getLocalPlayer()->getAttack()->success = true;
if (Misc::Rng::roll0to99() >= getHitChance(attacker, victim, skillValue))
{
if (attacker == getPlayer())
mwmp::Main::get().getLocalPlayer()->GetAttack()->success = false;
mwmp::Main::get().getLocalPlayer()->getAttack()->success = false;
victim.getClass().onHit(victim, 0.0f, false, projectile, attacker, osg::Vec3f(), false);
MWMechanics::reduceWeaponCondition(0.f, false, weapon, attacker);
return;

@ -62,7 +62,7 @@ namespace MWMechanics
event->cell = *lock.getCell()->getCell();
event->cellRef.mRefID = lock.getCellRef().getRefId();
event->cellRef.mRefNum = lock.getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
lock.getClass().unlock(lock);
resultMessage = "#{sLockSuccess}";

@ -797,14 +797,14 @@ namespace MWMechanics
// Check success
float successChance = getSpellSuccessChance(spell, mCaster);
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::GetPlayer(mCaster);
mwmp::DedicatedPlayer *dedicatedPlayer = mwmp::Players::getPlayer(mCaster);
bool isDedicated = dedicatedPlayer != nullptr;
if (isDedicated)
dedicatedPlayer->GetAttack()->pressed = false;
dedicatedPlayer->getAttack()->pressed = false;
if ((!isDedicated && !mwmp::Main::get().getLocalPlayer()->GetAttack()->success) ||
(isDedicated && dedicatedPlayer->GetAttack()->success == 0))
if ((!isDedicated && !mwmp::Main::get().getLocalPlayer()->getAttack()->success) ||
(isDedicated && dedicatedPlayer->getAttack()->success == 0))
{
if (mCaster == getPlayer())
{

@ -29,7 +29,7 @@ std::map<uint64_t, DedicatedPlayer *> Players::players;
DedicatedPlayer::DedicatedPlayer(RakNet::RakNetGUID guid) : BasePlayer(guid)
{
GetAttack()->pressed = 0;
getAttack()->pressed = 0;
CreatureStats()->mDead = false;
movementFlags = 0;
}
@ -43,7 +43,7 @@ MWWorld::Ptr DedicatedPlayer::getPtr()
return ptr;
}
void Players::CreatePlayer(RakNet::RakNetGUID guid)
void Players::createPlayer(RakNet::RakNetGUID guid)
{
LOG_APPEND(Log::LOG_INFO, "%s", "- Setting up character info");
@ -93,7 +93,7 @@ void Players::CreatePlayer(RakNet::RakNetGUID guid)
dedicPlayer->Npc()->mName.c_str());
dedicPlayer->ptr.getBase()->canChangeCell = true;
dedicPlayer->UpdatePtr(world->moveObject(dedicPlayer->ptr, cellStore, newPos.pos[0], newPos.pos[1], newPos.pos[2]));
dedicPlayer->updatePtr(world->moveObject(dedicPlayer->ptr, cellStore, newPos.pos[0], newPos.pos[1], newPos.pos[2]));
npc.mId = players[guid.g]->ptr.get<ESM::NPC>()->mBase->mId;
@ -116,13 +116,13 @@ void Players::CreatePlayer(RakNet::RakNetGUID guid)
}
void Players::CleanUp()
void Players::cleanUp()
{
for (std::map <uint64_t, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++)
delete it->second;
}
void Players::DisconnectPlayer(RakNet::RakNetGUID guid)
void Players::disconnectPlayer(RakNet::RakNetGUID guid)
{
if (players[guid.g]->state > 1)
{
@ -144,7 +144,7 @@ void Players::DisconnectPlayer(RakNet::RakNetGUID guid)
}
}
DedicatedPlayer *Players::GetPlayer(RakNet::RakNetGUID guid)
DedicatedPlayer *Players::getPlayer(RakNet::RakNetGUID guid)
{
return players[guid.g];
}
@ -195,7 +195,7 @@ osg::Vec3f Lerp(osg::Vec3f start, osg::Vec3f end, float percent)
return (start + osg::componentMultiply(p, (end - start)));
}
void DedicatedPlayer::Move(float dt)
void DedicatedPlayer::move(float dt)
{
if (state != 2) return;
@ -219,7 +219,7 @@ void DedicatedPlayer::Move(float dt)
world->rotateObject(ptr, pos.rot[0], pos.rot[1], pos.rot[2]);
}
void Players::Update(float dt)
void Players::update(float dt)
{
for (std::map <uint64_t, DedicatedPlayer *>::iterator it = players.begin(); it != players.end(); it++)
{
@ -259,12 +259,12 @@ void Players::Update(float dt)
ptrNpcStats->setAiSetting(MWMechanics::CreatureStats::AI_Hello, 0);
ptrNpcStats->setBaseDisposition(255);
pl->Move(dt);
pl->UpdateDrawState();
pl->move(dt);
pl->updateDrawState();
}
}
void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr)
void DedicatedPlayer::updatePtr(MWWorld::Ptr newPtr)
{
ptr.mCell = newPtr.mCell;
ptr.mRef = newPtr.mRef;
@ -276,7 +276,7 @@ void DedicatedPlayer::UpdatePtr(MWWorld::Ptr newPtr)
}
DedicatedPlayer *Players::NewPlayer(RakNet::RakNetGUID guid)
DedicatedPlayer *Players::newPlayer(RakNet::RakNetGUID guid)
{
LOG_APPEND(Log::LOG_INFO, "- Creating new DedicatedPlayer with guid %lu",
guid.g);
@ -286,7 +286,7 @@ DedicatedPlayer *Players::NewPlayer(RakNet::RakNetGUID guid)
return players[guid.g];
}
void DedicatedPlayer::UpdateInventory()
void DedicatedPlayer::updateInventory()
{
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore(ptr);
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
@ -326,7 +326,7 @@ void DedicatedPlayer::UpdateInventory()
}
}
const std::string DedicatedPlayer::GetAnim()
const std::string DedicatedPlayer::getAnim()
{
static string anim;
static string animDir;
@ -394,7 +394,7 @@ const std::string DedicatedPlayer::GetAnim()
return (anim + animDir + animWeap);
}
DedicatedPlayer *Players::GetPlayer(const MWWorld::Ptr &ptr)
DedicatedPlayer *Players::getPlayer(const MWWorld::Ptr &ptr)
{
std::map <uint64_t, DedicatedPlayer *>::iterator it = players.begin();
@ -409,7 +409,7 @@ DedicatedPlayer *Players::GetPlayer(const MWWorld::Ptr &ptr)
return 0;
}
void DedicatedPlayer::UpdateDrawState()
void DedicatedPlayer::updateDrawState()
{
using namespace MWMechanics;
@ -461,7 +461,7 @@ void DedicatedPlayer::updateCell()
// Allow this player's reference to move across a cell now that a manual cell
// update has been called
ptr.getBase()->canChangeCell = true;
UpdatePtr(world->moveObject(ptr, cellStore, pos.pos[0], pos.pos[1], pos.pos[2]));
updatePtr(world->moveObject(ptr, cellStore, pos.pos[0], pos.pos[1], pos.pos[2]));
}
@ -504,5 +504,5 @@ void DedicatedPlayer::setMarkerState(bool state)
void DedicatedPlayer::updateActor(MWMechanics::Actor *actor)
{
actor->getCharacterController()->setAttackingOrSpell(GetAttack()->pressed);
actor->getCharacterController()->setAttackingOrSpell(getAttack()->pressed);
}

@ -26,13 +26,13 @@ namespace mwmp
class Players
{
public:
static DedicatedPlayer *NewPlayer(RakNet::RakNetGUID guid);
static void CreatePlayer(RakNet::RakNetGUID guid);
static void DisconnectPlayer(RakNet::RakNetGUID guid);
static void CleanUp();
static DedicatedPlayer *GetPlayer(RakNet::RakNetGUID guid);
static DedicatedPlayer *GetPlayer(const MWWorld::Ptr &ptr);
static void Update(float dt);
static DedicatedPlayer *newPlayer(RakNet::RakNetGUID guid);
static void createPlayer(RakNet::RakNetGUID guid);
static void disconnectPlayer(RakNet::RakNetGUID guid);
static void cleanUp();
static DedicatedPlayer *getPlayer(RakNet::RakNetGUID guid);
static DedicatedPlayer *getPlayer(const MWWorld::Ptr &ptr);
static void update(float dt);
private:
static std::map<uint64_t, DedicatedPlayer *> players;
};
@ -45,9 +45,9 @@ namespace mwmp
MWWorld::Ptr getPtr();
MWWorld::Ptr getLiveCellPtr();
MWWorld::ManualRef* getRef();
void Move(float dt);
void UpdateDrawState();
void UpdateInventory();
void move(float dt);
void updateDrawState();
void updateInventory();
void updateCell();
@ -58,8 +58,8 @@ namespace mwmp
private:
DedicatedPlayer(RakNet::RakNetGUID guid);
virtual ~DedicatedPlayer();
void UpdatePtr(MWWorld::Ptr newPtr);
const std::string GetAnim();
void updatePtr(MWWorld::Ptr newPtr);
const std::string getAnim();
int state;
MWWorld::ManualRef* reference;

@ -130,8 +130,8 @@ namespace mwmp
*localPlayer->ChatMessage() = str;
RakNet::BitStream bs;
networking->GetPlayerPacket(ID_CHAT_MESSAGE)->Packet(&bs, localPlayer, true);
networking->SendData(&bs);
networking->getPlayerPacket(ID_CHAT_MESSAGE)->Packet(&bs, localPlayer, true);
networking->sendData(&bs);
}
void GUIChat::clean()
@ -139,7 +139,7 @@ namespace mwmp
mHistory->clearUserStrings();
}
void GUIChat::PressedChatMode()
void GUIChat::pressedChatMode()
{
windowState++;
if (windowState == 3) windowState = 0;
@ -169,7 +169,7 @@ namespace mwmp
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(editState ? mCommandLine : nullptr);
}
void GUIChat::PressedSay()
void GUIChat::pressedSay()
{
if (windowState == CHAT_DISABLED)
return;
@ -232,7 +232,7 @@ namespace mwmp
}
}
void GUIChat::SetDelay(float delay)
void GUIChat::setDelay(float delay)
{
this->delay = delay;
}

@ -46,9 +46,9 @@ namespace mwmp
GUIChat(int x, int y, int w, int h);
void PressedChatMode(); //switch chat mode
void PressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
void SetDelay(float delay);
void pressedChatMode(); //switch chat mode
void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED)
void setDelay(float delay);
void Update(float dt);

@ -45,7 +45,7 @@ mwmp::GUIController::~GUIController()
}
void mwmp::GUIController::cleanup()
void mwmp::GUIController::cleanUp()
{
mPlayerMarkers.clear();
if (mChat != nullptr)
@ -67,10 +67,10 @@ void mwmp::GUIController::setupChat(const Settings::Manager &mgr)
keyChatMode = SDL_GetKeyFromName(mgr.getString("keyChatMode", "Chat").c_str());
mChat = new GUIChat(chatX, chatY, chatW, chatH);
mChat->SetDelay(chatDelay);
mChat->setDelay(chatDelay);
}
void mwmp::GUIController::PrintChatMessage(std::string &msg)
void mwmp::GUIController::printChatMessage(std::string &msg)
{
if (mChat != nullptr)
mChat->print(msg);
@ -82,7 +82,7 @@ void mwmp::GUIController::setChatVisible(bool chatVisible)
mChat->setVisible(chatVisible);
}
void mwmp::GUIController::ShowDialogList(const mwmp::BasePlayer::GUIMessageBox &guiMessageBox)
void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox &guiMessageBox)
{
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
windowManager->removeDialog(mListBox);
@ -109,7 +109,7 @@ void mwmp::GUIController::ShowDialogList(const mwmp::BasePlayer::GUIMessageBox &
windowManager->pushGuiMode((MWGui::GuiMode)GM_TES3MP_ListBox);
}
void mwmp::GUIController::ShowMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox)
void mwmp::GUIController::showMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox)
{
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
std::vector<std::string> buttons;
@ -128,7 +128,7 @@ std::vector<std::string> splitString(const std::string &str, char delim = ';')
return result;
}
void mwmp::GUIController::ShowCustomMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox)
void mwmp::GUIController::showCustomMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox)
{
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
std::vector<std::string> buttons = splitString(guiMessageBox.buttons);
@ -136,7 +136,7 @@ void mwmp::GUIController::ShowCustomMessageBox(const BasePlayer::GUIMessageBox &
calledMessageBox = true;
}
void mwmp::GUIController::ShowInputBox(const BasePlayer::GUIMessageBox &guiMessageBox)
void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessageBox)
{
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
@ -145,17 +145,17 @@ void mwmp::GUIController::ShowInputBox(const BasePlayer::GUIMessageBox &guiMessa
mInputBox = 0;
mInputBox = new MWGui::TextInputDialog();
mInputBox->setTextLabel(guiMessageBox.label);
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::OnInputBoxDone);
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
}
void mwmp::GUIController::OnInputBoxDone(MWGui::WindowBase *parWindow)
void mwmp::GUIController::onInputBoxDone(MWGui::WindowBase *parWindow)
{
//MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
printf("GUIController::OnInputBoxDone: %s.\n",mInputBox->getTextInput().c_str());
Main::get().getLocalPlayer()->guiMessageBox.data = mInputBox->getTextInput();
Main::get().getNetworking()->GetPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
MWBase::Environment::get().getWindowManager()->removeDialog(mInputBox);
mInputBox = 0;
@ -169,18 +169,18 @@ bool mwmp::GUIController::pressedKey(int key)
return false;
if (key == keyChatMode)
{
mChat->PressedChatMode();
mChat->pressedChatMode();
return true;
}
else if (key == keySay)
{
mChat->PressedSay();
mChat->pressedSay();
return true;
}
return false;
}
bool mwmp::GUIController::HaveFocusedElement()
bool mwmp::GUIController::hasFocusedElement()
{
return false;
}
@ -197,7 +197,7 @@ void mwmp::GUIController::update(float dt)
printf("Pressed: %d\n", pressedButton);
calledMessageBox = false;
Main::get().getLocalPlayer()->guiMessageBox.data = MyGUI::utility::toString(pressedButton);
Main::get().getNetworking()->GetPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
}
blockConsole();
@ -258,7 +258,7 @@ private:
ESM::CustomMarker mwmp::GUIController::CreateMarker(const RakNet::RakNetGUID &guid)
{
DedicatedPlayer *player = Players::GetPlayer(guid);
DedicatedPlayer *player = Players::getPlayer(guid);
ESM::CustomMarker mEditingMarker;
if (!player)
{

@ -32,20 +32,20 @@ namespace mwmp
};
GUIController();
~GUIController();
void cleanup();
void cleanUp();
void setupChat(const Settings::Manager &manager);
void PrintChatMessage(std::string &msg);
void printChatMessage(std::string &msg);
void setChatVisible(bool chatVisible);
void ShowMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void ShowCustomMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void ShowInputBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void showMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void showCustomMessageBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void showInputBox(const BasePlayer::GUIMessageBox &guiMessageBox);
void ShowDialogList(const BasePlayer::GUIMessageBox &guiMessageBox);
void showDialogList(const BasePlayer::GUIMessageBox &guiMessageBox);
/// Return true if any tes3mp gui element in active state
bool HaveFocusedElement();
bool hasFocusedElement();
/// Returns 0 if there was no events
bool pressedKey(int key);
@ -70,7 +70,7 @@ namespace mwmp
bool calledMessageBox;
MWGui::TextInputDialog *mInputBox;
GUIDialogList *mListBox;
void OnInputBoxDone(MWGui::WindowBase* parWindow);
void onInputBoxDone(MWGui::WindowBase* parWindow);
//MyGUI::Widget *oldFocusWidget, *currentFocusWidget;
void blockConsole();
};

@ -37,7 +37,7 @@ void GUIDialogList::mousePressed(MyGUI::Widget * /*widget*/)
size_t id = mListBox->getIndexSelected();
Main::get().getLocalPlayer()->guiMessageBox.data = MyGUI::utility::toString(id);
Main::get().getNetworking()->GetPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send(Main::get().getLocalPlayer());
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Selected id: %d", id);
if(id == MyGUI::ITEM_NONE)

@ -44,17 +44,17 @@ LocalPlayer::~LocalPlayer()
}
Networking *LocalPlayer::GetNetworking()
Networking *LocalPlayer::getNetworking()
{
return mwmp::Main::get().getNetworking();
}
MWWorld::Ptr LocalPlayer::GetPlayerPtr()
MWWorld::Ptr LocalPlayer::getPlayerPtr()
{
return MWBase::Environment::get().getWorld()->getPlayerPtr();
}
void LocalPlayer::Update()
void LocalPlayer::update()
{
updateCell();
updatePosition();
@ -106,7 +106,7 @@ bool LocalPlayer::charGenThread()
windowManager->pushGuiMode(MWGui::GM_Review);
break;
}
GetNetworking()->GetPlayerPacket(ID_GAME_CHARGEN)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this);
CharGenStage()->current++;
return false;
@ -122,7 +122,7 @@ bool LocalPlayer::charGenThread()
(*BirthSign()) = world->getPlayer().getBirthSign();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server with my CharGen info");
GetNetworking()->GetPlayerPacket(ID_GAME_BASE_INFO)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_BASE_INFO)->Send(this);
// Send stats packets if this is the 2nd round of CharGen that
// only happens for new characters
@ -133,7 +133,7 @@ bool LocalPlayer::charGenThread()
updateSkills(true);
updateLevel(true);
sendClass();
GetNetworking()->GetPlayerPacket(ID_GAME_CHARGEN)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_CHARGEN)->Send(this);
}
// Set the last stage variable to 0 to indicate that CharGen is finished
@ -145,7 +145,7 @@ bool LocalPlayer::charGenThread()
void LocalPlayer::updateDynamicStats(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
MWMechanics::CreatureStats *ptrCreatureStats = &player.getClass().getCreatureStats(player);
MWMechanics::DynamicStat<float> health(ptrCreatureStats->getHealth());
@ -172,14 +172,14 @@ void LocalPlayer::updateDynamicStats(bool forceUpdate)
timer = 0;
GetNetworking()->GetPlayerPacket(ID_GAME_DYNAMICSTATS)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_DYNAMICSTATS)->Send(this);
}
}
}
void LocalPlayer::updateAttributes(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
bool isUpdating = false;
@ -194,13 +194,13 @@ void LocalPlayer::updateAttributes(bool forceUpdate)
if (isUpdating || forceUpdate)
{
GetNetworking()->GetPlayerPacket(ID_GAME_ATTRIBUTE)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_ATTRIBUTE)->Send(this);
}
}
void LocalPlayer::updateSkills(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
bool isUpdating = false;
@ -230,19 +230,19 @@ void LocalPlayer::updateSkills(bool forceUpdate)
if (isUpdating || forceUpdate)
{
NpcStats()->mLevelProgress = ptrNpcStats.getLevelProgress();
GetNetworking()->GetPlayerPacket(ID_GAME_SKILL)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_SKILL)->Send(this);
}
}
void LocalPlayer::updateLevel(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
const MWMechanics::NpcStats &ptrNpcStats = player.getClass().getNpcStats(player);
if (ptrNpcStats.getLevel() != CreatureStats()->mLevel || forceUpdate)
{
CreatureStats()->mLevel = ptrNpcStats.getLevel();
GetNetworking()->GetPlayerPacket(ID_GAME_LEVEL)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_LEVEL)->Send(this);
// Also update skills to refresh level progress and attribute bonuses
// for next level up
@ -282,7 +282,7 @@ void LocalPlayer::updatePosition(bool forceUpdate)
Dir()->pos[1] = move.mPosition[1];
Dir()->pos[2] = move.mPosition[2];
GetNetworking()->GetPlayerPacket(ID_GAME_POS)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this);
}
else if (isJumping && world->isOnGround(player))
{
@ -294,7 +294,7 @@ void LocalPlayer::updatePosition(bool forceUpdate)
{
sentJumpEnd = true;
(*Position()) = ptrPos;
GetNetworking()->GetPlayerPacket(ID_GAME_POS)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_POS)->Send(this);
}
}
@ -343,8 +343,8 @@ void LocalPlayer::updateCell(bool forceUpdate)
updatePosition(true);
RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_CELL)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_CELL)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
// Also update skill progress
updateSkills(true);
@ -367,7 +367,7 @@ void LocalPlayer::updateChar()
void LocalPlayer::updateEquipped(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
static bool equipChanged = false;
@ -407,8 +407,8 @@ void LocalPlayer::updateEquipped(bool forceUpdate)
{
RakNet::BitStream bs;
bs.ResetWritePointer();
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_EQUIPMENT)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_EQUIPMENT)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
equipChanged = false;
}
}
@ -419,7 +419,7 @@ void LocalPlayer::updateInventory(bool forceUpdate)
if (forceUpdate)
invChanged = true;
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
MWWorld::InventoryStore &invStore = player.getClass().getInventoryStore(player);
mwmp::Item item;
@ -490,13 +490,13 @@ void LocalPlayer::updateInventory(bool forceUpdate)
inventory.count = (unsigned int) inventory.items.size();
inventory.action = Inventory::UPDATE;
Main::get().getNetworking()->GetPlayerPacket(ID_GAME_INVENTORY)->Send(this);
Main::get().getNetworking()->getPlayerPacket(ID_GAME_INVENTORY)->Send(this);
}
void LocalPlayer::updateAttackState(bool forceUpdate)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
using namespace MWMechanics;
@ -511,14 +511,14 @@ void LocalPlayer::updateAttackState(bool forceUpdate)
{
const string &spell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
GetAttack()->attacker = guid;
GetAttack()->type = Attack::MAGIC;
GetAttack()->pressed = true;
GetAttack()->refid = spell;
getAttack()->attacker = guid;
getAttack()->type = Attack::MAGIC;
getAttack()->pressed = true;
getAttack()->refid = spell;
/*RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);*/
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
getNetworking()->SendData(&bs);*/
}
else if (state == MWMechanics::DrawState_Weapon)
{
@ -530,7 +530,7 @@ void LocalPlayer::updateAttackState(bool forceUpdate)
{
if (/*state == MWMechanics::DrawState_Spell ||*/ state == MWMechanics::DrawState_Weapon)
{
//localNetPlayer->GetAttack()->success = false;
//localNetPlayer->getAttack()->success = false;
//SendAttack(0);
}
attackPressed = false;
@ -539,7 +539,7 @@ void LocalPlayer::updateAttackState(bool forceUpdate)
void LocalPlayer::updateDeadState(bool forceUpdate)
{
MWWorld::Ptr player = GetPlayerPtr();
MWWorld::Ptr player = getPlayerPtr();
MWMechanics::NpcStats *ptrNpcStats = &player.getClass().getNpcStats(player);
static bool isDead = false;
@ -548,8 +548,8 @@ void LocalPlayer::updateDeadState(bool forceUpdate)
{
CreatureStats()->mDead = true;
RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID)ID_GAME_DIE)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID)ID_GAME_DIE)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
isDead = true;
}
else if (ptrNpcStats->getHealth().getCurrent() > 0 && isDead)
@ -615,8 +615,8 @@ void LocalPlayer::updateDrawStateAndFlags(bool forceUpdate)
mwmp::Main::get().getLocalPlayer()->updatePosition(true); // fix position after jump;
RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_DRAWSTATE)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_DRAWSTATE)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
//timer = 0;
}
}
@ -771,7 +771,7 @@ void LocalPlayer::setClass()
void LocalPlayer::setInventory()
{
MWWorld::Ptr ptrPlayer = GetPlayerPtr();
MWWorld::Ptr ptrPlayer = getPlayerPtr();
MWWorld::InventoryStore &ptrInventory = ptrPlayer.getClass().getInventoryStore(ptrPlayer);
@ -811,48 +811,48 @@ void LocalPlayer::sendClass()
else
charClass.mId = cls->mId;
GetNetworking()->GetPlayerPacket(ID_GAME_CHARCLASS)->Send(this);
getNetworking()->getPlayerPacket(ID_GAME_CHARCLASS)->Send(this);
}
void LocalPlayer::sendAttack(Attack::TYPE type)
{
MWMechanics::DrawState_ state = GetPlayerPtr().getClass().getNpcStats(GetPlayerPtr()).getDrawState();
MWMechanics::DrawState_ state = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
GetAttack()->type = type;
GetAttack()->pressed = false;
getAttack()->type = type;
getAttack()->pressed = false;
RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
}
void LocalPlayer::prepareAttack(Attack::TYPE type, bool state)
{
if (GetAttack()->pressed == state && type != Attack::MAGIC)
if (getAttack()->pressed == state && type != Attack::MAGIC)
return;
MWMechanics::DrawState_ dstate = GetPlayerPtr().getClass().getNpcStats(GetPlayerPtr()).getDrawState();
MWMechanics::DrawState_ dstate = getPlayerPtr().getClass().getNpcStats(getPlayerPtr()).getDrawState();
if (dstate == MWMechanics::DrawState_Spell)
{
const string &spell = MWBase::Environment::get().getWindowManager()->getSelectedSpell();
GetAttack()->success = Misc::Rng::roll0to99() < MWMechanics::getSpellSuccessChance(spell, GetPlayerPtr());
getAttack()->success = Misc::Rng::roll0to99() < MWMechanics::getSpellSuccessChance(spell, getPlayerPtr());
state = true;
GetAttack()->refid = spell;
getAttack()->refid = spell;
}
else
{
GetAttack()->success = false;
getAttack()->success = false;
}
GetAttack()->pressed = state;
GetAttack()->type = type;
GetAttack()->knockdown = false;
GetAttack()->block = false;
GetAttack()->target = RakNet::RakNetGUID();
GetAttack()->attacker = guid;
getAttack()->pressed = state;
getAttack()->type = type;
getAttack()->knockdown = false;
getAttack()->block = false;
getAttack()->target = RakNet::RakNetGUID();
getAttack()->attacker = guid;
RakNet::BitStream bs;
GetNetworking()->GetPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
GetNetworking()->SendData(&bs);
getNetworking()->getPlayerPacket((RakNet::MessageID) ID_GAME_ATTACK)->Packet(&bs, this, true);
getNetworking()->sendData(&bs);
}

@ -18,7 +18,7 @@ namespace mwmp
LocalPlayer();
virtual ~LocalPlayer();
void Update();
void update();
void charGen(int stageFirst, int stageEnd);
bool charGenThread(); // return true if CGStage::current == CGStage::end
@ -53,8 +53,8 @@ namespace mwmp
private:
Networking *GetNetworking();
MWWorld::Ptr GetPlayerPtr();
Networking *getNetworking();
MWWorld::Ptr getPlayerPtr();
};
}

@ -76,17 +76,17 @@ Main::~Main()
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "tes3mp stopped");
delete mNetworking;
delete mLocalPlayer;
Players::CleanUp();
Players::cleanUp();
}
void Main::OptionsDesc(boost::program_options::options_description *desc)
void Main::optionsDesc(boost::program_options::options_description *desc)
{
namespace bpo = boost::program_options;
desc->add_options()("connect", bpo::value<std::string>()->default_value(""),
"connect to server (e.g. --connect=127.0.0.1:25565)");
}
void Main::Configure(const boost::program_options::variables_map &variables)
void Main::configure(const boost::program_options::variables_map &variables)
{
Main::addr = variables["connect"].as<string>();
}
@ -113,7 +113,7 @@ void RestoreMgr(Settings::Manager &mgr)
mgr.mChangedSettings = saveChangedSettings;
}
void Main::Init(std::vector<std::string> &content)
void Main::init(std::vector<std::string> &content)
{
assert(!pMain);
pMain = new Main();
@ -136,11 +136,11 @@ void Main::Init(std::vector<std::string> &content)
}
pMain->mNetworking->Connect(pMain->server, pMain->port);
pMain->mNetworking->connect(pMain->server, pMain->port);
RestoreMgr(mgr);
}
void Main::PostInit()
void Main::postInit()
{
Settings::Manager mgr;
InitMgr(mgr);
@ -153,7 +153,7 @@ void Main::PostInit()
MWBase::Environment::get().getMechanicsManager()->toggleAI();
}
void Main::Destroy()
void Main::destroy()
{
assert(pMain);
@ -161,20 +161,20 @@ void Main::Destroy()
pMain = 0;
}
void Main::Frame(float dt)
void Main::frame(float dt)
{
const MWBase::Environment &environment = MWBase::Environment::get();
get().getNetworking()->Update();
get().getNetworking()->update();
Players::Update(dt);
get().UpdateWorld(dt);
Players::update(dt);
get().updateWorld(dt);
get().getGUIController()->update(dt);
}
void Main::UpdateWorld(float dt) const
void Main::updateWorld(float dt) const
{
if (!mLocalPlayer->charGenThread())
@ -186,13 +186,13 @@ void Main::UpdateWorld(float dt) const
init = false;
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s", "Sending ID_GAME_BASE_INFO to server");
mNetworking->GetPlayerPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer());
mNetworking->GetPlayerPacket(ID_LOADED)->Send(getLocalPlayer());
mNetworking->getPlayerPacket(ID_GAME_BASE_INFO)->Send(getLocalPlayer());
mNetworking->getPlayerPacket(ID_LOADED)->Send(getLocalPlayer());
mLocalPlayer->updateDynamicStats(true);
get().getGUIController()->setChatVisible(true);
}
else
mLocalPlayer->Update();
mLocalPlayer->update();
}
const Main &Main::get()
@ -221,7 +221,7 @@ WorldController *Main::getWorldController() const
return mWorldController;
}
void Main::PressedKey(int key)
void Main::pressedKey(int key)
{
if (pMain == nullptr) return;
if (get().getGUIController()->pressedKey(key))

@ -13,14 +13,14 @@ namespace mwmp
Main();
~Main();
static void OptionsDesc(boost::program_options::options_description *desc);
static void Configure(const boost::program_options::variables_map &variables);
static void Init(std::vector<std::string> &content);
static void PostInit();
static void Destroy();
static void optionsDesc(boost::program_options::options_description *desc);
static void configure(const boost::program_options::variables_map &variables);
static void init(std::vector<std::string> &content);
static void postInit();
static void destroy();
static const Main &get();
static void Frame(float dt);
static void PressedKey(int key);
static void frame(float dt);
static void pressedKey(int key);
static bool isValidPacketScript(std::string script);
@ -29,7 +29,7 @@ namespace mwmp
GUIController *getGUIController() const;
WorldController *getWorldController() const;
void UpdateWorld(float dt) const;
void updateWorld(float dt) const;
private:
static std::string addr;

@ -53,7 +53,7 @@ Networking::~Networking()
RakNet::RakPeerInterface::DestroyInstance(peer);
}
void Networking::Update()
void Networking::update()
{
RakNet::Packet *packet;
std::string errmsg = "";
@ -87,7 +87,7 @@ void Networking::Update()
errmsg = "Connection lost.";
break;
default:
ReceiveMessage(packet);
receiveMessage(packet);
//LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Message with identifier %i has arrived.", packet->data[0]);
break;
}
@ -101,12 +101,12 @@ void Networking::Update()
}
}
void Networking::SendData(RakNet::BitStream *bs)
void Networking::sendData(RakNet::BitStream *bs)
{
peer->Send(bs, HIGH_PRIORITY, RELIABLE_ORDERED, 0, serverAddr, false);
}
void Networking::Connect(const std::string &ip, unsigned short port)
void Networking::connect(const std::string &ip, unsigned short port)
{
RakNet::SystemAddress master;
master.SetBinaryAddress(ip.c_str());
@ -173,7 +173,7 @@ void Networking::Connect(const std::string &ip, unsigned short port)
}
}
void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
void Networking::processPlayerPacket(RakNet::Packet *packet)
{
RakNet::RakNetGUID guid;
RakNet::BitStream bsIn(&packet->data[1], packet->length, false);
@ -182,7 +182,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
DedicatedPlayer *pl = 0;
static RakNet::RakNetGUID myGuid = getLocalPlayer()->guid;
if (guid != myGuid)
pl = Players::GetPlayer(guid);
pl = Players::getPlayer(guid);
PlayerPacket *myPacket = playerController.GetPacket(packet->data[0]);
@ -190,7 +190,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
{
case ID_HANDSHAKE:
{
(*getLocalPlayer()->GetPassw()) = "SuperPassword";
(*getLocalPlayer()->getPassw()) = "SuperPassword";
myPacket->Send(getLocalPlayer(), serverAddr);
break;
}
@ -221,11 +221,11 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
if (pl == 0)
{
LOG_APPEND(Log::LOG_INFO, "%s", "- Exchanging data with new player");
pl = Players::NewPlayer(guid);
pl = Players::newPlayer(guid);
}
myPacket->Packet(&bsIn, pl, false);
Players::CreatePlayer(guid);
Players::createPlayer(guid);
}
break;
}
@ -261,7 +261,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
if (guid == myGuid)
MWBase::Environment::get().getStateManager()->requestQuit();
else if (pl != 0)
Players::DisconnectPlayer(guid);
Players::disconnectPlayer(guid);
}
case ID_GAME_EQUIPMENT:
@ -281,7 +281,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
pl->UpdateInventory();
pl->updateInventory();
}
break;
}
@ -293,7 +293,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
{
printf("ID_GAME_INVENTORY update only\n");
getLocalPlayer()->updateInventory(true);
GetPlayerPacket(ID_GAME_INVENTORY)->Send(getLocalPlayer());
getPlayerPacket(ID_GAME_INVENTORY)->Send(getLocalPlayer());
}
else
{
@ -341,27 +341,27 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
{
myPacket->Packet(&bsIn, pl, false);
//cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->GetAttack()->pressed == 1) << endl;
if (pl->GetAttack()->pressed == 0)
//cout << "Player: " << pl->Npc()->mName << " pressed: " << (pl->getAttack()->pressed == 1) << endl;
if (pl->getAttack()->pressed == 0)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Attack success: %s",
pl->GetAttack()->success ? "true" : "false");
pl->getAttack()->success ? "true" : "false");
if (pl->GetAttack()->success == 1)
if (pl->getAttack()->success == 1)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Damage: %f",
pl->GetAttack()->damage);
pl->getAttack()->damage);
}
}
MWMechanics::CreatureStats &stats = pl->getPtr().getClass().getNpcStats(pl->getPtr());
stats.getSpells().setSelectedSpell(pl->GetAttack()->refid);
stats.getSpells().setSelectedSpell(pl->getAttack()->refid);
MWWorld::Ptr victim;
if (pl->GetAttack()->target == getLocalPlayer()->guid)
if (pl->getAttack()->target == getLocalPlayer()->guid)
victim = MWBase::Environment::get().getWorld()->getPlayerPtr();
else if (Players::GetPlayer(pl->GetAttack()->target) != 0)
victim = Players::GetPlayer(pl->GetAttack()->target)->getPtr();
else if (Players::getPlayer(pl->getAttack()->target) != 0)
victim = Players::getPlayer(pl->getAttack()->target)->getPtr();
MWWorld::Ptr attacker;
attacker = pl->getPtr();
@ -388,16 +388,16 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
}
if (!weapon.isEmpty())
MWMechanics::blockMeleeAttack(attacker, victim, weapon, pl->GetAttack()->damage, 1);
pl->getPtr().getClass().onHit(victim, pl->GetAttack()->damage, healthdmg, weapon, attacker, osg::Vec3f(),
pl->GetAttack()->success);
MWMechanics::blockMeleeAttack(attacker, victim, weapon, pl->getAttack()->damage, 1);
pl->getPtr().getClass().onHit(victim, pl->getAttack()->damage, healthdmg, weapon, attacker, osg::Vec3f(),
pl->getAttack()->success);
}
}
else
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "SpellId: %s",
pl->GetAttack()->refid.c_str());
LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", pl->GetAttack()->success);
pl->getAttack()->refid.c_str());
LOG_APPEND(Log::LOG_VERBOSE, " - success: %d", pl->getAttack()->success);
}
}
break;
@ -512,7 +512,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
else if (pl != 0)
{
myPacket->Packet(&bsIn, pl, false);
pl->UpdateDrawState();
pl->updateDrawState();
}
break;
}
@ -529,7 +529,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
myPacket->Packet(&bsIn, pl, false);
message = *pl->ChatMessage();
}
Main::get().getGUIController()->PrintChatMessage(message);
Main::get().getGUIController()->printChatMessage(message);
break;
}
@ -637,13 +637,13 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
getLocalPlayer()->guiMessageBox.label.c_str());
if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::MessageBox)
Main::get().getGUIController()->ShowMessageBox(getLocalPlayer()->guiMessageBox);
Main::get().getGUIController()->showMessageBox(getLocalPlayer()->guiMessageBox);
else if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox)
Main::get().getGUIController()->ShowCustomMessageBox(getLocalPlayer()->guiMessageBox);
Main::get().getGUIController()->showCustomMessageBox(getLocalPlayer()->guiMessageBox);
else if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::InputDialog)
Main::get().getGUIController()->ShowInputBox(getLocalPlayer()->guiMessageBox);
Main::get().getGUIController()->showInputBox(getLocalPlayer()->guiMessageBox);
else if (getLocalPlayer()->guiMessageBox.type == BasePlayer::GUIMessageBox::ListBox)
Main::get().getGUIController()->ShowDialogList(getLocalPlayer()->guiMessageBox);
Main::get().getGUIController()->showDialogList(getLocalPlayer()->guiMessageBox);
}
break;
}
@ -687,7 +687,7 @@ void Networking::ProcessPlayerPacket(RakNet::Packet *packet)
}
}
void Networking::ProcessWorldPacket(RakNet::Packet *packet)
void Networking::processWorldPacket(RakNet::Packet *packet)
{
RakNet::RakNetGUID guid;
RakNet::BitStream bsIn(&packet->data[1], packet->length, false);
@ -696,7 +696,7 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
DedicatedPlayer *pl = 0;
static RakNet::RakNetGUID myGuid = getLocalPlayer()->guid;
if (guid != myGuid)
pl = Players::GetPlayer(guid);
pl = Players::getPlayer(guid);
WorldPacket *myPacket = worldController.GetPacket(packet->data[0]);
WorldEvent *event = new WorldEvent(guid);
@ -1050,27 +1050,27 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
}
}
void Networking::ReceiveMessage(RakNet::Packet *packet)
void Networking::receiveMessage(RakNet::Packet *packet)
{
if (packet->length < 2)
return;
if (playerController.ContainsPacket(packet->data[0]))
{
ProcessPlayerPacket(packet);
processPlayerPacket(packet);
}
else if (worldController.ContainsPacket(packet->data[0]))
{
ProcessWorldPacket(packet);
processWorldPacket(packet);
}
}
PlayerPacket *Networking::GetPlayerPacket(RakNet::MessageID id)
PlayerPacket *Networking::getPlayerPacket(RakNet::MessageID id)
{
return playerController.GetPacket(id);
}
WorldPacket *Networking::GetWorldPacket(RakNet::MessageID id)
WorldPacket *Networking::getWorldPacket(RakNet::MessageID id)
{
return worldController.GetPacket(id);
}
@ -1089,19 +1089,19 @@ bool Networking::isDedicatedPlayer(const MWWorld::Ptr &ptr)
{
if (ptr.mRef == 0)
return 0;
DedicatedPlayer *pl = Players::GetPlayer(ptr);
DedicatedPlayer *pl = Players::getPlayer(ptr);
return pl != 0;
}
bool Networking::Attack(const MWWorld::Ptr &ptr)
bool Networking::attack(const MWWorld::Ptr &ptr)
{
DedicatedPlayer *pl = Players::GetPlayer(ptr);
DedicatedPlayer *pl = Players::getPlayer(ptr);
if (pl == 0)
return false;
return pl->GetAttack()->pressed;
return pl->getAttack()->pressed;
}
bool Networking::isConnected()

@ -31,15 +31,15 @@ namespace mwmp
public:
Networking();
~Networking();
void Connect(const std::string& ip, unsigned short port);
void Update();
void SendData(RakNet::BitStream *bitStream);
void connect(const std::string& ip, unsigned short port);
void update();
void sendData(RakNet::BitStream *bitStream);
PlayerPacket *GetPlayerPacket(RakNet::MessageID id);
WorldPacket *GetWorldPacket(RakNet::MessageID id);
PlayerPacket *getPlayerPacket(RakNet::MessageID id);
WorldPacket *getWorldPacket(RakNet::MessageID id);
bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
bool Attack(const MWWorld::Ptr &ptr);
bool attack(const MWWorld::Ptr &ptr);
RakNet::SystemAddress serverAddress()
{
@ -59,9 +59,9 @@ namespace mwmp
PlayerPacketController playerController;
WorldPacketController worldController;
void ProcessPlayerPacket(RakNet::Packet *packet);
void ProcessWorldPacket(RakNet::Packet *packet);
void ReceiveMessage(RakNet::Packet *packet);
void processPlayerPacket(RakNet::Packet *packet);
void processWorldPacket(RakNet::Packet *packet);
void receiveMessage(RakNet::Packet *packet);
LocalPlayer *getLocalPlayer();
};
}

@ -70,7 +70,7 @@ namespace MWScript
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->animGroup = group;
event->animMode = mode;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send(event);
}
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup (ptr, group, mode, std::numeric_limits<int>::max(), true);

@ -190,7 +190,7 @@ namespace MWScript
event->cellRef.mRefNum = mReference.getCellRef().getRefNum();
event->index = index;
event->shortVal = value;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send(event);
printf("Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i\n",
event->cellRef.mRefID.c_str(),
@ -227,7 +227,7 @@ namespace MWScript
event->cellRef.mRefNum = mReference.getCellRef().getRefNum();
event->index = index;
event->floatVal = value;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(event);
printf("Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f\n",
event->cellRef.mRefID.c_str(),
@ -285,7 +285,7 @@ namespace MWScript
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
event->varName = name;
event->shortVal = value;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send(event);
printf("Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i\n",
event->varName.c_str(),
@ -615,7 +615,7 @@ namespace MWScript
event->cellRef.mRefID = id;
event->index = index;
event->shortVal = value;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send(event);
printf("Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i\n",
event->cellRef.mRefID.c_str(),

@ -92,7 +92,7 @@ namespace MWScript
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
event->video = name;
event->allowSkipping = allowSkipping;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_VIDEO_PLAY)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send(event);
MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping);
}
@ -198,7 +198,7 @@ namespace MWScript
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->lockLevel = lockLevel;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_LOCK)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send(event);
ptr.getClass().lock (ptr, lockLevel);
@ -231,7 +231,7 @@ namespace MWScript
event->cell = *ptr.getCell()->getCell();
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send(event);
ptr.getClass().unlock (ptr);
}
@ -698,7 +698,7 @@ namespace MWScript
event->cell = *ptr.getCell()->getCell();
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_DELETE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
MWBase::Environment::get().getWorld()->deleteObject(ptr);
}

@ -51,7 +51,7 @@ namespace MWScript
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->cellRef.mPos = ptr.getCellRef().getPosition();
event->scale = scale;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_SCALE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send(event);
MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
}
@ -555,7 +555,7 @@ namespace MWScript
event->pos = ptr.getRefData().getPosition();
event->count = 1;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(event);
printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n",
event->cellRef.mRefID.c_str(),

@ -27,7 +27,7 @@ namespace MWWorld
event->cell = *getTarget().getCell()->getCell();
event->cellRef.mRefID = getTarget().getCellRef().getRefId();
event->cellRef.mRefNum = getTarget().getCellRef().getRefNum();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_DELETE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send(event);
printf("Sending ID_OBJECT_DELETE about\n- cellRef: %s, %i\n- cell: %s\n",
event->cellRef.mRefID.c_str(),

@ -2257,7 +2257,7 @@ namespace MWWorld
event->cellRef.mRefID = door.getCellRef().getRefId();
event->cellRef.mRefNum = door.getCellRef().getRefNum();
event->state = state;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_DOOR_ACTIVATE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_ACTIVATE)->Send(event);
printf("Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
event->cellRef.mRefID.c_str(),
@ -2277,7 +2277,7 @@ namespace MWWorld
event->cellRef.mRefID = door.getCellRef().getRefId();
event->cellRef.mRefNum = door.getCellRef().getRefNum();
event->state = state;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_DOOR_ACTIVATE)->Send(event);
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_ACTIVATE)->Send(event);
printf("Door activation 2\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
event->cellRef.mRefID.c_str(),

@ -143,7 +143,7 @@ namespace mwmp
return &dir;
}
virtual Attack *GetAttack()
virtual Attack *getAttack()
{
return &attack;
}
@ -163,7 +163,7 @@ namespace mwmp
return &stage;
}
virtual std::string *GetPassw()
virtual std::string *getPassw()
{
return &passw;
}

@ -16,14 +16,14 @@ void PacketAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool
{
PlayerPacket::Packet(bs, player, send);
RW(player->GetAttack()->attacker, send);
RW(player->GetAttack()->target, send);
RW(player->GetAttack()->refid, send);
RW(player->GetAttack()->type, send);
RW(player->GetAttack()->success, send);
RW(player->GetAttack()->damage, send);
RW(player->getAttack()->attacker, send);
RW(player->getAttack()->target, send);
RW(player->getAttack()->refid, send);
RW(player->getAttack()->type, send);
RW(player->getAttack()->success, send);
RW(player->getAttack()->damage, send);
//
RW(player->GetAttack()->pressed, send);
RW(player->GetAttack()->knockdown, send);
RW(player->GetAttack()->block, send);
RW(player->getAttack()->pressed, send);
RW(player->getAttack()->knockdown, send);
RW(player->getAttack()->block, send);
}

@ -16,5 +16,5 @@ void PacketHandshake::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen
{
PlayerPacket::Packet(bs, player, send);
RW(player->Npc()->mName, send);
RW(*player->GetPassw(), send);
RW(*player->getPassw(), send);
}

Loading…
Cancel
Save