[Time] strict spawn_events now take into account EQ minute. (#1370)

* strict spawn_events now take into account EQ minute.

This should fixed the eqtime spawn condition from falling behind.

* change a log to logspawns and add a comment in ExecEvent function.

* moved the comment to the note paramenter in the rule for last commit.
This commit is contained in:
regneq
2021-06-11 11:32:35 -07:00
committed by GitHub
parent b61cc85b5f
commit ebdb8e5d90
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -832,8 +832,11 @@ void SpawnConditionManager::Process() {
if(EQTime::IsTimeBefore(&tod, &cevent.next)) {
//this event has been triggered.
//execute the event
if(!cevent.strict || (cevent.strict && cevent.next.hour == tod.hour && cevent.next.day == tod.day && cevent.next.month == tod.month && cevent.next.year == tod.year))
uint8 min = cevent.next.minute + RuleI(Zone, SpawnEventMin);
if(!cevent.strict || (cevent.strict && tod.minute < min && cevent.next.hour == tod.hour && cevent.next.day == tod.day && cevent.next.month == tod.month && cevent.next.year == tod.year))
ExecEvent(cevent, true);
else
LogSpawns("Event {}: Is strict, ExecEvent is skipped.", cevent.id);
//add the period of the event to the trigger time
EQTime::AddMinutes(cevent.period, &cevent.next);
@@ -858,6 +861,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
std::map<uint16, SpawnCondition>::iterator condi;
condi = spawn_conditions.find(event.condition_id);
if(condi == spawn_conditions.end()) {
//If we're here, strict has already been checked. Check again in case hour has changed.
LogSpawns("Event [{}]: Unable to find condition [{}] to execute on", event.id, event.condition_id);
return; //unable to find the spawn condition to operate on
}