Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpTerritoryManager.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | # define FLOODFILL(i, j, code)\ | ||||
while (false) | while (false) | ||||
/** | /** | ||||
* Compute the tile indexes on the grid nearest to a given point | * Compute the tile indexes on the grid nearest to a given point | ||||
*/ | */ | ||||
static void NearestTerritoryTile(entity_pos_t x, entity_pos_t z, u16& i, u16& j, u16 w, u16 h) | static void NearestTerritoryTile(entity_pos_t x, entity_pos_t z, u16& i, u16& j, u16 w, u16 h) | ||||
{ | { | ||||
entity_pos_t scale = Pathfinding::NAVCELL_SIZE * ICmpTerritoryManager::NAVCELLS_PER_TERRITORY_TILE; | entity_pos_t scale = Pathfinding::NAVCELL_SIZE * ICmpTerritoryManager::NAVCELLS_PER_TERRITORY_TILE; | ||||
i = clamp((x / scale).ToInt_RoundToNegInfinity(), 0, w - 1); | i = Clamp((x / scale).ToInt_RoundToNegInfinity(), 0, w - 1); | ||||
Stan: Pretty sure this isn't returning a U16 | |||||
vladislavbelovAuthorUnsubmitted Done Inline ActionsIt'd be better to fix it separately. Too big patch already. vladislavbelov: It'd be better to fix it separately. Too big patch already. | |||||
j = clamp((z / scale).ToInt_RoundToNegInfinity(), 0, h - 1); | j = Clamp((z / scale).ToInt_RoundToNegInfinity(), 0, h - 1); | ||||
} | } | ||||
void CCmpTerritoryManager::CalculateCostGrid() | void CCmpTerritoryManager::CalculateCostGrid() | ||||
{ | { | ||||
if (m_CostGrid) | if (m_CostGrid) | ||||
return; | return; | ||||
CmpPtr<ICmpPathfinder> cmpPathfinder(GetSystemEntity()); | CmpPtr<ICmpPathfinder> cmpPathfinder(GetSystemEntity()); | ||||
▲ Show 20 Lines • Show All 481 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Pretty sure this isn't returning a U16