Empty book's title and author is 0

Made a small change or new addition to the Distro that makes a difference? You can post the changes here in .patch or .diff file format, for others to use or even added to the official Distro SVN!

Moderators: POL Developer, Distro Developer

Locked
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Empty book's title and author is 0

Post by ncrsn »

Very minor stuff, just accidentally ran across: empty book's title and author is "0" instead of being empty.

Codewise it is be caused by book methodscript's function GetInfo (or better, the usage of it), in where various book related info is searched from datafiles, cprops and itemdesc.cfg, and if not found in any of them, value 0 is returned, causing it to appear as title and author.

This patch will add few if-blocks to convert zero with emptiness.
Attachments
empty book's title and author is 0 fix.patch
Patch to make empty book look like it's empty
(984 Bytes) Downloaded 347 times
Madman
POL Developer
Posts: 62
Joined: Sun Feb 05, 2006 7:20 pm

Post by Madman »

Not sure if anyone's applied this yet, but if not I'll do it tonight if I can get my SVN of the distro to work. Grr.
Madman
POL Developer
Posts: 62
Joined: Sun Feb 05, 2006 7:20 pm

Post by Madman »

Actually, applied it with one minor change- the original code had a CStr which yours eliminated. I don't know for certain whether your removal was deliberate, so I modified the return statements to be

return CStr(author);

etc. I figure it can't hurt.
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn »

You did the right thing, now that I think about it. Never knows what type of data is saved.

Thanks for acting fast.
Locked