cooperuser / blockade

A minimal but challenging puzzle game, inspired by the ice puzzles in The Legend of Zelda: Twilight Princess.
2 stars 0 forks source link

Blank Level in Open Menu in Level Editor #43

Closed cooperuser closed 8 years ago

cooperuser commented 8 years ago

I noticed this bug a while ago, pretty self explanatory but sometimes there is an extra first level to choose from thats name is empty

grady404 commented 8 years ago

So the levels on the first page would be [ ], [1], [2]... all the way up to [15]? As opposed to [1], [2], [3]... up to [16]

cooperuser commented 8 years ago

no, on the open screen in the editor

cooperuser commented 8 years ago

got it to happen again:

cooperuser commented 8 years ago
screen shot 2016-09-10 at 12 48 12 pm
grady404 commented 8 years ago

Huh, weird. Could it have something to do with one of the hidden files in that directory? Because hidden files always start with a . and I assume you're stripping the file from the . on. But it seems strange that it only happens occasionally.

cooperuser commented 8 years ago

of course!!!

cooperuser commented 8 years ago

the .DS_STORE on macs!

grady404 commented 8 years ago

You might at least consider checking to make sure the file name doesn't start with a . before you list it, and see if that fixes the bug.

grady404 commented 8 years ago

But isn't that file always there?

cooperuser commented 8 years ago

I can go fix it now

grady404 commented 8 years ago

Actually you should make sure that's even the problem first, just get rid of the part where it strips the file extension and see if you can trigger the glitch (then you'd see the exact name of the file)

cooperuser commented 8 years ago

confirmed:

screen shot 2016-09-10 at 1 16 36 pm
grady404 commented 8 years ago

Aha ok just check to make sure the file name doesn't begin with a . and if it does remove the dot and everything after it

cooperuser commented 8 years ago

It works now, and it also works if you start the level with a ., It just saves it like that

cooperuser commented 8 years ago

and it loads fine

grady404 commented 8 years ago

How did you achieve that? Will other hidden files show up by accident with that solution?

cooperuser commented 8 years ago

there shouldn't be any other hidden files though

cooperuser commented 8 years ago
if (files[i] != ".DS_Store") {
    levelName = files[i].split('.')
    levelName.pop();
    levelName = levelName.join('.');
    $("#selectBox").append(`<option>${levelName}</option>`)
}
grady404 commented 8 years ago

Doesn't Mac OS automatically make any files beginning with a dot hidden? In that case you shouldn't even allow players to make a level name start with a dot.

cooperuser commented 8 years ago

No, it doesn't do that? I'm pretty sure all system-created files created by the kernel starting with a . are hidden

cooperuser commented 8 years ago

wait.... your right

cooperuser commented 8 years ago

i just checked

cooperuser commented 8 years ago

wait... by using those methods we can make the default levels hidden

grady404 commented 8 years ago

Why would we do that...?

cooperuser commented 8 years ago

to stop modding?

grady404 commented 8 years ago

Uh.... why don't you just encrypt them?

Making them hidden would hardly do anything for people who know a thing or two about computers...

grady404 commented 8 years ago

And for alpha and beta, I think they should be left editable

cooperuser commented 8 years ago

Good point

grady404 commented 8 years ago

Isn't this closed?