PDA

View Full Version : Quest version and required version



DarkDragon
03-12-2017, 12:13 AM
War Lord asked me to look into a quest that was causing a mysterious error to appear whenever anybody tried to play it. Turns out the author had set the required quest version number higher than the quest version itself. Oops.

I've added code to ZQ that will stop you from setting a required version greater than the current quest version. I think this is safe? (Usually when you set a different version and required version, it would be because you are releasing some bugfixes to your quest and want to allow old savegames to still work, in which case you would be setting the required version *lower* than the current version).

There is a second problem with the way version/required version is currently handled: they are compared using strcmp(), so that, for example, if you set the quest version to 10 and the required version to 2, you will get a strange error about the version being too old. I didn't change this since (1) it's not clear what the right behavior should be (is 1.1 the same version, or older, than 1.10?) and (2) changes might break old quests.

ZoriaRPG
03-12-2017, 07:54 AM
This is reasonable, and logical. I would change the string 'Required Version' to 'Minimum Quest Version', as the common issue is when a user sets the 'required version' to the ZC version, rather than the quest version number; and I have seen this many times.

Why is strcmp() ignoring the decimal place when comparing 10 to 2? I'll need to look at that code, but clearly ignoring the place is a bad idea. 1.0.1 versus 1.01 versus 1.10.1 and similar .... ugh. It's very much decided by the personality of the person in charge f versioning.

I dislike using a single dot for sub-subversioning. e.g., I prefer 1.1.2 to 1.12, as the latter to me suggests twelve subversions. Does the editor even permit a second dot? I seem to recall that breaking.

In my experience, questmakers use quest versioning poorly, if at all. A rare few use it properly.

DarkDragon
03-12-2017, 03:59 PM
Does the editor even permit a second dot?
It permits anything, including quest versions like "foxtrot".


Why is strcmp() ignoring the decimal place when comparing 10 to 2?
strcmp() does a lexicographic comparison, rather than trying to parse the meaning of the strings. So it checks the first character first, and since '1' < '2', it returns that the first string is less than the second. So you have
"02" < "10" < "2".

Tamamo
03-13-2017, 11:36 AM
why not use both,
that's what we've done before.
There's no reason to make it work the way it should and check zquest version.
Several things do that already because of backwards compatibiliy.

DarkDragon
03-13-2017, 02:48 PM
why not use both,
that's what we've done before.
There's no reason to make it work the way it should and check zquest version.
Several things do that already because of backwards compatibiliy.

Right, it's just a question of whether it's something worth the effort of fixing (vs leaving the check as-is).

Gleeok
03-15-2017, 02:35 AM
No idea--doesn't seem to have a good solution. Maybe just a hack-y sanity check when users are editing the version?



if req_ver > ver //read as: 1.2.0 > 1.10.0
MessageBox("error setting version");

Tamamo
03-15-2017, 09:34 AM
DarkDragon
please tell me your joking

DarkDragon
03-15-2017, 05:46 PM
No idea--doesn't seem to have a good solution. Maybe just a hack-y sanity check when users are editing the version?



if req_ver > ver //read as: 1.2.0 > 1.10.0
MessageBox("error setting version");


Agreed, this is what I've put into the code.

DarkDragon
03-15-2017, 05:57 PM
@DarkDragon (http://www.armageddongames.net/member.php?u=1)
please tell me your joking

No, why? Do you feel that intelligent parsing of the quest version is an important enhancement (relative to other open features and issues)?

ZoriaRPG
03-16-2017, 06:15 AM
Probably not worth fixing at this time, other than preventing the user from setting a version string that is lower than ''min version'. I could come up with a routine to check for decimals and do an integer compare in stages, but it would be horrific overkill for a feature that is poorly used by the userbase, and oft ignored.

Tamamo
03-18-2017, 01:37 AM
if it's broken it needs fixing, thats always been the bottom line.