Skip to content

Commit 3683228

Browse files
committed
[linux] fix explicit constructors for structs
1 parent 3b73956 commit 3683228

File tree

5 files changed

+9
-27
lines changed

5 files changed

+9
-27
lines changed

src/apps/engine/src/script_cache.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ struct FunctionLocalVariable
1515
LocalVarInfo info;
1616
bool is_extern;
1717

18-
FunctionLocalVariable(LocalVarInfo info, bool is_extern)
18+
FunctionLocalVariable(LocalVarInfo info, bool is_extern) : info(std::move(info)), is_extern(std::move(is_extern))
1919
{
20-
this->info = info;
21-
this->is_extern = is_extern;
2220
}
2321
};
2422

@@ -29,9 +27,8 @@ struct Function
2927
std::vector<LocalVarInfo> local_variables;
3028

3129
Function(FuncInfo info, std::vector<FunctionLocalVariable> arguments)
30+
: info(std::move(info)), arguments(std::move(arguments))
3231
{
33-
this->info = info;
34-
this->arguments = arguments;
3532
}
3633
};
3734

@@ -41,9 +38,8 @@ struct EventHandler
4138
std::string function_name;
4239

4340
EventHandler(std::string event_name, std::string function_name)
41+
: event_name(std::move(event_name)), function_name(std::move(function_name))
4442
{
45-
this->event_name = event_name;
46-
this->function_name = function_name;
4743
}
4844
};
4945

@@ -54,10 +50,8 @@ struct Define
5450
uintptr_t value;
5551

5652
Define(std::string name, uint32_t type, uintptr_t value)
53+
: name(std::move(name)), type(std::move(type)), value(std::move(value))
5754
{
58-
this->name = name;
59-
this->type = type;
60-
this->value = value;
6155
}
6256
};
6357

src/libs/common/include/dx9render.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ struct RS_LINE
5050
RS_LINE()
5151
{
5252
}
53-
RS_LINE(CVECTOR vPos, uint32_t dwColor)
53+
RS_LINE(CVECTOR vPos, uint32_t dwColor) : vPos(std::move(vPos)), dwColor(std::move(dwColor))
5454
{
55-
this->vPos = vPos;
56-
this->dwColor = dwColor;
5755
}
5856
};
5957

src/libs/location/src/lights.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ class Lights : public Entity
5959
int32_t id;
6060
int32_t light;
6161

62-
MovingLight(int32_t id, int32_t light)
62+
MovingLight(int32_t id, int32_t light) : id(std::move(id)), light(std::move(light))
6363
{
64-
this->id = id;
65-
this->light = light;
6664
}
6765
};
6866

src/libs/location/src/supervisor.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ class Supervisor
3434
float d2; // The square of the distance to the character in xz
3535

3636
FindCharacter(Character *c, float dx, float dy, float dz, float d2)
37+
: c(std::move(c)), dx(std::move(dx)), dy(std::move(dy)), dz(std::move(dz)), d2(std::move(d2))
3738
{
38-
this->c = c;
39-
this->dx = dx;
40-
this->dy = dy;
41-
this->dz = dz;
42-
this->d2 = d2;
4339
}
4440
};
4541

@@ -48,10 +44,8 @@ class Supervisor
4844
Character *c;
4945
float lastTime;
5046

51-
CharacterEx(Character *c, float lastTime)
47+
CharacterEx(Character *c, float lastTime) : c(std::move(c)), lastTime(std::move(lastTime))
5248
{
53-
this->c = c;
54-
this->lastTime = lastTime;
5549
}
5650
};
5751

src/libs/sea_ai/src/ai_ship_cannon_controller.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,8 @@ void AIShipCannonController::Realize(float fDeltaTime)
636636
CVECTOR vPos;
637637
uint32_t dwColor;
638638

639-
tr_vertex(CVECTOR vPos, uint32_t dwColor)
639+
tr_vertex(CVECTOR vPos, uint32_t dwColor) : vPos(std::move(vPos)), dwColor(std::move(dwColor))
640640
{
641-
this->vPos = vPos;
642-
this->dwColor = dwColor;
643641
}
644642
};
645643

0 commit comments

Comments
 (0)