Support for passing a random seed.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e6f84f182a
commit
436e68293e
|
@ -4,9 +4,9 @@ using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
export uint8_t CreatureLib_Battle_Construct(Battle*& out, const BattleLibrary* library, BattleParty* partyArr[],
|
export uint8_t CreatureLib_Battle_Construct(Battle*& out, const BattleLibrary* library, BattleParty* partyArr[],
|
||||||
size_t numberOfParties, bool canFlee, uint8_t numberOfSides,
|
size_t numberOfParties, bool canFlee, uint8_t numberOfSides,
|
||||||
uint8_t creaturesPerSide) {
|
uint8_t creaturesPerSide, uint_fast32_t randomSeed) {
|
||||||
Try(ArbUt::List<BattleParty*> parties(partyArr, partyArr + numberOfParties);
|
Try(ArbUt::List<BattleParty*> parties(partyArr, partyArr + numberOfParties);
|
||||||
out = new Battle(library, parties, canFlee, numberOfSides, creaturesPerSide);)
|
out = new Battle(library, parties, canFlee, numberOfSides, creaturesPerSide, randomSeed);)
|
||||||
}
|
}
|
||||||
|
|
||||||
export void CreatureLib_Battle_Destruct(const Battle* p) { delete p; }
|
export void CreatureLib_Battle_Destruct(const Battle* p) { delete p; }
|
||||||
|
|
|
@ -34,9 +34,12 @@ namespace CreatureLib::Battling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Battle(const BattleLibrary* library, ArbUt::List<BattleParty*> parties, bool canFlee = true,
|
Battle(const BattleLibrary* library, ArbUt::List<BattleParty*> parties, bool canFlee = true,
|
||||||
uint8_t numberOfSides = 2, uint8_t creaturesPerSide = 1)
|
uint8_t numberOfSides = 2, uint8_t creaturesPerSide = 1,
|
||||||
|
uint_fast32_t randomSeed = std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
|
.count())
|
||||||
: _library(library), _parties(parties.GetStdList()), _canFlee(canFlee), _numberOfSides(numberOfSides),
|
: _library(library), _parties(parties.GetStdList()), _canFlee(canFlee), _numberOfSides(numberOfSides),
|
||||||
_creaturesPerSide(creaturesPerSide), _sides(numberOfSides) {
|
_creaturesPerSide(creaturesPerSide), _sides(numberOfSides), _random(randomSeed) {
|
||||||
AssertNotNull(_library);
|
AssertNotNull(_library);
|
||||||
AssertAllNotNull(parties);
|
AssertAllNotNull(parties);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue