Tracer: Replace Client * with Client &

This commit is contained in:
yvt 2019-08-08 01:09:22 +09:00
parent 066eda82df
commit 1a4594d9bd
No known key found for this signature in database
GPG Key ID: 48F2768FA8D07C92
3 changed files with 7 additions and 7 deletions

View File

@ -1097,7 +1097,7 @@ namespace spades {
case SMG_WEAPON: vel = 360.f; break; case SMG_WEAPON: vel = 360.f; break;
case SHOTGUN_WEAPON: vel = 500.f; break; case SHOTGUN_WEAPON: vel = 500.f; break;
} }
AddLocalEntity(stmp::make_unique<Tracer>(this, muzzlePos, hitPos, vel)); AddLocalEntity(stmp::make_unique<Tracer>(*this, muzzlePos, hitPos, vel));
AddLocalEntity(stmp::make_unique<MapViewTracer>(muzzlePos, hitPos, vel)); AddLocalEntity(stmp::make_unique<MapViewTracer>(muzzlePos, hitPos, vel));
} }

View File

@ -13,8 +13,8 @@
namespace spades { namespace spades {
namespace client { namespace client {
Tracer::Tracer(Client *cli, Vector3 p1, Vector3 p2, float bulletVel) Tracer::Tracer(Client &_client, Vector3 p1, Vector3 p2, float bulletVel)
: client(cli), startPos(p1), velocity(bulletVel) { : client(_client), startPos(p1), velocity(bulletVel) {
dir = (p2 - p1).Normalize(); dir = (p2 - p1).Normalize();
length = (p2 - p1).GetLength(); length = (p2 - p1).GetLength();
@ -29,7 +29,7 @@ namespace spades {
firstUpdate = true; firstUpdate = true;
image = cli->GetRenderer().RegisterImage("Gfx/Ball.png"); image = client.GetRenderer().RegisterImage("Gfx/Ball.png");
} }
bool Tracer::Update(float dt) { bool Tracer::Update(float dt) {
@ -44,7 +44,7 @@ namespace spades {
} }
void Tracer::Render3D() { void Tracer::Render3D() {
IRenderer &r = client->GetRenderer(); IRenderer &r = client.GetRenderer();
if (dynamic_cast<draw::SWRenderer *>(&r)) { if (dynamic_cast<draw::SWRenderer *>(&r)) {
// SWRenderer doesn't support long sprites (yet) // SWRenderer doesn't support long sprites (yet)
float startDist = curDistance; float startDist = curDistance;

View File

@ -17,7 +17,7 @@ namespace spades {
class Client; class Client;
class IImage; class IImage;
class Tracer : public ILocalEntity { class Tracer : public ILocalEntity {
Client *client; Client &client;
Handle<IImage> image; Handle<IImage> image;
Vector3 startPos, dir; Vector3 startPos, dir;
float length; float length;
@ -27,7 +27,7 @@ namespace spades {
bool firstUpdate; bool firstUpdate;
public: public:
Tracer(Client *, Vector3 p1, Vector3 p2, float bulletVel); Tracer(Client &, Vector3 p1, Vector3 p2, float bulletVel);
~Tracer(); ~Tracer();
bool Update(float dt) override; bool Update(float dt) override;