From e531685f83bb8bf711fd992cc4a84d7c29e6271e Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Sun, 15 May 2022 00:24:22 +0200 Subject: [PATCH 14/18] generate_packets.py: Add parameter to Variant.get_delta_send_body() for code to insert before a return See osdn#44602 Signed-off-by: Alina Lenk --- common/generate_packets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index c10f565892..a95bb12061 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -1269,7 +1269,7 @@ static char *stats_{self.name}_names[] = {{{names}}}; ''' delta_header2 = delta_header2 + '''#endif /* FREECIV_DELTA_PROTOCOL */ ''' - body=self.get_delta_send_body()+"\n#ifndef FREECIV_DELTA_PROTOCOL" + body = self.get_delta_send_body(pre2) + "\n#ifndef FREECIV_DELTA_PROTOCOL" else: delta_header="" body="#if 1 /* To match endif */" @@ -1317,7 +1317,7 @@ static char *stats_{self.name}_names[] = {{{names}}}; # ''' # Helper for get_send() - def get_delta_send_body(self): + def get_delta_send_body(self, before_return=""): intro=''' #ifdef FREECIV_DELTA_PROTOCOL if (NULL == *hash) { @@ -1352,9 +1352,9 @@ static char *stats_{self.name}_names[] = {{{names}}}; if self.is_info != "no": body += """ if (different == 0) {{ -{fl}{s} return 0; +{fl}{s}{before_return} return 0; }} -""".format(fl = fl, s = s) +""".format(fl = fl, s = s, before_return = before_return) body=body+''' #ifdef FREECIV_JSON_CONNECTION -- 2.17.1