Add missing include and rework to use Coords

This commit is contained in:
duncanspumpkin 2019-02-05 19:27:30 +00:00
parent b2a1cb9639
commit 50b241d20d
1 changed files with 7 additions and 8 deletions

View File

@ -16,6 +16,7 @@
#include "../ui/UiContext.h" #include "../ui/UiContext.h"
#include "../windows/Intent.h" #include "../windows/Intent.h"
#include "../world/Banner.h" #include "../world/Banner.h"
#include "../world/Scenery.h"
#include "../world/Sprite.h" #include "../world/Sprite.h"
#include "GameAction.h" #include "GameAction.h"
@ -58,8 +59,7 @@ public:
rct_banner* banner = &gBanners[_bannerIndex]; rct_banner* banner = &gBanners[_bannerIndex];
int32_t x = banner->x << 5; CoordsXY coords{ banner->x * 32, banner->y * 32 };
int32_t y = banner->y << 5;
if (_isLarge) if (_isLarge)
{ {
@ -77,7 +77,7 @@ public:
} }
else else
{ {
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32); TileElement* tileElement = map_get_first_element_at(coords.x / 32, coords.y / 32);
bool wallFound = false; bool wallFound = false;
do do
{ {
@ -107,14 +107,13 @@ public:
{ {
rct_banner* banner = &gBanners[_bannerIndex]; rct_banner* banner = &gBanners[_bannerIndex];
int32_t x = banner->x << 5; CoordsXY coords{ banner->x * 32, banner->y * 32 };
int32_t y = banner->y << 5;
if (_isLarge) if (_isLarge)
{ {
TileElement* tileElement = banner_get_tile_element((BannerIndex)_bannerIndex); TileElement* tileElement = banner_get_tile_element((BannerIndex)_bannerIndex);
if (!sign_set_colour( if (!sign_set_colour(
banner->x * 32, banner->y * 32, tileElement->base_height, tileElement->GetDirection(), coords.x, coords.y, tileElement->base_height, tileElement->GetDirection(),
tileElement->AsLargeScenery()->GetSequenceIndex(), _mainColour, _textColour)) tileElement->AsLargeScenery()->GetSequenceIndex(), _mainColour, _textColour))
{ {
return MakeResult(GA_ERROR::UNKNOWN, STR_NONE); return MakeResult(GA_ERROR::UNKNOWN, STR_NONE);
@ -122,10 +121,10 @@ public:
} }
else else
{ {
TileElement* tileElement = map_get_first_element_at(x / 32, y / 32); TileElement* tileElement = map_get_first_element_at(coords.x / 32, coords.y / 32);
tileElement->AsWall()->SetPrimaryColour(_mainColour); tileElement->AsWall()->SetPrimaryColour(_mainColour);
tileElement->AsWall()->SetSecondaryColour(_textColour); tileElement->AsWall()->SetSecondaryColour(_textColour);
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); map_invalidate_tile(coords.x, coords.y, tileElement->base_height * 8, tileElement->clearance_height * 8);
} }
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER); auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);