From 12faed0921d2309488334fb2fec3c4c6db1bc9b9 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Wed, 27 Jun 2018 19:30:18 +0200 Subject: [PATCH] timeline: add TM_Action macro for defining action callbacks --- src/timeline.c | 4 ++-- src/timeline.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/timeline.c b/src/timeline.c index dd476f9..9c9209f 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -280,7 +280,7 @@ SYMBOL_EXPORT struct TM_Action* TM_AddBackgroundAction(struct Timeline* timeline } /*! \brief Predefined action used by TM_AddQueuedBackgroundAction */ -static bool runinbackground(struct Game* game, struct TM_Action* action, enum TM_ActionState state) { +static TM_Action(RunInBackground) { int* delay = (int*)TM_GetArg(action->arguments, 1); char* name = (char*)TM_GetArg(action->arguments, 2); struct Timeline* timeline = (struct Timeline*)TM_GetArg(action->arguments, 3); @@ -305,7 +305,7 @@ SYMBOL_EXPORT struct TM_Action* TM_AddQueuedBackgroundAction(struct Timeline* ti TM_WrapArg(int, del, delay); TM_WrapArg(bool, used, false); struct TM_Arguments* arguments = TM_AddToArgs(NULL, 6, (void*)func, del, strdup(name), (void*)timeline, args, used); - return TM_AddAction(timeline, runinbackground, arguments, "TM_BackgroundAction"); + return TM_AddAction(timeline, RunInBackground, arguments, "TM_BackgroundAction"); } SYMBOL_EXPORT void TM_AddDelay(struct Timeline* timeline, int delay) { diff --git a/src/timeline.h b/src/timeline.h index 251d930..7cf0928 100644 --- a/src/timeline.h +++ b/src/timeline.h @@ -40,6 +40,7 @@ enum TM_ActionState { struct TM_Action; typedef bool TM_ActionCallback(struct Game*, struct TM_Action*, enum TM_ActionState); +#define TM_Action(x) bool x(struct Game* game, struct TM_Action* action, enum TM_ActionState state) /*! \brief Timeline structure. */ struct Timeline {