mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/console: Add stage broadcast cmd.
This commit is contained in:
parent
cd611f4245
commit
a683c52c66
1 changed files with 34 additions and 0 deletions
|
@ -3067,6 +3067,40 @@ console_cmd__stage__send(opt &out, const string_view &line)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
console_cmd__stage__broadcast(opt &out, const string_view &line)
|
||||
{
|
||||
const params param{line, " ",
|
||||
{
|
||||
"[id]"
|
||||
}};
|
||||
|
||||
const int &id
|
||||
{
|
||||
param.at<int>(0, -1)
|
||||
};
|
||||
|
||||
const auto start
|
||||
{
|
||||
id > -1? id : 0
|
||||
};
|
||||
|
||||
const auto stop
|
||||
{
|
||||
id > -1? id + 1 : stage.size()
|
||||
};
|
||||
|
||||
for(size_t i(start); i < stop; ++i)
|
||||
{
|
||||
const m::vm::opts opts;
|
||||
const m::event event{stage.at(i)};
|
||||
m::vm::accepted a{event, &opts, &opts.report};
|
||||
m::vm::accept(a);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
console_command_numeric(opt &out, const string_view &line)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue