mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fixed namespace issues. Removed static
This commit is contained in:
parent
4dbacbead8
commit
a48b6c9426
@ -1,13 +1,11 @@
|
||||
#include "DamageType.h"
|
||||
|
||||
using namespace ace::medical;
|
||||
|
||||
injuries::DamageType::DamageType(std::string aTypeName, double minimalLethalDamage, double minDamage, double maxDamage)
|
||||
ace::medical::injuries::DamageType::DamageType(std::string aTypeName, double minimalLethalDamage, double minDamage, double maxDamage)
|
||||
: typeName(aTypeName), minLethalDamage(minimalLethalDamage), minDamageThreshold(minDamage), maxDamageThreshold(maxDamage)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
injuries::DamageType::~DamageType()
|
||||
ace::medical::injuries::DamageType::~DamageType()
|
||||
{
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
#include "InjuryType.h"
|
||||
#include "DamageType.h"
|
||||
|
||||
using namespace ace::medical;
|
||||
|
||||
injuries::InjuryType::InjuryType(signed int anId, const std::string& aClassname, std::vector<std::string>& allowedSelections, double theBloodLoss, double thePain, double minimumDamage, double maximumDamage, std::vector<std::string>& possibleCauses, std::string& aDisplayname)
|
||||
ace::medical::injuries::InjuryType::InjuryType(signed int anId, const std::string& aClassname, std::vector<std::string>& allowedSelections, double theBloodLoss, double thePain, double minimumDamage, double maximumDamage, std::vector<std::string>& possibleCauses, std::string& aDisplayname)
|
||||
: ID(anId), className(aClassname), selections(allowedSelections), bloodLoss(theBloodLoss), pain(thePain), minDamage(minimumDamage), maxDamage(maximumDamage), causes(possibleCauses), displayName(aDisplayname)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
injuries::InjuryType::~InjuryType()
|
||||
ace::medical::injuries::InjuryType::~InjuryType()
|
||||
{
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
#include "OpenWound.h"
|
||||
#include <sstream>
|
||||
|
||||
using namespace ace::medical;
|
||||
|
||||
injuries::OpenWound::OpenWound(double anID, double aBodyPart, double bloodloss) : classID(anID), bodyPart(aBodyPart), bloodlossRate(bloodloss)
|
||||
ace::medical::injuries::OpenWound::OpenWound(double anID, double aBodyPart, double bloodloss) : classID(anID), bodyPart(aBodyPart), bloodlossRate(bloodloss)
|
||||
{
|
||||
}
|
||||
|
||||
injuries::OpenWound::~OpenWound()
|
||||
ace::medical::injuries::OpenWound::~OpenWound()
|
||||
{
|
||||
}
|
||||
|
||||
std::string injuries::OpenWound::AsString()
|
||||
std::string ace::medical::injuries::OpenWound::AsString()
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << classID << "," << bodyPart << "," << 1 << "," << bloodlossRate;
|
||||
|
@ -4,91 +4,94 @@
|
||||
#include "InjuryType.h"
|
||||
#include <sstream>
|
||||
|
||||
using namespace ace::medical;
|
||||
namespace ace {
|
||||
namespace medical {
|
||||
|
||||
handleDamage::handleDamage()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
handleDamage::~handleDamage()
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ std::vector<injuries::OpenWound> handleDamage::HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage)
|
||||
{
|
||||
std::vector<injuries::OpenWound> wounds;
|
||||
int selectionN = SelectionToNumber(selectionName);
|
||||
if (selectionN >= 0)
|
||||
{
|
||||
std::vector<std::shared_ptr<injuries::InjuryType>> injuryTypeInfo = GetInjuryInfoFor(typeOfDamage);
|
||||
}
|
||||
|
||||
return wounds;
|
||||
}
|
||||
|
||||
/* static */ void handleDamage::AddDamageType(const std::vector<std::string>& input)
|
||||
{
|
||||
if (input.size() == 4)
|
||||
{
|
||||
std::string typeName = input[0];
|
||||
double minimalLethalDamage = std::stod(input[1]);
|
||||
double minDamageThreshold = std::stod(input[2]);
|
||||
double maxDamageThreshold = std::stod(input[3]);
|
||||
|
||||
std::shared_ptr<injuries::DamageType> type(new injuries::DamageType(typeName, minimalLethalDamage, minDamageThreshold, maxDamageThreshold));
|
||||
damageTypes.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void handleDamage::AddInjuryType(const std::vector<std::string>& input)
|
||||
{
|
||||
if (input.size() == 9)
|
||||
{
|
||||
// TODO parse arrays from string input
|
||||
|
||||
int ID = std::stod(input[0]);
|
||||
std::string className = input[1];
|
||||
std::vector<std::string> allowedSelections; // input[2];
|
||||
double bloodLoss = std::stod(input[3]);
|
||||
double pain = std::stod(input[4]);
|
||||
|
||||
double minDamage = std::stod(input[5]);
|
||||
double maxDamage = std::stod(input[6]);
|
||||
std::vector<std::string> possibleCauses; // input[7];
|
||||
std::string displayName = input[8];
|
||||
|
||||
std::shared_ptr<injuries::InjuryType> type(new injuries::InjuryType(ID, className, allowedSelections, bloodLoss, pain, minDamage, maxDamage, possibleCauses, displayName));
|
||||
injuryTypes.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ void handleDamage::FinalizeDefinitions()
|
||||
{
|
||||
// We are finding all possible injuries for a specific damage type here, so we don't have to figure that out at a later stage.
|
||||
for each (std::shared_ptr<injuries::DamageType> damageType in damageTypes)
|
||||
{
|
||||
for each (std::shared_ptr<injuries::InjuryType> injuryType in injuryTypes)
|
||||
{
|
||||
if (find(injuryType->causes.begin(), injuryType->causes.end(), damageType->typeName) != injuryType->causes.end())
|
||||
{
|
||||
damageType->possibleInjuries.push_back(injuryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ int SelectionToNumber(const std::string& selectionName)
|
||||
{
|
||||
// TODO use dynamic selections instead
|
||||
std::vector<std::string> selections = {"head", "body", "hand_l", "hand_r", "leg_l", "leg_r"};
|
||||
std::vector<std::string>::iterator it = find(selections.begin(), selections.end(), selectionName);
|
||||
if (it != selections.end())
|
||||
{
|
||||
return it - selections.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1; // TODO throw exception
|
||||
}
|
||||
handleDamage::handleDamage()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
handleDamage::~handleDamage()
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ std::vector<ace::medical::injuries::OpenWound> handleDamage::HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage)
|
||||
{
|
||||
std::vector<ace::medical::injuries::OpenWound> wounds;
|
||||
int selectionN = SelectionToNumber(selectionName);
|
||||
if (selectionN >= 0)
|
||||
{
|
||||
// std::vector<std::shared_ptr<ace::medical::injuries::InjuryType>> injuryTypeInfo = GetInjuryInfoFor(typeOfDamage);
|
||||
}
|
||||
|
||||
return wounds;
|
||||
}
|
||||
|
||||
/* static */ void handleDamage::AddDamageType(const std::vector<std::string>& input)
|
||||
{
|
||||
if (input.size() == 4)
|
||||
{
|
||||
std::string typeName = input[0];
|
||||
double minimalLethalDamage = std::stod(input[1]);
|
||||
double minDamageThreshold = std::stod(input[2]);
|
||||
double maxDamageThreshold = std::stod(input[3]);
|
||||
|
||||
std::shared_ptr<ace::medical::injuries::DamageType> type(new ace::medical::injuries::DamageType(typeName, minimalLethalDamage, minDamageThreshold, maxDamageThreshold));
|
||||
damageTypes.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
void handleDamage::AddInjuryType(const std::vector<std::string>& input)
|
||||
{
|
||||
if (input.size() == 9)
|
||||
{
|
||||
// TODO parse arrays from string input
|
||||
|
||||
int ID = std::stod(input[0]);
|
||||
std::string className = input[1];
|
||||
std::vector<std::string> allowedSelections; // input[2];
|
||||
double bloodLoss = std::stod(input[3]);
|
||||
double pain = std::stod(input[4]);
|
||||
|
||||
double minDamage = std::stod(input[5]);
|
||||
double maxDamage = std::stod(input[6]);
|
||||
std::vector<std::string> possibleCauses; // input[7];
|
||||
std::string displayName = input[8];
|
||||
|
||||
std::shared_ptr<ace::medical::injuries::InjuryType> type(new ace::medical::injuries::InjuryType(ID, className, allowedSelections, bloodLoss, pain, minDamage, maxDamage, possibleCauses, displayName));
|
||||
injuryTypes.push_back(type);
|
||||
}
|
||||
}
|
||||
|
||||
void handleDamage::FinalizeDefinitions()
|
||||
{
|
||||
// We are finding all possible injuries for a specific damage type here, so we don't have to figure that out at a later stage.
|
||||
for each (std::shared_ptr<ace::medical::injuries::DamageType> damageType in damageTypes)
|
||||
{
|
||||
for each (std::shared_ptr<ace::medical::injuries::InjuryType> injuryType in injuryTypes)
|
||||
{
|
||||
if (find(injuryType->causes.begin(), injuryType->causes.end(), damageType->typeName) != injuryType->causes.end())
|
||||
{
|
||||
damageType->possibleInjuries.push_back(injuryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int handleDamage::SelectionToNumber(const std::string& selectionName)
|
||||
{
|
||||
// TODO use dynamic selections instead
|
||||
std::vector<std::string> selections = { "head", "body", "hand_l", "hand_r", "leg_l", "leg_r" };
|
||||
std::vector<std::string>::iterator it = find(selections.begin(), selections.end(), selectionName);
|
||||
if (it != selections.end())
|
||||
{
|
||||
return it - selections.begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1; // TODO throw exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,46 +21,46 @@ namespace ace {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static std::vector<injuries::OpenWound> HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage);
|
||||
std::vector<ace::medical::injuries::OpenWound> HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void AddDamageType(const std::vector<std::string>& sqfDamageTypeDefinition);
|
||||
void AddDamageType(const std::vector<std::string>& sqfDamageTypeDefinition);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void AddInjuryType(const std::vector<std::string>& sqfInjuryDefinition);
|
||||
void AddInjuryType(const std::vector<std::string>& sqfInjuryDefinition);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static std::string SetInjuryTypeData(const std::string& data);
|
||||
//static std::string SetInjuryTypeData(const std::string& data);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static int SelectionToNumber(const std::string& selectionName);
|
||||
int SelectionToNumber(const std::string& selectionName);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static std::vector<std::shared_ptr<injuries::InjuryType>> GetInjuryInfoFor(const std::string& damageType);
|
||||
//static std::vector<std::shared_ptr<ace::medical::injuries::InjuryType>> GetInjuryInfoFor(const std::string& damageType);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void FinalizeDefinitions();
|
||||
void FinalizeDefinitions();
|
||||
|
||||
private:
|
||||
handleDamage();
|
||||
|
||||
static std::vector<std::shared_ptr<injuries::DamageType>> damageTypes;
|
||||
static std::vector<std::shared_ptr<injuries::InjuryType>> injuryTypes;
|
||||
static std::vector<std::string> selections;
|
||||
static std::vector<std::string> hitPoints;
|
||||
std::vector<std::shared_ptr<ace::medical::injuries::DamageType>> damageTypes;
|
||||
std::vector<std::shared_ptr<ace::medical::injuries::InjuryType>> injuryTypes;
|
||||
std::vector<std::string> selections;
|
||||
std::vector<std::string> hitPoints;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user