mirror of https://github.com/axmolengine/axmol.git
commit
3dde02ba93
|
@ -576,7 +576,7 @@ Sprite* TMXLayer::getTileAt(const Vec2& tileCoordinate)
|
|||
|
||||
// if GID == 0, then no tile is present
|
||||
if( gid ) {
|
||||
int index = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
|
||||
int index = (int) tileCoordinate.x + (int) tileCoordinate.y * _layerSize.width;
|
||||
|
||||
auto it = _spriteContainer.find(index);
|
||||
if (it != _spriteContainer.end())
|
||||
|
@ -611,7 +611,7 @@ int TMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = n
|
|||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
|
||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||
|
||||
int idx = static_cast<int>((tileCoordinate.x + tileCoordinate.y * _layerSize.width));
|
||||
int idx = static_cast<int>(((int) tileCoordinate.x + (int) tileCoordinate.y * _layerSize.width));
|
||||
|
||||
// Bits on the far end of the 32-bit global tile ID are used for tile flags
|
||||
int tile = _tiles[idx];
|
||||
|
@ -677,7 +677,7 @@ void TMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
|||
|
||||
if( gid ) {
|
||||
|
||||
int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
|
||||
int z = (int) tileCoordinate.x + (int) tileCoordinate.y * _layerSize.width;
|
||||
|
||||
// remove tile from GID map
|
||||
setFlaggedTileGIDByIndex(z, 0);
|
||||
|
@ -796,13 +796,13 @@ void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flag
|
|||
// empty tile. create a new one
|
||||
else if (currentGID == 0)
|
||||
{
|
||||
int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
|
||||
int z = (int) tileCoordinate.x + (int) tileCoordinate.y * _layerSize.width;
|
||||
setFlaggedTileGIDByIndex(z, gidAndFlags);
|
||||
}
|
||||
// modifying an existing tile with a non-empty tile
|
||||
else
|
||||
{
|
||||
int z = tileCoordinate.x + tileCoordinate.y * _layerSize.width;
|
||||
int z = (int) tileCoordinate.x + (int) tileCoordinate.y * _layerSize.width;
|
||||
auto it = _spriteContainer.find(z);
|
||||
if (it != _spriteContainer.end())
|
||||
{
|
||||
|
|
|
@ -345,7 +345,7 @@ uint32_t TMXLayer::getTileGIDAt(const Vec2& pos, TMXTileFlags* flags/* = nullptr
|
|||
CCASSERT(pos.x < _layerSize.width && pos.y < _layerSize.height && pos.x >=0 && pos.y >=0, "TMXLayer: invalid position");
|
||||
CCASSERT(_tiles && _atlasIndexArray, "TMXLayer: the tiles map has been released");
|
||||
|
||||
ssize_t idx = static_cast<int>((pos.x + pos.y * _layerSize.width));
|
||||
ssize_t idx = static_cast<int>(((int) pos.x + (int) pos.y * _layerSize.width));
|
||||
// Bits on the far end of the 32-bit global tile ID are used for tile flags
|
||||
uint32_t tile = _tiles[idx];
|
||||
|
||||
|
@ -366,7 +366,7 @@ Sprite * TMXLayer::insertTileForGID(uint32_t gid, const Vec2& pos)
|
|||
Rect rect = _tileSet->getRectForGID(gid);
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
intptr_t z = (intptr_t)(pos.x + pos.y * _layerSize.width);
|
||||
intptr_t z = (intptr_t)((int) pos.x + (int) pos.y * _layerSize.width);
|
||||
|
||||
Sprite *tile = reusedTileWithRect(rect);
|
||||
|
||||
|
@ -403,7 +403,7 @@ Sprite * TMXLayer::updateTileForGID(uint32_t gid, const Vec2& pos)
|
|||
{
|
||||
Rect rect = _tileSet->getRectForGID(gid);
|
||||
rect = Rect(rect.origin.x / _contentScaleFactor, rect.origin.y / _contentScaleFactor, rect.size.width/ _contentScaleFactor, rect.size.height/ _contentScaleFactor);
|
||||
int z = (int)(pos.x + pos.y * _layerSize.width);
|
||||
int z = (int)((int) pos.x + (int) pos.y * _layerSize.width);
|
||||
|
||||
Sprite *tile = reusedTileWithRect(rect);
|
||||
|
||||
|
@ -516,7 +516,7 @@ void TMXLayer::setTileGID(uint32_t gid, const Vec2& pos, TMXTileFlags flags)
|
|||
// modifying an existing tile with a non-empty tile
|
||||
else
|
||||
{
|
||||
int z = pos.x + pos.y * _layerSize.width;
|
||||
int z = (int) pos.x + (int) pos.y * _layerSize.width;
|
||||
Sprite *sprite = static_cast<Sprite*>(getChildByTag(z));
|
||||
if (sprite)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue