@@ -186,12 +186,6 @@ void CVehicleSA::Init()
186
186
}
187
187
188
188
CopyGlobalSuspensionLinesToPrivate ();
189
-
190
- // clear our rw frames list
191
- m_ExtraFrames.clear ();
192
- // dump the frames
193
- VehicleDump (this );
194
- FinalizeFramesList ();
195
189
}
196
190
197
191
CVehicleSA::~CVehicleSA ()
@@ -1949,6 +1943,7 @@ void CVehicleSA::AddComponent(RwFrame* pFrame, bool bReadOnly)
1949
1943
// if the frame is invalid we don't want to be here
1950
1944
if (!pFrame)
1951
1945
return ;
1946
+
1952
1947
// if the frame already exists ignore it
1953
1948
if (IsComponentPresent (pFrame->szName ) || pFrame->szName == " " )
1954
1949
return ;
@@ -1957,23 +1952,22 @@ void CVehicleSA::AddComponent(RwFrame* pFrame, bool bReadOnly)
1957
1952
// variants have no name field.
1958
1953
if (strName == " " )
1959
1954
{
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
+
1960
1959
// name starts with extra
1961
1960
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
+
1972
1965
// increment the variant count ( we assume that the first variant created is variant1 and the second is variant2 )
1973
1966
m_ucVariantCount++;
1974
1967
}
1975
- SVehicleFrame frame = SVehicleFrame (pFrame, bReadOnly);
1968
+
1976
1969
// insert our new frame
1970
+ SVehicleFrame frame = SVehicleFrame (pFrame, bReadOnly);
1977
1971
m_ExtraFrames.insert (std::pair<SString, SVehicleFrame>(strName, frame));
1978
1972
}
1979
1973
@@ -2001,6 +1995,16 @@ void CVehicleSA::FinalizeFramesList()
2001
1995
}
2002
1996
}
2003
1997
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
+
2004
2008
bool CVehicleSA::SetComponentVisible (const SString& vehicleComponent, bool bRequestVisible)
2005
2009
{
2006
2010
SVehicleFrame* pComponent = GetVehicleComponent (vehicleComponent);
0 commit comments