forked from teamnwah/openmw-tes3coop
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);
|
||||
}
|
||||
|
||||
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 <components/esm_store/cell_store.hpp>
|
||||
#include <list>
|
||||
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -20,6 +21,13 @@ namespace MWWorld
|
|||
/// \brief NPC object representing the player and additional player data
|
||||
class Player
|
||||
{
|
||||
struct Faction
|
||||
{
|
||||
std::string id,name;
|
||||
int rank;
|
||||
bool expelled;
|
||||
};
|
||||
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> mPlayer;
|
||||
MWWorld::Ptr::CellStore *mCellStore;
|
||||
MWRender::Player *mRenderer;
|
||||
|
@ -29,9 +37,12 @@ namespace MWWorld
|
|||
std::string mRace;
|
||||
std::string mBirthsign;
|
||||
ESM::Class *mClass;
|
||||
std::list<Faction> mFactions;
|
||||
bool mAutoMove;
|
||||
int mForwardBackward;
|
||||
|
||||
Faction getFaction(std::string faction);
|
||||
|
||||
public:
|
||||
|
||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||
|
@ -108,6 +119,16 @@ namespace MWWorld
|
|||
|
||||
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 setForwardBackward (int value);
|
||||
|
|
Loading…
Reference in a new issue