From 3b7d8ff94040cf10aed5537b944b6349aa2bebb1 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 22 Nov 2015 11:41:28 +0000 Subject: [PATCH] Allow player start position to be set. --- src/galaxy/mission.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index a781007..c9354ea 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -215,6 +215,12 @@ static void loadPlayer(cJSON *node) player->x = (GRID_SIZE * GRID_CELL_WIDTH) / 2; player->y = (GRID_SIZE * GRID_CELL_HEIGHT) / 2; + if (cJSON_GetObjectItem(node, "x")) + { + player->x = (cJSON_GetObjectItem(node, "x")->valueint * GRID_CELL_WIDTH); + player->y = (cJSON_GetObjectItem(node, "y")->valueint * GRID_CELL_HEIGHT); + } + if (strcmp(type, "Tug") == 0) { battle.stats[STAT_TUG]++;