From e6012dd5421097ac573caed332d0703078ad6edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 25 May 2023 20:35:22 +0800 Subject: Add mv_item_option --- ord.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ord.c b/ord.c index c1f79cc..76c54ce 100644 --- a/ord.c +++ b/ord.c @@ -25,7 +25,7 @@ void interchange_ord_order(const char *sku, const char *item, } for (size_t i = 0; i < nopts; i++) --options; - size_t total_nopts = 4 + (nopts ? 1 : 0) + nopts; + size_t total_nopts = 4 + (nopts ? 1 : 0) + nopts * 2; const char *order[total_nopts + 1][2]; order[0][0] = "mv_action"; order[0][1] = "refresh"; @@ -42,10 +42,14 @@ void interchange_ord_order(const char *sku, const char *item, } for (size_t i = 0; i < nopts; i++) { const char **pair = options[i]; - order[5 + i][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1); - sprintf((char *)order[5 + i][0], "%s%s", prefix, pair[0]); - order[5 + i][1] = malloc(strlen(pair[1]) + 1); - strcpy((char *)order[5 + i][1], pair[1]); + size_t j = i * 2; + order[5 + j][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1); + sprintf((char *)order[5 + j][0], "%s%s", prefix, pair[0]); + order[5 + j][1] = malloc(strlen(pair[1]) + 1); + strcpy((char *)order[5 + j][1], pair[1]); + order[6 + j][0] = "mv_item_option"; + order[6 + j][1] = malloc(strlen(pair[0]) + 1); + strcpy((char *)order[6 + j][1], pair[0]); } order[total_nopts][0] = NULL; request(parser, NULL, order, "%s", "ord/basket"); -- cgit v1.2.3