Skip to content

[Commands] Add #zonevariable Command#4882

Merged
Akkadius merged 3 commits intomasterfrom
commands/add_zonevariable
May 15, 2025
Merged

[Commands] Add #zonevariable Command#4882
Akkadius merged 3 commits intomasterfrom
commands/add_zonevariable

Conversation

@Kinglykrab
Copy link
Copy Markdown
Contributor

Description

  • Adds #zonevariable command that allows manipulation of zone variables.

Type of change

  • New feature

Testing

image

Checklist

  • I have tested my changes
  • I have performed a self-review of my code. Ensuring variables, functions and methods are named in a human-readable way, comments are added only where naming of variables, functions and methods can't give enough context.
  • I own the changes of my code and take responsibility for the potential issues that occur


c->Message(Chat::White, "Cleared all zone variables.");
} else if (is_delete) {
const std::string variable_name = sep->argplus[2];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could crash if input is bad

const std::string variable_name = (sep->argplus.size() > 2) ? sep->argplus[2] : "";


return;
} else if (is_set) {
const std::string variable_name = sep->arg[2];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need input validation here as well

uint32 variable_count = 0;
uint32 variable_number = 1;

const std::string search_criteria = arguments >= 2 ? sep->argplus[2] : "";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You checked for inputs here so we're good

Copy link
Copy Markdown
Contributor

@Akkadius Akkadius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, few comments though that could crash

@Akkadius
Copy link
Copy Markdown
Contributor

Added argument safety for you

@Akkadius Akkadius enabled auto-merge (squash) May 15, 2025 01:45
@Akkadius Akkadius merged commit f29478c into master May 15, 2025
2 checks passed
@Akkadius Akkadius deleted the commands/add_zonevariable branch May 15, 2025 01:53
@Akkadius Akkadius mentioned this pull request May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants