Alphabetical order for workers

I had missed this completely. Workers are listed in alphabetical order in English. Now they are ordered in other languages too.

Alphabetical order for outfit
This commit is contained in:
Andrea Rendine
2015-05-18 19:39:12 +02:00
committed by Blake Grotewold
parent 7babe5d102
commit c4535c029a
2 changed files with 13 additions and 17 deletions
+7 -10
View File
@@ -242,6 +242,7 @@ var Outside = {
var gatherer = $('div#workers_row_gatherer', workers); var gatherer = $('div#workers_row_gatherer', workers);
for(var k in $SM.get('game.workers')) { for(var k in $SM.get('game.workers')) {
var lk = _(k);
var workerCount = $SM.get('game.workers["'+k+'"]'); var workerCount = $SM.get('game.workers["'+k+'"]');
var row = $('div#workers_row_' + k.replace(' ', '-'), workers); var row = $('div#workers_row_' + k.replace(' ', '-'), workers);
if(row.length === 0) { if(row.length === 0) {
@@ -250,23 +251,19 @@ var Outside = {
var curPrev = null; var curPrev = null;
workers.children().each(function(i) { workers.children().each(function(i) {
var child = $(this); var child = $(this);
var cName = child.attr('id').substring(12).replace('-', ' '); var cName = child.children('.row_key').text();
if(cName != 'gatherer') { if(cName != 'gatherer') {
if(cName < k && (curPrev == null || cName > curPrev)) { if(cName < lk) {
curPrev = cName; curPrev = child.attr('id');
} }
} }
}); });
if(curPrev == null && gatherer.length === 0) { if(curPrev == null && gatherer.length === 0) {
row.prependTo(workers); row.prependTo(workers);
} } else if(curPrev == null) {
else if(curPrev == null)
{
row.insertAfter(gatherer); row.insertAfter(gatherer);
} } else {
else row.insertAfter(workers.find('#'+ curPrev));
{
row.insertAfter(workers.find('#workers_row_' + curPrev.replace(' ', '-')));
} }
} else { } else {
+6 -7
View File
@@ -174,6 +174,7 @@ var Path = {
}, Room.Craftables); }, Room.Craftables);
for(var k in carryable) { for(var k in carryable) {
var lk = _(k);
var store = carryable[k]; var store = carryable[k];
var have = $SM.get('stores["'+k+'"]'); var have = $SM.get('stores["'+k+'"]');
var num = Path.outfit[k]; var num = Path.outfit[k];
@@ -190,18 +191,16 @@ var Path = {
outfit.children().each(function(i) { outfit.children().each(function(i) {
var child = $(this); var child = $(this);
if(child.attr('id').indexOf('outfit_row_') === 0) { if(child.attr('id').indexOf('outfit_row_') === 0) {
var cName = child.attr('id').substring(11).replace('-', ' '); var cName = child.children('.row_key').text();
if(cName < k && (curPrev == null || cName > curPrev)) { if(cName < lk) {
curPrev = cName; curPrev = child.attr('id');
} }
} }
}); });
if(curPrev == null) { if(curPrev == null) {
row.insertAfter(wRow); row.insertAfter(wRow);
} } else {
else row.insertAfter(outfit.find('#' + curPrev));
{
row.insertAfter(outfit.find('#outfit_row_' + curPrev.replace(' ', '-')));
} }
} else { } else {
$('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num); $('div#' + row.attr('id') + ' > div.row_val > span', outfit).text(num);