Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » CommandLineParser::getInt() doesn't work with negative integers
CommandLineParser::getInt() doesn't work with negative integers [message #471791] Tue, 17 July 2012 04:56 Go to previous message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma:
General (4 Stars)
To get it to work, the digit checking loop needs to be changed to:

					if (*s < '0' || *s > '9')
					{
						if (*s == '-') continue;


But if that's done the function will still return '-1' (a valid negative number) when a non-valid number (e.g. text) is passed to the function, therefor you can't do error checking if you want to support '-1' as a value.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: PowerupGameObj::Grant() and C4GameObj::Detonate()
Next Topic: Slow loading
Goto Forum:
  


Current Time: Mon Nov 11 06:22:36 MST 2024

Total time taken to generate the page: 0.00782 seconds