Jump to content
  • Advertisement
  • entries
  • comments
  • views

Into the wild blue yonder.

Sign in to follow this  


Not a lot of stuff that's visible; more like internal incremental improvements. But they're important improvements.


Yesterday, I implemented weapon switching. It switches when the player strikes the key for it, as well as when you run out of ammo on a gun and try to fire it. This was relatively easy to do, although you can't really see the effects yet as the two guns mounted on my test ship are identical.

What's more important is that I took a long and hard look at my Inventory system and noticed that I'd be doing a lot of wholesale transfers of entire sets of cargo. Therefore, writing something to handle item cloning, item disposal and inventory serialization was a good idea.

So I wrote an Inventory class with a copy constructor that did cloning. Easy enough, right? Well, not really. Turns out the Apple CPlusTest seems to have a bug in it, and the test script for Inventory dies (without any indication of where it died, which required binary assertions and printf debugging... whoo) trying to execute a virtual method (in my case, Weapon::clone, which comes from the pure virtual method CargoItem::clone). I have no idea why this is, but suspect I've either made a stupid mistake or CPlusTest is trying to call the pure virtual method instead of the derived method. I'm leaning pretty heavily towards the latter, but aren't going to discount the former. If anyone wants to help out, I can bark the code up here and you can see if I'm doing something insane.

Edit Ok, jpetrie affirms me that the code is not defective. It's probably a fault in CPlusTest.

For the next project I'm certainly moving to Tut or CppUnit. The lack of debugging facility in CPlusTest test scripts is a glaring oversight. Using unit tests on this project has already saved me a ton of time from typos and the like, so I recommend it to anyone to use to test their controller objects properly.

Other than that, the inventory seems to work quite well and has trimmed hundreds of lines off of my serialization and transfer code. I liked it so much I added a rule to my coding standards that I should always use custom collections for stuff that needs to be copied.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!