Well, I can make it say that, but that would be silly
DaleStan wrote:Action 5 data blocks may not contain more sprites than specified by the action 5. The action 5 may supply more sprites than required by the host, but the data block must contain exactly as many sprites as the header says it contains.
I agree to that, as that's exactly what it says on the action 5 page:
The number of sprites that follow.
Note that it is not generally an error to provide more sprites than required, but this does expend sprite slots unnecessarily.
DaleStan wrote:...
In the same way, the real sprite is only valid if it is 1) properly compressed, and 2) consistent with the preceding data-block header
I also agree to that. If it comes to code, it's faulty if it isn't written
by the book.
When it comes to a code interpreter (like Open in this case), I think it's completely legal for such an interpreter to be smarter than
the book. And that would be my logic then.
Let's go back to the old erroneous code:
Code: Select all
375 * 6 07 83 01 \7! 01 01
376 * 5 0A 01 07 7D 08
377 sprites/industries010.pcx 322 2232 09 31 64 -31 0
378 sprites/industries010.pcx 402 2232 09 44 31 -11 -29
379 sprites/industries010.pcx 450 2232 09 44 31 -11 -29
380 sprites/industries010.pcx 498 2232 09 44 31 -11 -29
381 sprites/industries010.pcx 546 2232 09 44 31 -11 -29
382 sprites/industries010.pcx 594 2232 09 44 31 -11 -29
383 sprites/industries010.pcx 642 2232 09 44 31 -11 -29
384 * 6 07 83 01 \7! 01 01
As a human I read there: "Well, if the climate is not arctic, then the game will skip the next line, which is an action A replacing some sprites, so if it skips that action A it ends up with a bunch of real sprites. Now that's wrong, some real sprites all by themselves. They shouldn't be there, let me fix that *counts number of lines* eight lines. Hey, eight in hex is easy, let me fix it right away. *changes 01 in 08* *hits ctrl+s*"
A code interpreter usually isn't as smart as a human, but it should know the rules from the book. It might as well know something on top of that. A good example to illustrate the opposite would be Internet Explorer: it knows something on top (how to deal with crappy frontpage code), but not the book (incomplete css support). If IE would know the whole book plus how to deal with crappy frontpage code, it would be the perfect browser as it can display every page out there correctly.
Now back to the example code above.
The way I see it, Open processes that fragment as follows:
375 recognises Action 7, should check var 83 *wanders of to get the value of var 83, returns*, picks first byte of var, compares to value 01, concludes it's not equal, skips next sprite
376 *doesn't even check what the sprite is about*
377 Doesn't recognise legal action; does not attempt to process, does not issue error, skips to next line
378-383 (same as previous line)
384 recognises action 7, might be valid, continue processing... etc.
To conclude this: I think we both agree that the code from the fragment above is not valid. It just isn't according to the specification. When it comes to the parser, I think it's fine if it tries to skip things it doesn't understand to see if there's something else it does understand.
Let's go back to the browser example one more time. It can be any browser now. According to w3c specification, a html document should start with the <html> tag (well, actually a doctype, but even google omits that). Now if a document doesn't start with <html> (i.e. invalid code), should the browser issue an error and terminate processing the page, or should it assume [0] a html document and continue processing to see if there's something that it does understand?
Now that's my logic. I don't have to be right, I just want you to understand my logic and maybe conclude that my way of thinking could be valid as well[1].
[0]The headers send by the server indicate a html document, so the browser knows it should use the html parser.
[1]At least I think it's valid.
