void importFiles::importHouses::insertHousesFromFile(vector<string> dirVec) {
	string name;
	string s_maxSteps, s_rows, s_cols; //value in string
	string err, line;
	int rows, cols; //values in numbers
	char** matrix;
	size_t errcnt = 0;
	for (vector<string>::const_iterator itr = dirVec.begin(); itr != dirVec.end(); ++itr) { //for each .house file:
		ifstream fin((*itr).c_str()); //open file
		if (!fin.good()) {  // check open() success
			err = string("cannot open file");
			errcnt++;
			houses.insert(std::make_pair(new House(NULL, 0, 0, (*itr).substr((*itr).find_last_of("/\\") + 1)), err));
			continue;
		}
		getline(fin, name);
		//fin.ignore(); //skip name line
		name = (*itr).substr((*itr).find_last_of("/\\") + 1); //get file name from path
		//get parameters from file and check them
		getline(fin, s_maxSteps);
		if (!is_number(s_maxSteps)) {
			err = "line number 2 in house file shall be a positive number, found: " + s_maxSteps;
			errcnt++;
			houses.insert(std::make_pair(new House(NULL, 0, 0, (*itr).substr((*itr).find_last_of("/\\") + 1)), err));
			continue;
		}
		//maxSteps = atoi(s_maxSteps.c_str()); for future extensions
		getline(fin, s_rows);
		if (!is_number(s_rows)) {
			err = "line number 3 in house file shall be a positive number, found: " + s_rows;
			errcnt++;
			houses.insert(std::make_pair(new House(NULL, 0, 0, (*itr).substr((*itr).find_last_of("/\\") + 1)), err));
			continue;
		}
		rows = atoi(s_rows.c_str());
		getline(fin, s_cols);
		if (!is_number(s_cols)) {
			err = "line number 4 in house file shall be a positive number, found: " + s_cols;
			errcnt++;
			houses.insert(std::make_pair(new House(NULL, 0, 0, (*itr).substr((*itr).find_last_of("/\\") + 1)), err));
			continue;
		}
		cols = atoi(s_cols.c_str());
		//allocate memory for the house matrix
		matrix = (char**) malloc(sizeof(char*) * rows);
		for (int i = 0; i < rows; i++) {
			matrix[i] = (char*) malloc(sizeof(char) * cols);
			getline(fin, line);
			int m = MIN((int )line.length(), cols);
			line.copy(matrix[i], m, 0);
			if (m < cols)
				for (int k = m; k < cols; k++)
					matrix[i][k] = SPACE;
		}
		//create the house object adn check validity
		House* house = new House(matrix, cols, rows, (*itr).substr((*itr).find_last_of("/\\") + 1));
		if (house->getErr() == 0) {		//no docking stat
			houses.insert(std::make_pair(house, "missing docking station (no D in house)"));
			errcnt++;
		}
		if (house->getErr() > 1) {		//too many docking stat
			houses.insert(std::make_pair(house, "too many docking stations (more than one D in house)"));
			errcnt++;
		} else
			//1 docking
			houses.insert(std::make_pair(house, ""));
	}
//if all files are bad
	if (errcnt == houses.size()) {
		parent.setErr(true);
		cout << "All house files in target folder " << parent.getHousePath() << " cannot be opened or are invalid:" << endl;
		for (map<House*, string>::const_iterator itr = houses.begin(); itr != houses.end(); ++itr) {
			cout << (*itr).first->getName() << ": " << (*itr).second << endl;
		}
	}
}