Skip to content

Commit 60d5a40

Browse files
committed
When creating floor indicators, name additional indicators uniquely using the indicator's index value
1 parent bceb97c commit 60d5a40

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/sbs/elevatorcar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ FloorIndicator* ElevatorCar::AddFloorIndicator(const std::string &texture_prefix
505505
{
506506
//Creates a floor indicator at the specified location
507507

508-
FloorIndicator* indicator = new FloorIndicator(this, parent->Number, Number, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, voffset);
508+
FloorIndicator* indicator = new FloorIndicator(this, FloorIndicatorArray.size(), parent->Number, Number, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, voffset);
509509
FloorIndicatorArray.emplace_back(indicator);
510510
return indicator;
511511
}

src/sbs/floor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ FloorIndicator* Floor::AddFloorIndicator(int elevator, int car, bool relative, c
907907

908908
if (relative == false)
909909
{
910-
FloorIndicator *ind = new FloorIndicator(this, elevator, car, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, GetBase(true) + voffset);
910+
FloorIndicator *ind = new FloorIndicator(this, FloorIndicatorArray.size(), elevator, car, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, GetBase(true) + voffset);
911911
FloorIndicatorArray.emplace_back(ind);
912912
return ind;
913913
}
@@ -916,7 +916,7 @@ FloorIndicator* Floor::AddFloorIndicator(int elevator, int car, bool relative, c
916916
Elevator* elev = sbs->GetElevator(elevator);
917917
if (elev)
918918
{
919-
FloorIndicator *ind = new FloorIndicator(this, elevator, car, texture_prefix, blank_texture, direction, elev->GetPosition().x + CenterX, elev->GetPosition().z + CenterZ, width, height, GetBase(true) + voffset);
919+
FloorIndicator *ind = new FloorIndicator(this, FloorIndicatorArray.size(), elevator, car, texture_prefix, blank_texture, direction, elev->GetPosition().x + CenterX, elev->GetPosition().z + CenterZ, width, height, GetBase(true) + voffset);
920920
FloorIndicatorArray.emplace_back(ind);
921921
return ind;
922922
}

src/sbs/floorindicator.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class FloorIndicator::Timer : public TimerObject
4747
virtual void Notify();
4848
};
4949

50-
FloorIndicator::FloorIndicator(Object *parent, int elevator, int car, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset) : Object(parent)
50+
FloorIndicator::FloorIndicator(Object *parent, int index, int elevator, int car, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real voffset) : Object(parent)
5151
{
5252
//creates a new floor indicator at the specified position
5353

@@ -64,7 +64,12 @@ FloorIndicator::FloorIndicator(Object *parent, int elevator, int car, const std:
6464
//move object
6565
Move(CenterX, voffset, CenterZ);
6666

67-
std::string name = "Floor Indicator " + ToString(elevator);
67+
std::string ext = ":" + ToString(index + 1);
68+
std::string name;
69+
if (index == 0)
70+
name = "Floor Indicator " + ToString(elevator);
71+
else
72+
name = "Floor Indicator " + ToString(elevator) + ext;
6873
SetName(name);
6974

7075
FloorIndicatorMesh = new MeshObject(this, name, 0, "", "", sbs->GetConfigFloat("Skyscraper.SBS.MaxSmallRenderDistance", 100));

src/sbs/floorindicator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SBSIMPEXP FloorIndicator : public Object
3636
std::string Blank; //blank texture name
3737

3838
//functions
39-
FloorIndicator(Object *parent, int elevator, int car, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real altitude);
39+
FloorIndicator(Object *parent, int index, int elevator, int car, const std::string &texture_prefix, const std::string &blank_texture, const std::string &direction, Real CenterX, Real CenterZ, Real width, Real height, Real altitude);
4040
~FloorIndicator();
4141
void Enabled(bool value);
4242
void Update(bool blank = false);

0 commit comments

Comments
 (0)