Skip to content

Commit ee03403

Browse files
committed
shouldn't have to manually count the hints array size!
1 parent d6efdce commit ee03403

File tree

3 files changed

+619
-621
lines changed

3 files changed

+619
-621
lines changed

src/commands/event.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,6 @@
55
class EventCommand : public ICommand
66
{
77
public:
8-
std::array<const char*, 15> m_Hints = {
9-
"__showfps",
10-
"__reload_world",
11-
"ply.invulnerable",
12-
"ply.vulnerable",
13-
"ply.unlimitedammo.enable",
14-
"ply.unlimitedammo.disable",
15-
"ply.ammo.givemax",
16-
"ply.pause",
17-
"ply.unpause",
18-
"ply.vehicle.burn",
19-
"moon_gravity_on",
20-
"moon_gravity_off",
21-
"debug.vehicle.incrementtint",
22-
"vocals.rico.enable",
23-
"vocals.rico.disable",
24-
};
25-
268
virtual const char* GetCommand() override
279
{
2810
return "event";
@@ -40,8 +22,26 @@ class EventCommand : public ICommand
4022

4123
virtual std::vector<std::string> GetHints(const std::string& arguments) override
4224
{
25+
static std::array hints{
26+
"__showfps",
27+
"__reload_world",
28+
"ply.invulnerable",
29+
"ply.vulnerable",
30+
"ply.unlimitedammo.enable",
31+
"ply.unlimitedammo.disable",
32+
"ply.ammo.givemax",
33+
"ply.pause",
34+
"ply.unpause",
35+
"ply.vehicle.burn",
36+
"moon_gravity_on",
37+
"moon_gravity_off",
38+
"debug.vehicle.incrementtint",
39+
"vocals.rico.enable",
40+
"vocals.rico.disable",
41+
};
42+
4343
std::vector<std::string> result;
44-
std::copy_if(m_Hints.begin(), m_Hints.end(), std::back_inserter(result),
44+
std::copy_if(hints.begin(), hints.end(), std::back_inserter(result),
4545
[&](const std::string& item) { return item.find(arguments) != std::string::npos; });
4646

4747
return result;

0 commit comments

Comments
 (0)