open.mp
open.mp copied to clipboard
A more improved check for the selected item in the "list" type dialog
trafficstars
The existing definition of the number of lines does not work well with repeated '\n', at the beginning of the line, at the end. A more improved version of determining the number of items in the dialog, eliminating all kinds of programmer errors.
For example, when passing the string "\n1\n2\n3\n", your algorithm will give the result 3, instead of the valid 2 (0, 1, 2). Thus, the cheater can send 3 in response, even though it is not in the dialog list.