MCPcopy Create free account
hub / github.com/SimHacker/micropolis / getChar

Method getChar

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:370–381  ·  view source on GitHub ↗

* Get character from the map. * @param x X coordinate in pixels. * @param y Y coordinate in pixels. * @return Map character if on-map, or \c -1 if off-map. */

Source from the content-addressed store, hash-verified

368 * @return Map character if on-map, or \c -1 if off-map.
369 */
370short Micropolis::getChar(int x, int y)
371{
372 // Convert sprite coordinates to tile coordinates.
373 x >>= 4;
374 y >>= 4;
375
376 if (!testBounds(x, y)) {
377 return -1;
378 } else {
379 return map[x][y] & LOMASK;
380 }
381}
382
383
384/**

Callers

nothing calls this directly

Calls 1

testBoundsFunction · 0.85

Tested by

no test coverage detected