rename QuitDoom -> Endoom :)

This commit is contained in:
oxmox 2023-02-18 23:04:34 +01:00
parent e590bed17a
commit 9dab0ccf70
4 changed files with 9 additions and 14 deletions

View file

@ -81,7 +81,7 @@ void end_all_dooms(ControllerContext &ctx)
auto dpmsg = DP_NNG_BODY_AS(msg, MsgMcstCommand); auto dpmsg = DP_NNG_BODY_AS(msg, MsgMcstCommand);
dpmsg->head.msgType = DP_MT_McstCommand; dpmsg->head.msgType = DP_MT_McstCommand;
dpmsg->cmd = DP_DC_QuitDoom; dpmsg->cmd = DP_DC_Endoom;
if ((res = nng_sendmsg(ctx.pub, msg, 0))) if ((res = nng_sendmsg(ctx.pub, msg, 0)))
dp_nng_fatal("ctrl/sendmsg", res); dp_nng_fatal("ctrl/sendmsg", res);

View file

@ -54,11 +54,6 @@ DEF_DOOM_STATE_FUNC(do_doom_ready)
if ((res = publish_state(ctx))) if ((res = publish_state(ctx)))
dp_nng_fatal("doom/publish_sate", res); dp_nng_fatal("doom/publish_sate", res);
// Incoming Message | Next State
// -------------------------------
// DP_MT_RunDoom -> DP_DS_Running
// DP_MT_QuitDoom -> DP_DS_Quitting
// */none -> DP_DS_Ready
nng_msg *msg = NULL; nng_msg *msg = NULL;
if ((res = dp_recv_new_msg_nonblock(ctx->sub, &msg))) if ((res = dp_recv_new_msg_nonblock(ctx->sub, &msg)))
@ -97,9 +92,9 @@ DEF_DOOM_STATE_FUNC(do_doom_ready)
if ((res = publish_state(ctx))) if ((res = publish_state(ctx)))
dp_nng_fatal("doom/publish_sate", res); dp_nng_fatal("doom/publish_sate", res);
} }
else if (cmd == DP_DC_QuitDoom) else if (cmd == DP_DC_Endoom)
{ {
ctx->state = DP_DS_Quitting; ctx->state = DP_DS_Endoom;
if ((res = publish_state(ctx))) if ((res = publish_state(ctx)))
dp_nng_fatal("doom/publish_sate", res); dp_nng_fatal("doom/publish_sate", res);
@ -152,9 +147,9 @@ DEF_DOOM_STATE_FUNC(do_doom_running)
cmd = msgCmd->cmd; cmd = msgCmd->cmd;
} }
if (cmd == DP_DC_QuitDoom) if (cmd == DP_DC_Endoom)
{ {
ctx->state = DP_DS_Quitting; ctx->state = DP_DS_Endoom;
if ((res = publish_state(ctx))) if ((res = publish_state(ctx)))
dp_nng_fatal("doom/publish_sate", res); dp_nng_fatal("doom/publish_sate", res);
@ -171,7 +166,7 @@ int doom_loop(DoomContext *ctx)
int res = 0; int res = 0;
while (ctx->state != DP_DS_Quitting && res == 0) while (ctx->state != DP_DS_Endoom && res == 0)
{ {
DP_DoomState prevState = ctx->state; DP_DoomState prevState = ctx->state;
res = ctx->f(ctx); res = ctx->f(ctx);

View file

@ -102,7 +102,7 @@ const char *const DP_DoomState_Strings[] =
"DoomState_Unknown", "DoomState_Unknown",
"DoomState_Ready", "DoomState_Ready",
"DoomState_Running", "DoomState_Running",
"DoomState_Quit", "DoomState_Endoom",
}; };
_Static_assert(sizeof(DP_DoomState_Strings) / sizeof(DP_DoomState_Strings[0]) == DP_DS_COUNT, _Static_assert(sizeof(DP_DoomState_Strings) / sizeof(DP_DoomState_Strings[0]) == DP_DS_COUNT,

View file

@ -32,7 +32,7 @@ typedef enum DP_DoomState
DP_DS_Unknown, DP_DS_Unknown,
DP_DS_Ready, DP_DS_Ready,
DP_DS_Running, DP_DS_Running,
DP_DS_Quitting, DP_DS_Endoom,
DP_DS_COUNT, DP_DS_COUNT,
} DP_DoomState; } DP_DoomState;
@ -40,7 +40,7 @@ typedef enum DP_DoomCommand
{ {
DP_DC_Noop, DP_DC_Noop,
DP_DC_RunDoom, DP_DC_RunDoom,
DP_DC_QuitDoom, DP_DC_Endoom,
DP_DC_COUNT, DP_DC_COUNT,
} DP_DoomCommand; } DP_DoomCommand;