From 9dab0ccf708a0621dc47a7c87cb6c335f617c4e7 Mon Sep 17 00:00:00 2001 From: oxmox Date: Sat, 18 Feb 2023 23:04:34 +0100 Subject: [PATCH] rename QuitDoom -> Endoom :) --- src/doompanning.cc | 2 +- src/doomsim.cc | 15 +++++---------- src/dp_common.c | 2 +- src/dp_common.h | 4 ++-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/doompanning.cc b/src/doompanning.cc index d5679c7..8cc4210 100644 --- a/src/doompanning.cc +++ b/src/doompanning.cc @@ -81,7 +81,7 @@ void end_all_dooms(ControllerContext &ctx) auto dpmsg = DP_NNG_BODY_AS(msg, MsgMcstCommand); dpmsg->head.msgType = DP_MT_McstCommand; - dpmsg->cmd = DP_DC_QuitDoom; + dpmsg->cmd = DP_DC_Endoom; if ((res = nng_sendmsg(ctx.pub, msg, 0))) dp_nng_fatal("ctrl/sendmsg", res); diff --git a/src/doomsim.cc b/src/doomsim.cc index b2e927d..384a6a6 100644 --- a/src/doomsim.cc +++ b/src/doomsim.cc @@ -54,11 +54,6 @@ DEF_DOOM_STATE_FUNC(do_doom_ready) if ((res = publish_state(ctx))) 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; 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))) 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))) dp_nng_fatal("doom/publish_sate", res); @@ -152,9 +147,9 @@ DEF_DOOM_STATE_FUNC(do_doom_running) 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))) dp_nng_fatal("doom/publish_sate", res); @@ -171,7 +166,7 @@ int doom_loop(DoomContext *ctx) int res = 0; - while (ctx->state != DP_DS_Quitting && res == 0) + while (ctx->state != DP_DS_Endoom && res == 0) { DP_DoomState prevState = ctx->state; res = ctx->f(ctx); diff --git a/src/dp_common.c b/src/dp_common.c index 6f17d3a..c193ce9 100644 --- a/src/dp_common.c +++ b/src/dp_common.c @@ -102,7 +102,7 @@ const char *const DP_DoomState_Strings[] = "DoomState_Unknown", "DoomState_Ready", "DoomState_Running", - "DoomState_Quit", + "DoomState_Endoom", }; _Static_assert(sizeof(DP_DoomState_Strings) / sizeof(DP_DoomState_Strings[0]) == DP_DS_COUNT, diff --git a/src/dp_common.h b/src/dp_common.h index 7b20b93..1a078bd 100644 --- a/src/dp_common.h +++ b/src/dp_common.h @@ -32,7 +32,7 @@ typedef enum DP_DoomState DP_DS_Unknown, DP_DS_Ready, DP_DS_Running, - DP_DS_Quitting, + DP_DS_Endoom, DP_DS_COUNT, } DP_DoomState; @@ -40,7 +40,7 @@ typedef enum DP_DoomCommand { DP_DC_Noop, DP_DC_RunDoom, - DP_DC_QuitDoom, + DP_DC_Endoom, DP_DC_COUNT, } DP_DoomCommand;