Closed KroArtem closed 8 years ago
I'm rephrasing this ticket as there could be some problems when creating non-standard heroes. Let's say I want to create a hero with name ../Modsognir, it will rewrite an existing Modsognir hero.
Luckily it's not possible to rewrite savegames as delimiters like \n doesn't seem to work in user input.
Another thing is that when you create an inappropriate hero with name e.g. /\/\yCoolHero, its' profile won't be created and it will be accessible only during this launch.
You are right, those are serious concerns. Thanks for bringing this up!
I've fixed the issue now, and also made the check which sees whether another hero of the same name exists case-insensitive (since Windows cannot have two files with the same name even if they are written with letters in different cases).
I've also added a check to see if the name has only spaces in it.
https://github.com/Andrettin/Wyrmsun/commit/7e7a5158ca43e127f412e9d3841d510266f0c48c https://github.com/Andrettin/Wyrmsun/commit/0cdabf54fb7f5c0a8f6432b8f3e58dd0b21a1672 https://github.com/Andrettin/Wyrmgus/commit/b3403364157da94e1722dd35b3a5de483e87abc8
Is it ok that hero can have empty name with space in it and valid surname? Usually name is required, surname is optional. Other cases seem to be covered now.
Now that you mention it, that shouldn't be possible, thanks for letting me know. I've fixed it now: https://github.com/Andrettin/Wyrmgus/commit/7b2d306079204bc01e4a0966f437ed0101bca2f1
Well, I'm still not satisfied. ;) If I try to create any hero I don't get anything except "error in error handling" in terminal.
Ops, I forgot to upload the corresponding Wyrmsun repository commit: https://github.com/Andrettin/Wyrmsun/commit/65aa3d35632f8feda3600f2620a0f399ef000d38
It's possible to create custom hero with just spaces, so it looks odd with no name and surname. I suggest trimming spaces or doing a simple check.