iMiniB3D - clear collision type bug and fix.

BlitzMax Forums/MiniB3D Module/iMiniB3D - clear collision type bug and fix.

ima747(Posted 2009) [#1]
in entity.mm

void Entity::EntityType(int type_no,int recursive){

	// add to collision entity list if new type no<>0 and not previously added
	if(collision_type==0 && type_no!=0){
			
		CollisionPair::ent_lists[type_no].push_back(this);
		
	}
	
	// remove from collision entity list if new type no=0 and previously added
	if(collision_type!=0 && type_no==0){
		CollisionPair::ent_lists[type_no].remove(this);
	}
...


should be

void Entity::EntityType(int type_no,int recursive){

	// add to collision entity list if new type no<>0 and not previously added
	if(collision_type==0 && type_no!=0){
			
		CollisionPair::ent_lists[type_no].push_back(this);
		
	}
	
	// remove from collision entity list if new type no=0 and previously added
	if(collision_type!=0 && type_no==0){
		CollisionPair::ent_lists[collision_type].remove(this);
	}
...


the remove from collisions entity list was attempting to remove the entity from the list it was being added to (type_no) which was 0 rather than the list it was currently in (collision_type). causing it to be impossible to set an entity type back to 0 once it was set.