View Single Post
Old 01-28-06, 06:55 AM   #78
JScones
Navy Seal
 
Join Date: Apr 2005
Posts: 5,501
Downloads: 19
Uploads: 0
Default

Quote:
Originally Posted by GlobalExplorer
This won't do, as Sh3 will not display entries with Type <> 0
How inconsiderate of it. Curiously, where *does* the text added by SH3Gen display within SH3?

Quote:
Originally Posted by GlobalExplorer
As far as Cmdr is concerned, I think the check for entries without EntryTitle might be better.

Something like:

try
{
EntryTitle = ClgFile.Read("Log entry " + index, "EntryTitle");
//proceed with reading the entry
//...
}
catch
{
//EntryTitle doesn't exist, so entry will be skipped
}
Peh. Just gotta add if (not iIdx in [0,slEntries.Count - 1]) and (Length(iniFile.ReadString(slEntries[iIdx], 'EntryTitle', '')) = 0) then continue; as the first line in the loop.

I still need to ensure that the first and last entries are included even though they have no EntryTitle, hence the first test. The second test explicitly looks for an EntryTitle value, as this is more robust than just checking for the existance of the key.

I must admit that I'm not a big fan of this solution as it means that no user added entry can utilise the "EntryTitle" key (plus I suspect that this design decision will come back and haunt me when I get into the expanded patrol log feature) - I'd almost suggest that a new key should be written when manually adding entries which SH3Cmdr can check for and exclude. Something such as "NonSH3Entry=1" or whatever. Either way, though, it's only one extra line of code.

EDIT...Reflectively thinking...Perhaps by writing a unique key you can save yourself some hassle when removing your changes from the Log files? For instance, SH3Cmdr won't care whether the "NonSH3Entry" value is 0, 9, 99, 354.66 or PurpleMonkeyDishwater, so you could specifically write "NonSH3Entry=SH3Gen" and then check for the presence of this value when removing your entries.
JScones is offline   Reply With Quote