Allow activation of entity groups.

This commit is contained in:
Steve 2015-11-28 14:33:58 +00:00
parent 633f6d646e
commit 1816bf406c
2 changed files with 8 additions and 2 deletions

View File

@ -25,7 +25,6 @@ static void executeNextLine(ScriptRunner *runner);
static cJSON *scriptJSON;
static ScriptRunner head;
static ScriptRunner *tail;
static char funcNameBuffer[MAX_NAME_LENGTH];
void initScript(cJSON *scriptNode)
{
@ -71,6 +70,7 @@ void runScriptFunction(const char *format, ...)
ScriptRunner *scriptRunner;
cJSON *function;
char *functionName;
char funcNameBuffer[MAX_NAME_LENGTH];
va_list args;
memset(&funcNameBuffer, '\0', sizeof(funcNameBuffer));
@ -95,7 +95,7 @@ void runScriptFunction(const char *format, ...)
tail->next = scriptRunner;
tail = scriptRunner;
printf("Running script '%s'\n", funcNameBuffer);
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Running script '%s'", funcNameBuffer);
}
function = function->next;
@ -118,6 +118,11 @@ static void executeNextLine(ScriptRunner *runner)
sscanf(line, "%*s %[^\n]", strParam[0]);
activateEntities(strParam[0]);
}
else if (strcmp(command, "ACTIVATE_ENTITY_GROUP") == 0)
{
sscanf(line, "%*s %[^\n]", strParam[0]);
activateEntityGroup(strParam[0]);
}
else if (strcmp(command, "ACTIVATE_OBJECTIVE") == 0)
{
sscanf(line, "%*s %d", &intParam[0]);

View File

@ -31,6 +31,7 @@ extern void retreatAllies(void);
extern void addHudMessage(SDL_Color c, char *format, ...);
extern void addMessageBox(int time, char *title, char *format, ...);
extern void activateEntities(char *name);
extern void activateEntityGroup(char *groupName);
extern void activateObjective(int num);
extern Battle battle;