File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1515// You should have received a copy of the GNU General Public License
1616// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717
18- using System ;
18+ using System . Linq ;
1919using Microsoft . Xna . Framework ;
2020using Microsoft . Xna . Framework . Graphics ;
21+ using Orts . Simulation . RollingStocks ;
2122using Orts . Viewer3D . RollingStock ;
2223
2324namespace Orts . Viewer3D . Popups
@@ -41,7 +42,13 @@ public override void Draw(SpriteBatch spriteBatch)
4142 if ( Viewer . Camera is CabCamera && ( Viewer . PlayerLocomotiveViewer as MSTSLocomotiveViewer ) . _hasCabRenderer )
4243 {
4344 var cabRenderer = ( Viewer . PlayerLocomotiveViewer as MSTSLocomotiveViewer ) . _CabRenderer ;
44- foreach ( var controlRenderer in cabRenderer . ControlMap . Values )
45+
46+ var loco = Viewer . PlayerLocomotive as MSTSLocomotive ;
47+ var cabViewFrontRear = loco . UsingRearCab ? 1 : 0 ;
48+ var itemsFrontCount = loco . CabViewList [ ( int ) CabViewType . Front ] . CVFFile . CabViewControls . Count ( ) - 1 ;
49+ var itemsRearCount = loco . CabViewList . Count > 1 ? loco . CabViewList [ ( int ) CabViewType . Rear ] . CVFFile . CabViewControls . Count ( ) - 1 : 0 ;
50+
51+ foreach ( var controlRenderer in cabRenderer . ControlMap . Values . Skip ( cabViewFrontRear == 0 ? 0 : itemsFrontCount ) . Take ( cabViewFrontRear == 0 ? itemsFrontCount : itemsRearCount ) )
4552 {
4653 if ( ( Viewer . Camera as CabCamera ) . SideLocation == controlRenderer . Control . CabViewpoint && controlRenderer is ICabViewMouseControlRenderer mouseRenderer )
4754 {
You can’t perform that action at this time.
0 commit comments