// Remove an event. // Pass in a position and a bool that says whether // the event is an accident void Event::RemoveEvent(Position *position, bool accident) { if(position->end != 0) { Road * road = position->beginning->FindRoad(position->end); road->SetBlocked(false); } else position->beginning->SetBlocked(false); }
// Create an event. // Pass in a position and a bool that says whether // the event is an accident void Event::CreateEvent(Position *position, bool accident) { if(position->end != 0) { Road * road = position->beginning->FindRoad(position->end); road->SetBlocked(true); if(accident) road->IncrementAccidents(); } else { position->beginning->SetBlocked(true); position->beginning->IncrementAccidents(); } }