From f2f0867edd0d9624a77e4e5db39825b8ea1a55d0 Mon Sep 17 00:00:00 2001 From: tom Date: Sat, 14 Jan 2017 11:56:33 -0600 Subject: completly remove location structure and replaced it with sdl_rect --- src/list.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/list.cpp') diff --git a/src/list.cpp b/src/list.cpp index b5e05da..b8d2888 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -4,13 +4,17 @@ List::List(Window m) { int i; + SDL_Rect Rect = {0,0,CREATURE_SIZE,CREATURE_SIZE}; + for(i=0;iBehavior(); if(it->getHealth()<=0){ - Location z = it->getLocation(); - SDL_Rect rect = it->getRect(); - Resource r = Resource(main,rect.w,z); + SDL_Rect Rect = it->getRect(); + Resource r = Resource(main,Rect); R.push_back(r); C.erase(it--); } @@ -54,14 +57,14 @@ list List::getNear(Creature nC) list N; for(list ::iterator it = R.begin(); it!=R.end(); it++){ - if( nC.getBestSense() > Distance(nC.getLocation(),it->getLocation()) ) + if( nC.getBestSense() > Distance(nC.getRect(),it->getRect()) ) N.push_back(&(*it)); } for(list ::iterator it = C.begin(); it!=C.end(); it++){ if( &nC == &(*it)) continue; - else if( nC.getBestSense() > Distance(nC.getLocation(),it->getLocation()) ) + else if( nC.getBestSense() > Distance(nC.getRect(),it->getRect()) ) N.push_back(&(*it)); } -- cgit v1.2.3