burghout / mezzo

Mezzo mesoscopic traffic simulation
2 stars 0 forks source link

Busstop() constructor does not create Random #43

Open burghout opened 6 years ago

burghout commented 6 years ago

Problem random is deleted in destructor but not initialised in Busstop()

Busstop::Busstop()
{
    length = 20;
    position = 0;
    has_bay = false;
    can_overtake = true;
    dwelltime = 0;
    rti = 0;
}

Busstop::Busstop (int id_, string name_, int link_id_, double position_, double length_, bool has_bay_, bool can_overtake_, double min_DT_, int rti_, bool gate_flag_, ControlCenter* CC_):
id(id_), name(name_), link_id(link_id_), position (position_), length(length_), has_bay(has_bay_), can_overtake(can_overtake_), min_DT(min_DT_), rti (rti_), gate_flag (gate_flag_), CC (CC_)
{
    avaliable_length = length;
    nr_boarding = 0;
    nr_alighting = 0;
    dwelltime = 0;
    is_origin = false;
    is_destination = false;
    last_arrivals.clear();
    last_departures.clear();
    random = new (Random);
    if (randseed != 0)
        {
        random->seed(randseed);
        }
    else
    {
        random->randomize();
    }
}

Busstop::~Busstop ()
{
    delete random;
}