aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Stevens <nilix@nilfm.cc>2019-03-05 18:01:45 -0800
committerDerek Stevens <nilix@nilfm.cc>2019-03-05 18:01:45 -0800
commita99cabc018383476143cea2952c9d58b2ef83c95 (patch)
tree9f12103078971e72386353a21cb8ead88adfc2ed
parentffde2dc83218de93e569444699ee633dbe242a73 (diff)
more construct(char* args) for kaos constructors
-rw-r--r--Kaos.c13
-rw-r--r--Kaos.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/Kaos.c b/Kaos.c
index ee970e6..82ed6f5 100644
--- a/Kaos.c
+++ b/Kaos.c
@@ -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);
diff --git a/Kaos.h b/Kaos.h
index 5d5eddf..0be4ca8 100644
--- a/Kaos.h
+++ b/Kaos.h
@@ -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);