Re: ArmedObjects having NULL weapons in their weapon list [message #490220 is a reply to message #490216] |
Thu, 01 January 2015 14:09 |
dblaney1
Messages: 358 Registered: March 2014 Location: United States
Karma:
|
Commander |
|
|
Jerad Gray wrote on Thu, 01 January 2015 08:29 |
Neijwiert wrote on Wed, 31 December 2014 09:46 |
Jerad Gray wrote on Wed, 31 December 2014 08:28 |
danpaul88 wrote on Wed, 31 December 2014 08:06 | As I recall index zero of the weapon bag is always a null "no weapon" weapon... jonwil could confirm that though.
|
Which would make sense, far easier to have a slot for no weapon then hacking in a special "no weapon" state into all the weapon functions.
|
Well how I would do it is to have the WeaponIndex variable be -1. That saves 4 bytes of memory so you don't have to store the NULL pointer in the weapon list
|
However, if they stored them in an array instead of a linked list -1 could cause some pretty serious issues
|
Arrays in c++ allows you to do some really bad things lol.
[Updated on: Thu, 01 January 2015 14:09] Report message to a moderator
|
|
|