Obscured References

There are now 4 characters on screen.  Whee.

There are now 4 characters on screen. Whee.

So, Sully’s Battlesystem had a problem.

It worked well as long as you had character 0 in party slot 0, and character 1 in party slot 1, but as soon as anything changed from that configuration… shit got real.

The problem was due entirely to vergec’s type-poor environment.  In the battle system party[party_idx] and party_idx were used interchangeably.  Hey, they’re both ints and they look the same, right?

After identifying the source of the issue, it was a matter of a global search on “party[” and identifying the spots where it was misused.  I’ve also wrapped this whole operation in a function to give a level of english for humans to see and go “oh, maybe I should give thought to this.”

This whole conundrum is a non-issue in the modern world of programming, what with fancy objects and classes and types.

The most fun part about this is, once I solved the party reference problem, there was a renderstack problem of exactly the same type, where renderstack references and sprite references (which are stored in two different int-indexed global stacks) were used interchangeably. I was already in the mindset to solve this issue.

The whole task is documented between r187 and r197 in the sully svn repository.  Top to bottom the tasks were about 8 hours of braining and typing.

It’s my fault for continuing down this path of madness, but there’s a massive amount of code and effort in this so I have lock-in.  Converting the whole thing to Lua would still have these issues to track down.

Also read...

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>