Move roomchange off of Game

The purpose of this variable was to keep track of if gamelogic() called
map.gotoroom() at any point during its execution. So map.gotoroom()
always unconditionally set it to true, and then gamelogic() would check
it later.

Well, there's no need to put that in a global variable and do it like
that! It makes it less clear when you do that.

So what I've done instead is made a temporary macro wrapper around
map.gotoroom() that also sets roomchange to true. I've also made it so
any attempt to use map.gotoroom() directly results in failure (and since
then using map.gotoroom() in the wrapper macro would also fail, I've had
to make a gotoroom wrapper function around map.gotoroom() so the wrapper
macro itself doesn't fail).
This commit is contained in:
Misa authored and Misa Elizabeth Kai committed 2021-08-31 09:25:47 -07:00
1 parent 75ed9f9631
commit 7a598f5811
5 files changed
+31 -26

No files matched your search

-3
View File
@@ -967,7 +967,6 @@ void mapclass::gotoroom(int rx, int ry)
//Ok, what way are we moving?
game.roomx = rx;
game.roomy = ry;
game.roomchange = true;
if (game.roomy < 10)
{
@@ -994,7 +993,6 @@ void mapclass::gotoroom(int rx, int ry)
{
game.roomx = rx;
game.roomy = ry;
game.roomchange = true;
if (game.roomx < 100) game.roomx = 100 + ed.mapwidth-1;
if (game.roomy < 100) game.roomy = 100 + ed.mapheight-1;
if (game.roomx > 100 + ed.mapwidth-1) game.roomx = 100;
@@ -1005,7 +1003,6 @@ void mapclass::gotoroom(int rx, int ry)
{
game.roomx = rx;
game.roomy = ry;
game.roomchange = true;
if (game.roomx < 100) game.roomx = 119;
if (game.roomy < 100) game.roomy = 119;
if (game.roomx > 119) game.roomx = 100;