Mercurial > hg > forks > multipaint-js
changeset 177:5e9ebac7e8e7
Cleanup and add a comment about sanity of one if() check.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Aug 2018 13:02:14 +0300 |
parents | 0940d991d3b0 |
children | 66c1d15e335a |
files | events.pde |
diffstat | 1 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/events.pde Thu Aug 23 12:47:11 2018 +0300 +++ b/events.pde Thu Aug 23 13:02:14 2018 +0300 @@ -697,19 +697,21 @@ if (g_data['t'] == 1 && ckey == 't') message("Tile mode"); - if (ckey == 'n') { - if (g_data[int('n')] == 1) { - switcher(2); - infersize(); - if (g_data[int('n')] == 1) { - command(int('1')); - command(int('9')); - g_data[int('p')] = 0; - g_data[int('x')] = 0; - g_data[int('y')] = 0; - g_data[int('q')] = 0; - g_data[int('t')] = 0; - } + if (ckey == 'n' && g_data[int('n')] == 1) + { + switcher(2); + infersize(); + + // infersize() may modify this, so check makes sense + if (g_data[int('n')] == 1) + { + command(int('1')); + command(int('9')); + g_data[int('p')] = 0; + g_data[int('x')] = 0; + g_data[int('y')] = 0; + g_data[int('q')] = 0; + g_data[int('t')] = 0; } }