A quick valgrind on the PC version says
CODE
Invalid read of size 4
==7930== at 0x8057A59: Node::getPos() (Node.h:156)
==7930== by 0x80613F0: StateMain:
rocessCollisionLists() (StateMain.cpp:928)
==7930== by 0x8061F26: StateMain::update() (StateMain.cpp:441)
==7930== by 0x804C7A7: Engine::stateLoop() (Engine.cpp:131)
==7930== by 0x8052E10: main (_main.cpp:18)
==7930== Address 0x4B2A02C is 12 bytes inside a block of size 160 free'd
==7930== at 0x4024096: operator delete(void*) (vg_replace_malloc.c:244)
==7930== by 0x80586EA: __gnu_cxx::new_allocator<Node>::deallocate(Node*, unsigned) (new_allocator.h:97)
==7930== by 0x8058714: std::_Vector_base<Node, std::allocator<Node> >::_M_deallocate(Node*, unsigned) (stl_vector.h:134)
==7930== by 0x8058ABF: std::_Vector_base<Node, std::allocator<Node> >::~_Vector_base() (stl_vector.h:120)
==7930== by 0x8058B28: std::vector<Node, std::allocator<Node> >::~vector() (stl_vector.h:268)
==7930== by 0x806DA06: Snake::~Snake() (Snake.h:16)
==7930== by 0x806DC28: __gnu_cxx::new_allocator<Snake>::destroy(Snake*) (new_allocator.h:110)
==7930== by 0x806E2D8: std::vector<Snake, std::allocator<Snake> >::erase(__gnu_cxx::__normal_iterator<Snake*, std::vector<Snake, std::allocator<Snake> > >) (vector.tcc:114)
==7930== by 0x8061361: StateMain:
rocessCollisionLists() (StateMain.cpp:922)
==7930== by 0x8061F26: StateMain::update() (StateMain.cpp:441)
==7930== by 0x804C7A7: Engine::stateLoop() (Engine.cpp:131)
==7930== by 0x8052E10: main (_main.cpp:18)
In StateMain:
rocessCollisionLists() line 922 you do
CODE
snakes.erase(snakes.begin() + collisionLists
[k]);
But then do a lot of other stuff with snakes[collisionLists[k]] after.
Could be your bug, but in any case it's bad code.