This commit is contained in:
Glowbal 2015-05-17 09:48:59 +02:00
parent 556b9ad7d8
commit 2544cdef4a
3 changed files with 29 additions and 24 deletions

View File

@ -50,7 +50,6 @@ namespace ace {
return stream.str(); return stream.str();
} }
stream << "";
return stream.str(); return stream.str();
} }
@ -152,8 +151,6 @@ namespace ace {
{ {
if (input.size() == 9) if (input.size() == 9)
{ {
// TODO parse arrays from string input
int ID = std::stod(input[0]); int ID = std::stod(input[0]);
std::string className = input[1]; std::string className = input[1];
std::vector<std::string> allowedSelections = inputToVector(input[2]); std::vector<std::string> allowedSelections = inputToVector(input[2]);
@ -186,10 +183,8 @@ namespace ace {
return "failed"; return "failed";
} }
std::string handleDamage::FinalizeDefinitions() void handleDamage::FinalizeDefinitions()
{ {
std::stringstream outputstream;
// 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. // 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::DamageType> damageType in damageTypes)
{ {
@ -202,9 +197,7 @@ namespace ace {
damageType->possibleInjuries.push_back(injuryType); damageType->possibleInjuries.push_back(injuryType);
} }
} }
outputstream << " ---- For: " << damageType->typeName << " Added: " << damageType->possibleInjuries.size() << " --- ";
} }
return outputstream.str();
} }
int handleDamage::SelectionToNumber(const std::string& selectionName) int handleDamage::SelectionToNumber(const std::string& selectionName)

View File

@ -24,42 +24,55 @@ namespace ace {
~handleDamage(); ~handleDamage();
/** /**
* Find new open wounds from advanced medical based upon the received damage.
* *
* @param selectionName A string representation of the bodypart (for example: leg_r)
* @param amountOfDamage The damage received
* @param typeOfDamage The type of the damage received
* @param woundID latest wound ID
* @return SQF string containing _woundsCreated and _painAdded.
*/ */
std::string HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage, int woundID); std::string HandleDamageWounds(const std::string& selectionName, double amountOfDamage, const std::string& typeOfDamage, int woundID);
/**
* Find new open wounds from advanced medical based upon the received damage.
*
* @param typeOfDamage The type of the damage received
* @param amountOfDamage The damage received
* @param selection A number representation of the bodypart. Number from 0 to 6.
* @param woundID latest wound ID
* @return New open wounds.
*/
std::vector<ace::medical::injuries::OpenWound> GetInjuryInfoFor(const std::string& typeOfDamage, double amountOfDamage, int selection, int woundID); std::vector<ace::medical::injuries::OpenWound> GetInjuryInfoFor(const std::string& typeOfDamage, double amountOfDamage, int selection, int woundID);
/** /**
* Add a new damage type from extension input parameters
* *
* @param sqfDamageTypeDefinition
* @return String with result of addition: ADDED [parameters] or FAILED
*/ */
std::string AddDamageType(const std::vector<std::string>& sqfDamageTypeDefinition); std::string AddDamageType(const std::vector<std::string>& sqfDamageTypeDefinition);
/** /**
* Add a new injury type from extension input parameters
* *
* @param sqfDamageTypeDefinition
* @return String with result of addition: ADDED [parameters] or FAILED
*/ */
std::string AddInjuryType(const std::vector<std::string>& sqfInjuryDefinition); std::string AddInjuryType(const std::vector<std::string>& sqfInjuryDefinition);
/** /**
* Convert a selectionName to a number
* *
*/ * @param selectionName
//static std::string SetInjuryTypeData(const std::string& data); * @return number of selection
/**
*
*/ */
int SelectionToNumber(const std::string& selectionName); int SelectionToNumber(const std::string& selectionName);
/** /**
* * Lets the system know that all data has been added
*/ */
//static std::vector<std::shared_ptr<ace::medical::injuries::InjuryType>> GetInjuryInfoFor(const std::string& damageType); void FinalizeDefinitions();
/**
*
*/
std::string FinalizeDefinitions();
private: private:
handleDamage(); handleDamage();

View File

@ -35,7 +35,6 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
} }
else else
{ {
std::string returnValue = ""; std::string returnValue = "";
std::vector<std::string> arguments = parseExtensionInput(function); std::vector<std::string> arguments = parseExtensionInput(function);
if (arguments.size() > 0) if (arguments.size() > 0)
@ -59,7 +58,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
} }
} }
else if (command == "ConfigComplete") { else if (command == "ConfigComplete") {
returnValue = ace::medical::handleDamage::GetInstance().FinalizeDefinitions(); ace::medical::handleDamage::GetInstance().FinalizeDefinitions();
} }
} }
strncpy(output, returnValue.c_str(), outputSize); strncpy(output, returnValue.c_str(), outputSize);