Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

PuterPaul

Equivalent code

This topic is 5482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is
int startrow=DrawableArea1.top-MapArea.top;
int endrow=DrawableArea1.bottom-MapArea.top;

int yn=endrow-startrow;

int * rowlookup=new int[endrow-startrow];
int * rowl=rowlookup-startrow;
for(y=startrow;y<endrow;y++)
{
	int y2=int(y1);
	if(y2<miny) y2=miny;
	if(y2>maxy) y2=maxy;
	rowl[y]=y2*rowstep+datarow1;
	y1+=yd;
}
Equivalent to
int startrow=DrawableArea1.Top-MapArea.Top;
int endrow=DrawableArea1.Bottom-MapArea.Top;

int yn=endrow-startrow;

int[] rowlookup = new int[endrow-startrow];
for(y=startrow;y<endrow;y++)
{
        int y2=(int)y1;        
	if(y2<miny) y2=miny;
	if(y2>maxy) y2=maxy;
        rowlookup[y]=y2*rowstep+datarow1
        y1+=yd;
}

Share this post


Link to post
Share on other sites
Advertisement
DrawableArea1.top
DrawableArea1.Top

No. C++ is case sensitive. top and Top could mean totally different things.

int * rowl=rowlookup-startrow;

That's the other difference I could spot. And surely that row has some implications, don't you think? (as rowl is used later instead of rowlookup)

[edited by - civguy on September 23, 2003 7:03:51 AM]

Share this post


Link to post
Share on other sites
You calculate this 'yn' but you don't use it. In C# version, the loop should be

for(y=0;y<yn;y++)

Then they should be equal.

[edited by - civguy on September 23, 2003 8:03:52 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!