View Single Post
blurredd

JCF Member

Joined: Nov 2001

Posts: 1,896

blurredd is an asset to this forumblurredd is an asset to this forum

Aug 16, 2009, 10:02 AM
blurredd is offline
Reply With Quote
It's because JJ2 does this:

Code:
static char maxPlayers = 0;
char c = getchar();
if (c >= '0' && c <= '9') {
	maxPlayers = maxPlayers * 10;	//loss of data since char is too small
	maxPlayers += c - '0';

	if (maxPlayers > 32) {
		maxPlayers = 32;
	}
}
When it should be doing something like this:

Code:
static char maxPlayers = 0;
char c = getchar();
if (c >= '0' && c <= '9') {
	int tempMaxPlayers = maxPlayers * 10;
	tempMaxPlayers += c - '0';

	if (tempMaxPlayers > 32) {
		tempMaxPlayers = 32;
	}
	maxPlayers = tempMaxPlayers;
}
__________________
D3
Extra. No CTO v0.75
Animating Tiles Properties.
ATB Contest. Scripting Language.
Gameplay Theories.
1UP. Pitfall. Desolation.
SC2.