View Single Post
  #2  
Old 01-27-2008, 09:43 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default

Funnily enough, I didn't even realize that success was a problem as well until you said it and I looked at the code.

I started off writing the backwards compatibility, but it turns out it's actually easier for me to update the database than it is to write the backwards compatibility code.

The reason is because the best way to do the backwards compatibility would be to add a new column (isnewrecipe) and set all the old recipes to 0. All the new recipes would then be set to 1 and the code would be changed to first check if an isnewrecipe exists for what you're trying to combine and then fall back on the old recipe. The problem with that is there's a LOT of places in the code where that where clause would need to be changed. I'd end up mucking up the code pretty bad as an interim fix.

Again, I actually started on that, but I needed something to check with so I generated a couple of recipes in the new format and wrote a quick script to compare them to the old. Through this, I found quite a few inconsistencies (as you mention above) with the existing database.

After running the script to convert all of the old recipes to the new format, I then compared the new format recipes with the old. I compare them in plain English because it makes it easier on me and better to test. Here is an example of the output:
Quote:
Recipe mismatch for recipe #3453:
Old Method: To make recipe #3453 (tarnished halberd) you need 1 of item #5024 (1xRusty Halberd) 1 of item #12056 (1xSharpening Stone) inside item #17 () and if you fail you get back nothing but if you succeed you get back 1 of item #67383 (1xTarnished Halberd).
New Method: To make recipe #3453 (tarnished halberd) you need 1 of item #5024 (1xRusty Halberd) 1 of item #12056 (1xSharpening Stone) inside item #17 () and if you fail you get back 1 of item #5024 (1xRusty Halberd) but if you succeed you get back 1 of item #67383 (1xTarnished Halberd).
Mismatch in fails:
Old Method: and if you fail you get back nothing
New Method: and if you fail you get back 1 of item #5024 (1xRusty Halberd)
Because it got converted to the new format properly, it means that the old recipe for tarnished halberd has item 5024 (rusty halberd) with failcount = 1 and componentcount = 1 in the same line. For the old code, the recipe is actually wrong.

Again, each new recipe is verified against the old recipe output, but now I'm stuck with how to fix it. I'm thinking the only consistent way to do it (with new recipes being added all the time) is to submit all of the necessary changes to the old format (on the PEQ side) and then rerun the script until all inconsistencies have been taken care of. In this case, it would be setting the item 5024 failcount to 0 in recipe 3453 and then adding another entry for the fail return.

There's quite a few items where this crops up. If nothing else, at least a lot of recipes will get fixed. Thoughts?
Reply With Quote