public bool EventStartsWithin(ushort buildingID, double hours, bool countStarted = false) { for (int index = 0; index < m_nextEvents.Count; ++index) { CityEvent thisEvent = m_nextEvents[index]; if (thisEvent.m_eventData.m_eventBuilding == buildingID && (thisEvent.EventStartsWithin(hours) || (countStarted && thisEvent.m_eventData.m_eventStarted))) { return(true); } } return(false); }
public FastList <CityEvent> EventsThatStartWithin(double hours, bool countStarted = false) { FastList <CityEvent> _eventsWithin = new FastList <CityEvent>(); for (int index = 0; index < m_nextEvents.Count; ++index) { CityEvent thisEvent = m_nextEvents[index]; if (thisEvent.EventStartsWithin(hours) || (countStarted && thisEvent.m_eventData.m_eventStarted)) { _eventsWithin.Add(thisEvent); } } return(_eventsWithin); }
public int EventStartsWithin(uint citizenID, ref Citizen person, double hours, bool countStarted = false) { int foundEventIndex = -1; for (int index = 0; index < m_nextEvents.Count; ++index) { CityEvent thisEvent = m_nextEvents[index]; if ((thisEvent.EventStartsWithin(hours) && thisEvent.CitizenCanGo(citizenID, ref person)) || (countStarted && thisEvent.m_eventData.m_eventStarted)) { foundEventIndex = index; break; } } return(foundEventIndex); }
public void ClearDeadEvents() { bool clearAllEvents = false; CimTools.CimToolsHandler.CimToolBase.ModPanelOptions.GetOptionValue("ClearEvents", ref clearAllEvents); if (clearAllEvents) { CimTools.CimToolsHandler.CimToolBase.ModPanelOptions.SetOptionValue("ClearEvents", false); } if (m_nextEvents.Count > 0) { for (int index = 0; index < m_nextEvents.Count; ++index) { bool clearEvent = false || clearAllEvents; CityEvent thisEvent = m_nextEvents[index]; if ((thisEvent.m_eventData.m_eventEnded && (CITY_TIME - thisEvent.m_eventData.m_eventFinishTime).TotalHours > _eventEndBuffer)) { clearEvent = true; Debug.Log("Event finished"); LoggingWrapper.Log("Event finished"); } else if (!thisEvent.m_eventData.m_eventStarted && !thisEvent.m_eventData.m_eventEnded && !thisEvent.EventStartsWithin(24 * 7)) { clearEvent = true; Debug.LogWarning("Event had more than a week of buffer. Removed."); LoggingWrapper.LogWarning("Event had more than a week of buffer. Removed."); } if (clearEvent) { m_nextEvents.RemoveAt(index); --index; } else { m_nextEvents[index].Update(); } } } }