At the moment, I'm having a bit of trouble with the screen refresher for my very poor Roguelike attempt. Essentially, rather than reprint the entire screen anytime anything changes, I'd like to check each tile for a change and only reprint that tile if something new is there - like so:
I know the values are being passed and compared correctly, because the scrolling movement shows the top/bottom/side walls correctly, and the '@' character representing the player moves around more or less as it should... but nothing else changes. I *think* that for some reason either refresh_print() isn't checking every single space as it should, or that it isn't printing every single space as it should. Or maybe both. I've checked and rechecked this, I've added a function to display the map and mapt values, I've done everything I can think of, and I'm still not sure why it's not working. It's probably something incredibly simple that I'm overlooking, but if anyone has any ideas, I'd be really grateful...Code:void location::refresh_temp() //creates a temporary map { /*xdisp and ydisp are the actual x and y location of the top left corner of the display. z is a qualifier - 1 is terrain, 3 is mobile objects - nothing else has been coded yet*/ for (int y = ydisp; y < (ydisp+31); y++) { for (int x = xdisp; x < (xdisp+101); x++){ for (int z = 0; z < 5 ; z++){ mapt[x][y][z] = map[x][y][z];/*mapt is the temporary*/ /*map array*/ } } } } void location::refresh_print() //prints tiles that have changed { /*printloc(x,y,x1,y1) prints actual map tile x,y at display location x1,y1 (hopefully if the tile at x1,y1 has changed in value*/ int x1(0); int y1(0); for (int y = ydisp; y < (ydisp+31); y++){ for (int x = xdisp; x < (xdisp+101); x++){ for (int z = 0; z < 5; z++){ if (mapt[x][y][z] != map[x][y][z]){ locate.printloc(x,y,x1,y1); } } x1++; } x1=0; y1++; } }
EDIT: Woah, sorry... I should have realised that would go a little overboard.



LinkBack URL
About LinkBacks


