Example #1
0
void EClassManager::resolveInheritance()
{
	// Resolve inheritance on the model classes
    for (Models::iterator i = _models.begin(); i != _models.end(); ++i) {
    	resolveModelInheritance(i->first, i->second);
    }
        
    // Resolve inheritance for the entities. At this stage the classes
    // will have the name of their parent, but not an actual pointer to
    // it
    for (EntityClasses::iterator i = _entityClasses.begin();
         i != _entityClasses.end(); ++i) 
	{
		// Tell the class to resolve its own inheritance using the given
		// map as a source for parent lookup
		i->second->resolveInheritance(_entityClasses);

        // If the entity has a model path ("model" key), lookup the actual
        // model and apply its mesh and skin to this entity.
        if (i->second->getModelPath().size() > 0) {
            Models::iterator j = _models.find(i->second->getModelPath());
            if (j != _models.end()) {
                i->second->setModelPath(j->second->mesh);
                i->second->setSkin(j->second->skin);
            }
        }
    }

	// greebo: Override the eclass colours of two special entityclasses
    Vector3 worlspawnColour = ColourSchemes().getColour("default_brush");
    Vector3 lightColour = ColourSchemes().getColour("light_volumes");
    
    IEntityClassPtr light = findOrInsert("light", true);
	light->setColour(lightColour);
	
	IEntityClassPtr worldspawn = findOrInsert("worldspawn", true);
	worldspawn->setColour(worlspawnColour);

}
Example #2
0
int main(int argc, char *argv[])
{
    char word[MAX_WORD_SIZE];
    FILE *in = fopen("words.in", "r");
    BinaryTree bst;
    bst.pRoot = NULL;

    while (fscanf(in, "%s", word) == 1) {
        if (bst.pRoot == NULL) {
            bst.pRoot = newTreeNode(newNodeData(word));
        } else {
            findOrInsert(bst, newNodeData(word));
        }
    }

    printf("\nThe in-order traversal is:");
    inOrder(bst.pRoot);
    printf("\n\n");
    printf("\nThe pre-order traversal is:");
    preOrder(bst.pRoot);
    printf("\n\n");
    fclose(in);

    



    /*
    FILE *in = fopen("btree.in", "r");
    BinaryTree bt;
    bt.pRoot = buildTree(in);
    printf("\nThe in-order traversal is: ");
    preOrder(bt.pRoot);
    printf("\n\n");
    fclose(in);
    */

    return 0;
}
Example #3
0
void NodeList::draw () {
   
    
    Node * curr;
    Resistor * curr1;
    curr = head;
    
    int x, y, height;
    x= 50;
    y= 0;
    height = getHeight() * 50;
    
    while (curr != NULL) {
        string temp = MergeString_Number(curr->nodeId, "Node ");
        string temp1 = MergeString_Number(" V", curr->voltage);
        window.gl_setcolor(BLACK);
        window.gl_drawrect(x,20, x+10, height); // drawing the box for the node
        window.gl_drawtext(x+5,15, temp , 100); // drawing nodeID
        window.gl_drawtext(x+5,0, temp1, 100); // drawing voltage
       
        x = x+ 100;
        
        
        curr1 = (curr->getResistorList()).getHead();
        while (curr1 != NULL) {
            int nodeid1 = curr1->getEndpoints(0);
            int nodeid2 = curr1->getEndpoints(1);
        
            if (nodeid1 == curr->nodeId) {
                if (nodeid2 >curr->nodeId) {
                    int x1 = 55 + (curr->drawID*100); 
                    int x2 = ((findOrInsert(nodeid2))->drawID * 100) + 55;
                    int x3 = x1 +(x2-x1)/2;    
                    y = y+50;
                    string temp =  MergeString_String(curr1->getName(), " (");
                    string temp1 = MergeString_Number(curr1->getResistance(), temp);
                    string temp2 = MergeString_String(temp1, " Ohms)");
                    
                    // making /\/\/\/
                    window.gl_setcolor(RED);
                    window.gl_drawline(x1, y, x3-20, y);
                    window.gl_drawline(x3-20, y, x3-10, y+5);
                    window.gl_drawline(x3-10, y+5, x3, y-5 );
                    window.gl_drawline(x3, y-5, x3+10, y+5 );
                    window.gl_drawline(x3+10, y+5,x3+20, y );
                    window.gl_drawline(x3+20, y, x2, y);
                    
                    //drawing resistance
                    window.gl_drawtext((x1+x2)/2, y-10, temp2 , 200);
                    
                }
            }
        
            else if (nodeid2 == curr->nodeId ) {
                if (nodeid1 >curr->nodeId) {
                    int x1 = 55 + (curr->drawID*100);
                    int x2 = ((findOrInsert(nodeid1))->drawID * 100) + 55;
                    int x3 = x1 +(x2-x1)/2;   
                    y = y+50;
                    
                    string temp = MergeString_String(curr1->getName(), " (");
                    string temp1 = MergeString_Number(curr1->getResistance(), temp);
                    string temp2 = MergeString_String(temp1, " Ohms)");
               
                    // making /\/\/\/
                    window.gl_setcolor(RED);
                    window.gl_drawline(x1, y, x3-20, y);
                    window.gl_drawline(x3-20, y, x3-10, y+5);
                    window.gl_drawline(x3-10, y+5, x3, y-5 );
                    window.gl_drawline(x3, y-5, x3+10, y+5 );
                    window.gl_drawline(x3+10, y+5,x3+20, y );
                    window.gl_drawline(x3+20, y, x2, y);
                     
                    //drawing resistance
                    window.gl_drawtext((x1+x2)/2, y-10, temp2, 200);

                }

            }
        curr1 = curr1->getNext();
        }
        
        curr = curr->next;
    }
    

}