diff options
author | Derek Stevens <nilix@nilfm.cc> | 2019-03-05 18:01:45 -0800 |
---|---|---|
committer | Derek Stevens <nilix@nilfm.cc> | 2019-03-05 18:01:45 -0800 |
commit | a99cabc018383476143cea2952c9d58b2ef83c95 (patch) | |
tree | 9f12103078971e72386353a21cb8ead88adfc2ed | |
parent | ffde2dc83218de93e569444699ee633dbe242a73 (diff) |
more construct(char* args) for kaos constructors
-rw-r--r-- | Kaos.c | 13 | ||||
-rw-r--r-- | Kaos.h | 2 |
2 files changed, 13 insertions, 2 deletions
@@ -60,11 +60,22 @@ void deleteConversation(Kaos* target) free(target); } -Kaos* newChoice(char* q, char* a1, char* a2, HyperKaos* p1, HyperKaos* p2) +Kaos* newChoice(char* args) { + char q[32], a1[32], a2[32]; + int p1, p2; Kaos* core = rawKaos(); Choice* self = malloc(sizeof(Choice)); + if (sscanf(args, "q %[^,], a1 %[^,], a2 %[^,], p1 %d, p2 %d", q, a1, a2, &p1, &p2) != 5) + { + free(core); + free(self); + self = NULL; + core = NULL; + return core; + } + self->question = TTF_RenderText_Solid(font, q, textColor); self->answ1 = TTF_RenderText_Solid(font, a1, textColor); self->answ2 = TTF_RenderText_Solid(font, a2, textColor); @@ -95,7 +95,7 @@ Kaos* newConversation(char* args); void runConversation(Kaos* self); void deleteConversation(Kaos* target); -Kaos* newChoice(char* q, char* a1, char* a2, HyperKaos* p1, HyperKaos* p2); +Kaos* newChoice(char* args); void runChoice(Kaos* self); void deleteChoice(Kaos* target); |