-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContinent.cpp
More file actions
47 lines (42 loc) · 1.1 KB
/
Continent.cpp
File metadata and controls
47 lines (42 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* @file Continent.cpp
* @author PROSPERT Nathan & EVOLA Antoine
* @since 22/09/2015
* @brief Implémentation de la classe Continent
**/
#include "Continent.h"
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
//----------------------------------------------------------------------------------------
Continent::Continent(std::string nom)
{
nom_ = nom;
std::string fichier = nom+".txt";
std::string ligne;
std::string lien;
std::string nomterritoire;
int i = 0;
ifstream fic(fichier);
getline(fic,ligne);
while(!fic.eof()){
stringstream ss(ligne);
ss >> lien >> nomterritoire;
lien = "carte/" + nom + "/" + lien;
Territoire region(i,nomterritoire, lien, 0, 0);
listeterritoire_.push_back(region);
++i;
getline(fic,ligne);
}
}
//----------------------------------------------------------------------------------------
Territoire Continent::getlisteterritoire(int i)
{
return listeterritoire_.at(i);
}
//----------------------------------------------------------------------------------------
int Continent::getNbterritoire()
{
return listeterritoire_.size();
}