mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 07:51:17 +01:00
more meaningful variable names
which and whichhash were quite confusing
This commit is contained in:
parent
1c2c7f0956
commit
b2f4ca74b9
@ -95,15 +95,15 @@ function store_cape(uuid, profile, details, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// downloads the images for +uuid+ while checking the cache
|
// downloads the images for +uuid+ while checking the cache
|
||||||
// status based on +details+. +whichhash+ specifies which
|
// status based on +details+. +type+ specifies which
|
||||||
// image is more important, and should be called back on
|
// image type should be called back on
|
||||||
// +callback+ contains the error buffer and image hash
|
// +callback+ contains the error buffer and image hash
|
||||||
var currently_running = [];
|
var currently_running = [];
|
||||||
function callback_for(uuid, which, err, cape_hash, skin_hash) {
|
function callback_for(uuid, type, err, cape_hash, skin_hash) {
|
||||||
for (var i = 0; i < currently_running.length; i++) {
|
for (var i = 0; i < currently_running.length; i++) {
|
||||||
if (currently_running[i] && currently_running[i].uuid === uuid && (currently_running[i].which === which || which === null)) {
|
if (currently_running[i] && currently_running[i].uuid === uuid && (currently_running[i].type === type || type === null)) {
|
||||||
var will_call = currently_running[i];
|
var will_call = currently_running[i];
|
||||||
will_call.callback(err, will_call.which === 'skin' ? skin_hash : cape_hash);
|
will_call.callback(err, will_call.type === 'skin' ? skin_hash : cape_hash);
|
||||||
currently_running.splice(i, 1); // remove from array
|
currently_running.splice(i, 1); // remove from array
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -119,9 +119,9 @@ function array_has_hash(arr, property, value) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function store_images(uuid, details, whichhash, callback) {
|
function store_images(uuid, details, type, callback) {
|
||||||
var isUUID = uuid.length > 16;
|
var isUUID = uuid.length > 16;
|
||||||
var new_hash = { 'uuid': uuid, 'which': whichhash, 'callback': callback };
|
var new_hash = { 'uuid': uuid, 'type': type, 'callback': callback };
|
||||||
if (!array_has_hash(currently_running, 'uuid', uuid)) {
|
if (!array_has_hash(currently_running, 'uuid', uuid)) {
|
||||||
currently_running.push(new_hash);
|
currently_running.push(new_hash);
|
||||||
networking.get_profile((isUUID ? uuid : null), function(err, profile) {
|
networking.get_profile((isUUID ? uuid : null), function(err, profile) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user