Reinstate some of the old code. You can't move things around like that because the m_type isn't initialised on all code paths if you do. It must be initialised before you can get the info about the number of docking bays from it and setup some other bits which is why it's done in InitStation.