mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 18:39:40 +00:00
begining factions
This commit is contained in:
parent
b46a2bfa01
commit
f9bb19fcdc
2 changed files with 74 additions and 0 deletions
|
@ -89,4 +89,57 @@ namespace MWWorld
|
||||||
|
|
||||||
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Run, !running);
|
MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Run, !running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player::Faction Player::getFaction(std::string faction)
|
||||||
|
{
|
||||||
|
for(std::list<Player::Faction>::iterator it = mFactions.begin(); it != mFactions.end();it++)
|
||||||
|
{
|
||||||
|
if(it->name == faction) return *it;
|
||||||
|
}
|
||||||
|
//faction was not found->dummy faction
|
||||||
|
Player::Faction fact;
|
||||||
|
fact.id = "not found";
|
||||||
|
fact.name = "not found";
|
||||||
|
fact.rank = -10;
|
||||||
|
fact.expelled = false;
|
||||||
|
return fact;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::addFaction(std::string faction)
|
||||||
|
{
|
||||||
|
if(getFaction(faction).name == "not found")
|
||||||
|
{
|
||||||
|
Player::Faction fact;
|
||||||
|
const ESM::Faction* eFact = mWorld.getStore().factions.find(faction);
|
||||||
|
fact.expelled = false;
|
||||||
|
fact.rank = 0;
|
||||||
|
fact.name = faction;
|
||||||
|
fact.id = eFact->id;
|
||||||
|
mFactions.push_back(fact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Player::getRank(std::string faction)
|
||||||
|
{
|
||||||
|
Player::Faction fact = getFaction(faction);
|
||||||
|
return fact.rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::setRank(std::string faction,int rank)
|
||||||
|
{
|
||||||
|
Player::Faction fact = getFaction(faction);
|
||||||
|
fact.rank = rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Player::isExpelled(std::string faction)
|
||||||
|
{
|
||||||
|
Player::Faction fact = getFaction(faction);
|
||||||
|
return fact.expelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::setExpelled(std::string faction,bool expelled)
|
||||||
|
{
|
||||||
|
Player::Faction fact = getFaction(faction);
|
||||||
|
fact.expelled = expelled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "OgreCamera.h"
|
#include "OgreCamera.h"
|
||||||
|
|
||||||
#include <components/esm_store/cell_store.hpp>
|
#include <components/esm_store/cell_store.hpp>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
@ -20,6 +21,13 @@ namespace MWWorld
|
||||||
/// \brief NPC object representing the player and additional player data
|
/// \brief NPC object representing the player and additional player data
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
|
struct Faction
|
||||||
|
{
|
||||||
|
std::string id,name;
|
||||||
|
int rank;
|
||||||
|
bool expelled;
|
||||||
|
};
|
||||||
|
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||||
MWWorld::Ptr::CellStore *mCellStore;
|
MWWorld::Ptr::CellStore *mCellStore;
|
||||||
MWRender::Player *mRenderer;
|
MWRender::Player *mRenderer;
|
||||||
|
@ -29,9 +37,12 @@ namespace MWWorld
|
||||||
std::string mRace;
|
std::string mRace;
|
||||||
std::string mBirthsign;
|
std::string mBirthsign;
|
||||||
ESM::Class *mClass;
|
ESM::Class *mClass;
|
||||||
|
std::list<Faction> mFactions;
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
int mForwardBackward;
|
int mForwardBackward;
|
||||||
|
|
||||||
|
Faction getFaction(std::string faction);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||||
|
@ -108,6 +119,16 @@ namespace MWWorld
|
||||||
|
|
||||||
void setAutoMove (bool enable);
|
void setAutoMove (bool enable);
|
||||||
|
|
||||||
|
void addFaction(std::string faction);
|
||||||
|
|
||||||
|
int getRank(std::string faction);
|
||||||
|
|
||||||
|
void setRank(std::string faction,int rank);
|
||||||
|
|
||||||
|
bool isExpelled(std::string faction);
|
||||||
|
|
||||||
|
void setExpelled(std::string faction,bool expelled);
|
||||||
|
|
||||||
void setLeftRight (int value);
|
void setLeftRight (int value);
|
||||||
|
|
||||||
void setForwardBackward (int value);
|
void setForwardBackward (int value);
|
||||||
|
|
Loading…
Reference in a new issue