#include <msp/core/maputils.h>
#include <msp/gltk/button.h>
+#include <msp/gltk/root.h>
#include <msp/strings/format.h>
#include "libr2c2/layout.h"
#include "libr2c2/vehicle.h"
void VehiclesPanel::add_clicked()
{
- GLtk::Container *root = parent;
- while(root->get_parent())
- root = root->get_parent();
-
NewVehicleDialog *dlg = new NewVehicleDialog(train);
- root->add(*dlg);
+ find_ancestor<GLtk::Root>()->add(*dlg);
dlg->autosize();
}