123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include "Starter.h"
- Starter::Starter( int xSize, int ySize ): m_xSize( xSize ), m_ySize( ySize ) //TODO m_xl(0x0),
- {
- }
- Starter::~Starter()
- {
- //dtor
- }
- void Starter::loadAreas()
- {
- /// Config
- std::string const source("Spawns/spawn1.txt");
- std::ifstream fluxIn(source.c_str());
- int x, y, d;
- /// Attributions
- if (fluxIn)
- {
- //Ouverture fichier succés
- for (int i(0); i<12; i++)
- {
- fluxIn >> x ;
- fluxIn >> y ;
- fluxIn >> d ;
- if ( x < 0 )
- x += m_xSize;
- if ( y < 0 )
- y += m_ySize;
- m_xl.push_back(x);
- m_yl.push_back(y);
- m_dl.push_back(d);
- }
- }
- else
- {
- //Echec ouverture fichier
- std::cout << "ERREUR: impossible de lire le fichier " << source << " ." << std::endl;
- /// Spawn à la main
- // 1
- m_xl.push_back(5);
- m_yl.push_back(5);
- m_dl.push_back(BAS);
- // 1
- m_xl.push_back(10);
- m_yl.push_back(5);
- m_dl.push_back(DROITE);
- // 1
- m_xl.push_back(5);
- m_yl.push_back(4);
- m_dl.push_back(HAUT);
- // 1
- m_xl.push_back(5);
- m_yl.push_back(10);
- m_dl.push_back(DROITE);
- // 1
- m_xl.push_back(5);
- m_yl.push_back(15);
- m_dl.push_back(DROITE);
- }
- std::cout << "m_xl.size() " << m_xl.size() << std::endl ;
- std::cout << "m_yl.size() " << m_yl.size() << std::endl ;
- std::cout << "m_dl.size() " << m_dl.size() << std::endl ;
- }
- void Starter::spawnLiners( Liner** linerTab, int nbJoueurs )
- {
- for ( unsigned int i(0); i < nbJoueurs; i ++ )
- {
- linerTab[i]->reset( m_xl[i], m_yl[i], m_dl[i] );
- }
- }
|