Skip to content

Commit 6089084

Browse files
committed
Move addWall out of WorldInfo. Fixes #341.
1 parent 2e52264 commit 6089084

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/bzfs/WorldInfo.cxx

-10
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "BaseBuilding.h"
4040
#include "TetraBuilding.h"
4141
#include "Teleporter.h"
42-
#include "WallObstacle.h"
4342
#include "MeshObstacle.h"
4443
#include "ArcObstacle.h"
4544
#include "ConeObstacle.h"
@@ -76,15 +75,6 @@ WorldInfo::~WorldInfo()
7675
finished = false;
7776
}
7877

79-
80-
void WorldInfo::addWall(float x, float y, float z, float r, float w, float h)
81-
{
82-
const float pos[3] = {x, y, z};
83-
WallObstacle* wall = new WallObstacle(pos, r, w, h, false);
84-
OBSTACLEMGR.addWorldObstacle(wall);
85-
}
86-
87-
8878
void WorldInfo::addLink(int src, int dst)
8979
{
9080
links.addLink(src, dst);

src/bzfs/bzfs.cxx

+13-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
// common implementation headers
5656
#include "Obstacle.h"
5757
#include "ObstacleMgr.h"
58+
#include "WallObstacle.h"
5859
#include "CollisionManager.h"
5960
#include "BaseBuilding.h"
6061
#include "AnsiCodes.h"
@@ -1050,6 +1051,13 @@ static void relayPlayerPacket(int index, uint16_t len, const void *rawbuf, uint1
10501051
}
10511052
}
10521053

1054+
void addWall(float x, float y, float z, float r, float w, float h)
1055+
{
1056+
const float pos[3] = { x, y, z };
1057+
WallObstacle* wall = new WallObstacle(pos, r, w, h, false);
1058+
OBSTACLEMGR.addWorldObstacle(wall);
1059+
}
1060+
10531061
void makeWalls ( void )
10541062
{
10551063
float worldSize = BZDBCache::worldSize;
@@ -1079,16 +1087,16 @@ void makeWalls ( void )
10791087
float x = sinf(midpointAngle*degToRad)*midpointRad;
10801088
float y = cosf(midpointAngle*degToRad)*midpointRad;
10811089

1082-
world->addWall(x, y, 0.0f, (270.0f-midpointAngle)*degToRad, (float)segmentLen, wallHeight);
1090+
addWall(x, y, 0.0f, (270.0f-midpointAngle)*degToRad, (float)segmentLen, wallHeight);
10831091

10841092
}
10851093
}
10861094
else
10871095
{
1088-
world->addWall(0.0f, 0.5f * worldSize, 0.0f, (float)(1.5 * M_PI), 0.5f * worldSize, wallHeight);
1089-
world->addWall(0.5f * worldSize, 0.0f, 0.0f, (float)M_PI, 0.5f * worldSize, wallHeight);
1090-
world->addWall(0.0f, -0.5f * worldSize, 0.0f, (float)(0.5 * M_PI), 0.5f * worldSize, wallHeight);
1091-
world->addWall(-0.5f * worldSize, 0.0f, 0.0f, 0.0f, 0.5f * worldSize, wallHeight);
1096+
addWall(0.0f, 0.5f * worldSize, 0.0f, (float)(1.5 * M_PI), 0.5f * worldSize, wallHeight);
1097+
addWall(0.5f * worldSize, 0.0f, 0.0f, (float)M_PI, 0.5f * worldSize, wallHeight);
1098+
addWall(0.0f, -0.5f * worldSize, 0.0f, (float)(0.5 * M_PI), 0.5f * worldSize, wallHeight);
1099+
addWall(-0.5f * worldSize, 0.0f, 0.0f, 0.0f, 0.5f * worldSize, wallHeight);
10921100
}
10931101
}
10941102

0 commit comments

Comments
 (0)