Can't change cells

Support for running, installing or compiling OpenMW
User avatar
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland

Can't change cells

Post by lgromanowski » 15 Aug 2011, 12:51

Greendogo wrote: Hey, I have another one. I don't remember how I did it in older builds, but I was messing around with the console (F1) and I tried COCing to toddtest, no luck. I also tried to open the door at the top of the cavern, also, no luck AND CTD. Any ideas?
Greendogo wrote: I got it! The destination is case sensitive.
Greendogo wrote: New problems.
Can't get to "mark's vampire test cell"
I would like to also suggest that you make coc's not case sensitive, I don't think there is an instance of using the same cell name twice with different cases.

Edit: Solved - This also was a problem with the case sensitive COC function.
EmbraceUnity wrote: Linux is case sensitive by default, so for cross-platform reasons, I argue that case sensitivity should stay.
Greendogo wrote: I understand the reasons that it is this way, but it is annoying. There's a way to fix this. Converting the list of cells to all lowercase and converting anything typed in a coc command to lowercase would solve the problem pretty easily. All cells would be lowercase, so no exception would be thrown for typing coc toddtest instead of coc ToddTest because the program would see it as the same thing. Even coc ToDdTeSt would work.
Zini wrote: I agree, that the case sensitivity has to go. I have taken care of this problem for pretty much everything but the cell names. Here the situation is a bit more complex, because the internal name is the same name as displayed to the user, so we can't simply smash case. We need a special case implementation. Not very hard, but I just did not get around to it yet.
nicolay wrote: The linux file system is case sensitive, true, but this has nothing to do with files. Making internal lookups (not just for cells, but all references) case insensitive is just a matter of how we are order our data structure.

In fact it would be a good idea to get this handled sooner rather than later, and it's not all that hard to do. I've added it to the roadmap for 0.09.

EDIT: didn't see your post Zini. In fact smashing case isn't always the best solution anyhow IMHO. Using a custom compare function for map<> that ignores case (I did this for the file finder) both solves the problem avoids lots of extra temporary allocations.
Zini wrote: I adjusted the roadmap entry accordingly, because all names but cell names were case insensitive for ages.
Zini wrote: Didn't see your edit either ;)

A custom compare function might work as a general solution (and it is surely the right thing for the cell names). On the other hand it makes name-lookup a bit slower.
But that is premature optimisation. I only used the smash case implementation because I had to get the problem out of the way quickly for something else I was working on. I don't object to replacing my implementation with a general case-insensitive compare function. If later the profiling shows that it causes performance problems, we can still change it back for everything but cell names.
nicolay wrote: I say if it ain't broke don't fix it ;) Let's do a custom compare on cell names but keep the case smashing on the other lookups as it is, there doesn't seem to be any problems with it.
best regards,