@@ -186,12 +186,6 @@ void CVehicleSA::Init()
186186 }
187187
188188 CopyGlobalSuspensionLinesToPrivate ();
189-
190- // clear our rw frames list
191- m_ExtraFrames.clear ();
192- // dump the frames
193- VehicleDump (this );
194- FinalizeFramesList ();
195189}
196190
197191CVehicleSA::~CVehicleSA ()
@@ -1949,6 +1943,7 @@ void CVehicleSA::AddComponent(RwFrame* pFrame, bool bReadOnly)
19491943 // if the frame is invalid we don't want to be here
19501944 if (!pFrame)
19511945 return ;
1946+
19521947 // if the frame already exists ignore it
19531948 if (IsComponentPresent (pFrame->szName ) || pFrame->szName == " " )
19541949 return ;
@@ -1957,23 +1952,22 @@ void CVehicleSA::AddComponent(RwFrame* pFrame, bool bReadOnly)
19571952 // variants have no name field.
19581953 if (strName == " " )
19591954 {
1955+ // In MTA variant 255 means no variant
1956+ if ((m_ucVariantCount == 0 && m_ucVariant == 255 ) || (m_ucVariantCount == 1 && m_ucVariant2 == 255 ))
1957+ return ;
1958+
19601959 // name starts with extra
19611960 strName = " extra_" ;
1962- if (m_ucVariantCount == 0 )
1963- {
1964- // variants are extra_a, extra_b and so on
1965- strName += (' a' - 1 ) + m_ucVariant;
1966- }
1967- if (m_ucVariantCount == 1 )
1968- {
1969- // variants are extra_a, extra_b and so on
1970- strName += (' a' - 1 ) + m_ucVariant2;
1971- }
1961+
1962+ // variants are extra_a - extra_f
1963+ strName += ' a' + (m_ucVariantCount == 0 ? m_ucVariant : m_ucVariant2);
1964+
19721965 // increment the variant count ( we assume that the first variant created is variant1 and the second is variant2 )
19731966 m_ucVariantCount++;
19741967 }
1975- SVehicleFrame frame = SVehicleFrame (pFrame, bReadOnly);
1968+
19761969 // insert our new frame
1970+ SVehicleFrame frame = SVehicleFrame (pFrame, bReadOnly);
19771971 m_ExtraFrames.insert (std::pair<SString, SVehicleFrame>(strName, frame));
19781972}
19791973
@@ -2001,6 +1995,16 @@ void CVehicleSA::FinalizeFramesList()
20011995 }
20021996}
20031997
1998+ void CVehicleSA::DumpVehicleFrames ()
1999+ {
2000+ // clear our rw frames list
2001+ m_ExtraFrames.clear ();
2002+
2003+ // dump the frames
2004+ VehicleDump (this );
2005+ FinalizeFramesList ();
2006+ }
2007+
20042008bool CVehicleSA::SetComponentVisible (const SString& vehicleComponent, bool bRequestVisible)
20052009{
20062010 SVehicleFrame* pComponent = GetVehicleComponent (vehicleComponent);
0 commit comments