Пример #1
0
void game::handleCollisions()
{
	//object-object

	list<object*>::iterator it, jt, next;

	char fromWhere;


	for (it = otherObjects.begin() ; it != otherObjects.end(); it++)
	{
		jt = it;
		for (jt++; jt != otherObjects.end(); jt++)
		{
			if ((fromWhere = ((* it)->collidesWith (**jt))))
			{
				(*it)-> collision(*jt, fromWhere);
				(*jt)-> collision(*it, otherSide(fromWhere));


			}
		}

	}

}
Пример #2
0
/**
 * Make sure disambiguating of Mappings works.
 */
void FMDIndexTests::testDisambiguate() {

    // Make some positions    
    Mapping mapped(TextPosition(1, 1));
    Mapping otherSide(TextPosition(0, 33)); 
    Mapping unmapped(TextPosition(0, 0), false);
    Mapping elsewhere(TextPosition(2, 10));
    
    // Make sure disambiguate does the right things
    CPPUNIT_ASSERT(index->disambiguate(mapped, otherSide) == mapped);
    CPPUNIT_ASSERT(index->disambiguate(otherSide, mapped) == otherSide);
    CPPUNIT_ASSERT(index->disambiguate(mapped, unmapped) == mapped);
    CPPUNIT_ASSERT(index->disambiguate(unmapped, mapped) == otherSide);
    CPPUNIT_ASSERT(index->disambiguate(unmapped, unmapped).is_mapped == false);
    CPPUNIT_ASSERT(index->disambiguate(elsewhere, mapped).is_mapped == false);
}