// Main function int main(int argc, char* argv[]) { int i; char *chemin; // Glut initializations glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(400, 400); glutInitWindowPosition(100, 100); glutCreateWindow("Projet OpenGl - Bender"); glShadeModel(GL_SMOOTH); glEnable(GL_DEPTH_TEST); glClearColor(0.5,0.5,0.5, 1); // Glut callback functions glutReshapeFunc(&window_reshape); glutDisplayFunc(&window_display); glutKeyboardFunc(&window_key); glutKeyboardUpFunc(&window_key_up); glutMouseFunc(&window_mouseFunc); glutMotionFunc(&window_motionFunc); glutSpecialFunc(&window_specialDownFunc); glutSpecialUpFunc(&window_specialUpFunc); glutTimerFunc(40, &window_timer, 0); // Program variables initialization initControls(); initCamera(); initBuildings(); // Fetching the path for the texture directory. chemin = (char*)malloc(100); chemin[0]='\0'; strcat(chemin, argv[0]); for(i=99;i>=0;i--) { if(chemin[i]=='/' || chemin[i]=='\\') { chemin[i+1]='\0'; i=-1; } } // Buildings and robots list initialization makeBender(chemin); createCity(chemin); free(chemin); glutMainLoop(); return EXIT_FAILURE; }
void Cities::readFromXMLFile(const std::string &filename) { auto xr = XmlReader::FromFile(filename); if (!xr) { Server::debug()("Failed to load data from " + filename, Color::CHAT_ERROR); return; } for (auto elem : xr.getChildren("city")) { City::Name name; if (!xr.findAttr(elem, "name", name)) continue; createCity(name); City &city = _container[name]; for (auto memberElem : xr.getChildren("member", elem)) { std::string username; if (!xr.findAttr(memberElem, "username", username)) continue; city.addPlayerWithoutAlerting(username); _usersToCities[username] = name; } } }