Success. Switch Tile Client Editor is working and seemingly has no issues. The two bugs were both fixed by changing just one line of code each.
The first bug occurred in the sub menu with a client group selected. When clicking on a tile type button in the 'Choose the inactive tile type' panel, only one client was being changed.
The problem was in a for loop iterating through the array of the clients being modified. I was using the wrong iterator variable to choose the index of the array. I believe copy pasta is to blame here.
this line:
sc = clients[j];
should've been:
sc = clients[m];
The second bug occurred when there were multiple client groups. Trying to select a client group would either highlight only one client or highlight the whole group plus others that did not belong in the group. Then after clicking to selected a client group, none were shown selected in the sub menu.
The problem was a line of code in the function that builds the group array. When a new group is started, the function first looks for new "control client" to compare with others. Before looking for one, a fresh array called 'assigned' is created and every client that has already been assigned to a group is pushed into it. Since the group array is multidimensional and I don't want 'assigned' to be multidimensional, I use the concat() Array function to populate 'assigned'.
this line:
for each (var group:Array in clientGroups) assigned.concat(group);
should've been:
for each (var group:Array in clientGroups) assigned = assigned.concat(group);
No comments:
Post a Comment