MCPcopy Create free account
hub / github.com/TurningWheel/Barony / checkTileForEntity

Function checkTileForEntity

src/entity.cpp:9976–10026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9974-------------------------------------------------------------------------------*/
9975
9976list_t* checkTileForEntity(int x, int y)
9977{
9978 if ( x < 0 || y < 0 || x > 255 || y > 255 )
9979 {
9980 return nullptr; // invalid grid reference!
9981 }
9982 return &TileEntityList.gridEntities[x][y];
9983
9984// list_t* return_val = NULL;
9985//
9986// //Loop through the list.
9987// //If the entity's x and y match the tile's x and y (correcting for the difference in the two x/y systems, of course), then the entity is on the tile.
9988// //Traverse map.entities...
9989// node_t* node = NULL;
9990// node_t* node2 = NULL;
9991//#ifdef __ARM_NEON__
9992// const int32x2_t xy = { x, y };
9993//#endif
9994//
9995// for ( node = map.entities->first; node != NULL; node = node->next )
9996// {
9997// if ( node->element )
9998// {
9999// Entity* entity = (Entity*)node->element;
10000// if ( entity ) {
10001//#ifdef __ARM_NEON__
10002// uint32x2_t eqxy = vceq_s32(vcvt_s32_f32(vmul_n_f32(vld1_f32(&entity->x), 1.0f / 16.0f)), xy);
10003// if ( eqxy[0] && eqxy[1] )
10004//#else
10005// if ( (int)floor((entity->x / 16)) == x && (int)floor((entity->y / 16)) == y ) //Check if the current entity is on the tile.
10006//#endif
10007// {
10008// //Right. So. Create the list if it doesn't exist.
10009// if ( !return_val )
10010// {
10011// return_val = (list_t*)malloc(sizeof(list_t));
10012// return_val->first = NULL;
10013// return_val->last = NULL;
10014// }
10015//
10016// //And add the current entity to it.
10017// node2 = list_AddNodeLast(return_val);
10018// node2->element = entity;
10019// node2->deconstructor = &emptyDeconstructor;
10020// }
10021// }
10022// }
10023// }
10024//
10025// return return_val;
10026}
10027
10028/*-------------------------------------------------------------------------------
10029

Callers 5

getPowerablesOnTileFunction · 0.85
fillPathMapFunction · 0.85
fillPathMapMethod · 0.85
getItemsOnTileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected