MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / MapTile_Get

Method MapTile_Get

Source/Fodder.cpp:8687–8699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8685}
8686
8687int32 cFodder::MapTile_Get(const size_t pTileX, const size_t pTileY) {
8688
8689 if ((int32) pTileX > mMapLoaded->getWidth() || (int32) pTileY > mMapLoaded->getHeight())
8690 return -1;
8691
8692 size_t Tile = (((pTileY * mMapLoaded->getWidth()) + pTileX)) + mMapLoaded->getWidth();
8693
8694 uint8* CurrentMapPtr = mMap->data() + mMapTile_Ptr + (Tile * 2);
8695 if (CurrentMapPtr > mMap->data() + mMap->size())
8696 return -1;
8697
8698 return readLE<int16>(CurrentMapPtr);
8699}
8700
8701/**
8702 * Sets a map tile to a certain ID, positioned based on the current camera

Callers

nothing calls this directly

Calls 3

getWidthMethod · 0.45
getHeightMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected