Performance increase for `refresh_story` on large stories

This commit is contained in:
Yves Dubois 2021-05-29 21:36:24 -04:00
parent 65ad0e01e3
commit 4cb3df5e7e
1 changed files with 4 additions and 6 deletions

View File

@ -1090,12 +1090,10 @@ def applyoutputformatting(txt):
# Sends the current story content to the Game Screen # Sends the current story content to the Game Screen
#==================================================================# #==================================================================#
def refresh_story(): def refresh_story():
txt = '<chunk n="0" id="n0">'+vars.prompt+'</chunk>' text_parts = ['<chunk n="0" id="n0">', vars.prompt, '</chunk>']
i = 1 for idx, item in enumerate(vars.actions, start=1):
for item in vars.actions: text_parts.extend(('<chunk n="', str(idx), '" id="n', str(idx), '">', item, '</chunk>'))
txt = txt + '<chunk n="'+str(i)+'" id="n'+str(i)+'">'+item+'</chunk>' emit('from_server', {'cmd': 'updatescreen', 'data': formatforhtml(''.join(text_parts))})
i += 1
emit('from_server', {'cmd': 'updatescreen', 'data': formatforhtml(txt)})
#==================================================================# #==================================================================#
# Sends the current generator settings to the Game Menu # Sends the current generator settings to the Game Menu