Sender: tim AT picard DOT skynet DOT be Message-ID: <3ADC057F.14A48AE3@falconsoft.be> Date: Tue, 17 Apr 2001 10:57:35 +0200 From: Tim Van Holder Organization: Falcon Software NV X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-3 i686) X-Accept-Language: en, nl-BE, nl MIME-Version: 1.0 To: djgpp AT delorie DOT com, Rafael Frongillo Subject: Re: integer assignment error References: <20010413203035 DOT 45876 DOT qmail AT web13303 DOT mail DOT yahoo DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Rafael Frongillo wrote: > One tip: try and make your code more readable. For one thing, try to avoid tabs as indentation, it can make code virtually unreadable in some editors (where tab = 8 spaces). > guy::guy(int n, int xx, int yy) { > num = n; x = xx; y = yy; w = 40, h = 51; > speed=2, maxspeed=6, canjump = weapon = 1, hp=100; > checkpic = check1; temp = stand; > for (int i=0; i for (int i=0; i } Anyway, here is your problem: lifting isn't initialized (though you clearly stated it was). Also, data members should be in the initializer list as much as possible, and that the initializer list should follow the order of the member declarations: guy::guy(int n, int xx, int yy) : speed(2), maxspeed(6), picn(0), jumpn(0), stopjump(0), running(0), jumping(0), falling(0), loading(0), canjump(1), grabbing(0), weapon(1), d(0), dead(0), mslnum(0), hp(100), lifting(0), num(n), x(xx), y(yy), px(0), py(0), Kj(0), Kf(0), Ku(0), Kd(0), Kd(0), Kr(0), Kl(0), w(40), h(51), checkpic(check1), temp(stand) { // consider 'memset (ammo, 0, sizeof (ammo));' for this for (int i = 0; i < (WEPNUM + 1); ++i) ammo[i] = 0; // Consider using vector for this; you wouldn't need // an upper limit (MAXMSL), and this initialisation would be done // automagically for (int i = 0; i < MAXMSL; ++i) msls[i] = MSL(); } You may also want to consider using bool instead of ints for those values that represent on/off or true/false flags (canjump seems to be one of those), or using vector to store them (while you then lose the ability to address them by name directly, you do get more efficient storage (1 bit per boolean)). -- Tim Van Holder - Falcon Software N.V. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This message was posted using plain text. I do not endorse any products or services that may be hyperlinked to this message.