Skip to content

Commit

Permalink
generate_packets.py: Add parameter to Variant.get_delta_send_body() f…
Browse files Browse the repository at this point in the history
…or code to insert before a return

See osdn#44602

Signed-off-by: Alina Lenk <alina.v.lenk@gmail.com>
  • Loading branch information
alien-valkyrie committed May 16, 2022
1 parent 8d5b512 commit 30a8d33
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/generate_packets.py
Expand Up @@ -1283,7 +1283,7 @@ def get_send(self):
'''
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 */"
Expand Down Expand Up @@ -1331,7 +1331,7 @@ def get_send(self):
# '''

# 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) {
Expand Down Expand Up @@ -1366,9 +1366,9 @@ def get_delta_send_body(self):
if self.is_info != "no":
body += """
if (different == 0) {{
{fl}{s}<pre2> 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
Expand Down

0 comments on commit 30a8d33

Please sign in to comment.