Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » ArmedObjects having NULL weapons in their weapon list
Re: ArmedObjects having NULL weapons in their weapon list [message #490220 is a reply to message #490216] Thu, 01 January 2015 14:09 Go to previous messageGo to previous message
dblaney1 is currently offline  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 Very Happy

However, if they stored them in an array instead of a linked list -1 could cause some pretty serious issues Razz


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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scripts 4.2 RC1 is now available for testing
Next Topic: Scripts 4.2 to enter private beta testing soon, here are some changes in it
Goto Forum:
  


Current Time: Fri Nov 29 08:52:25 MST 2024

Total time taken to generate the page: 0.00724 seconds