diff --git a/src/.gitignore b/src/.gitignore index b9d64cc..7eb472b 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -29,6 +29,8 @@ .vs/ /[Tt]mp /[Ee]xes +/[Ee]vents +!/[Ee]vents/noDel.txt !/[Ll]ib !/[Dd]ll diff --git a/src/Events/Login/Login0.json b/src/Events/Login/Login0.json deleted file mode 100644 index ae68737..0000000 --- a/src/Events/Login/Login0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038975, - "eventType": "Login" -} \ No newline at end of file diff --git a/src/Events/Login/Login2.json b/src/Events/Login/Login2.json deleted file mode 100644 index 5fd548d..0000000 --- a/src/Events/Login/Login2.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039749, - "eventType": "Login" -} \ No newline at end of file diff --git a/src/Events/Login/Login3.json b/src/Events/Login/Login3.json deleted file mode 100644 index 2b09ce4..0000000 --- a/src/Events/Login/Login3.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "74-70-FD-38-97-0D", - "idGame": "a", - "timestamp": 1650044458, - "eventType": "Login" -} \ No newline at end of file diff --git a/src/Events/LoginZone/LoginZone0.json b/src/Events/LoginZone/LoginZone0.json deleted file mode 100644 index e9ccb83..0000000 --- a/src/Events/LoginZone/LoginZone0.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038977, - "eventType": "LoginZone", - "zone": 0, - "completed": 1 -} \ No newline at end of file diff --git a/src/Events/LoginZone/LoginZone2.json b/src/Events/LoginZone/LoginZone2.json deleted file mode 100644 index 086cd0e..0000000 --- a/src/Events/LoginZone/LoginZone2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039754, - "eventType": "LoginZone", - "zone": 0, - "completed": 1 -} \ No newline at end of file diff --git a/src/Events/Logout/Logout0.json b/src/Events/Logout/Logout0.json deleted file mode 100644 index 6b3750d..0000000 --- a/src/Events/Logout/Logout0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038997, - "eventType": "Logout" -} \ No newline at end of file diff --git a/src/Events/Logout/Logout2.json b/src/Events/Logout/Logout2.json deleted file mode 100644 index f78e038..0000000 --- a/src/Events/Logout/Logout2.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039797, - "eventType": "Logout" -} \ No newline at end of file diff --git a/src/Events/Logout/Logout3.json b/src/Events/Logout/Logout3.json deleted file mode 100644 index b13b0b1..0000000 --- a/src/Events/Logout/Logout3.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650044463, - "eventType": "Logout" -} \ No newline at end of file diff --git a/src/Events/LogoutZone/LogoutZone0.json b/src/Events/LogoutZone/LogoutZone0.json deleted file mode 100644 index d8d0510..0000000 --- a/src/Events/LogoutZone/LogoutZone0.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038996, - "eventType": "LogoutZone", - "zone": 1, - "next": -2 -} \ No newline at end of file diff --git a/src/Events/LogoutZone/LogoutZone2.json b/src/Events/LogoutZone/LogoutZone2.json deleted file mode 100644 index 31ef3dd..0000000 --- a/src/Events/LogoutZone/LogoutZone2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039796, - "eventType": "LogoutZone", - "zone": 0, - "next": -2 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv0.json b/src/Events/OpenInv/OpenInv0.json deleted file mode 100644 index 7a9254c..0000000 --- a/src/Events/OpenInv/OpenInv0.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038979, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv1.json b/src/Events/OpenInv/OpenInv1.json deleted file mode 100644 index 2984ab4..0000000 --- a/src/Events/OpenInv/OpenInv1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038980, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv10.json b/src/Events/OpenInv/OpenInv10.json deleted file mode 100644 index 6466a45..0000000 --- a/src/Events/OpenInv/OpenInv10.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039780, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv11.json b/src/Events/OpenInv/OpenInv11.json deleted file mode 100644 index 86a00f6..0000000 --- a/src/Events/OpenInv/OpenInv11.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039781, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv2.json b/src/Events/OpenInv/OpenInv2.json deleted file mode 100644 index e342c6f..0000000 --- a/src/Events/OpenInv/OpenInv2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650038982, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv4.json b/src/Events/OpenInv/OpenInv4.json deleted file mode 100644 index a8b1124..0000000 --- a/src/Events/OpenInv/OpenInv4.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039755, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv5.json b/src/Events/OpenInv/OpenInv5.json deleted file mode 100644 index ba456c7..0000000 --- a/src/Events/OpenInv/OpenInv5.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039759, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv6.json b/src/Events/OpenInv/OpenInv6.json deleted file mode 100644 index 4b28697..0000000 --- a/src/Events/OpenInv/OpenInv6.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039760, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv7.json b/src/Events/OpenInv/OpenInv7.json deleted file mode 100644 index f86acd3..0000000 --- a/src/Events/OpenInv/OpenInv7.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039765, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv8.json b/src/Events/OpenInv/OpenInv8.json deleted file mode 100644 index ec185eb..0000000 --- a/src/Events/OpenInv/OpenInv8.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039770, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenInv/OpenInv9.json b/src/Events/OpenInv/OpenInv9.json deleted file mode 100644 index f33fedf..0000000 --- a/src/Events/OpenInv/OpenInv9.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "idUser": "a", - "idGame": "a", - "timestamp": 1650039779, - "eventType": "OpenInv", - "timeOut": 1000, - "equipPot": 0 -} \ No newline at end of file diff --git a/src/Events/OpenShop/OpenShop0.json b/src/Events/OpenShop/OpenShop0.json deleted file mode 100644 index 3fd42b6..0000000 --- a/src/Events/OpenShop/OpenShop0.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650038989, - "eventType": "OpenShop" -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills0.json b/src/Events/OpenSkills/OpenSkills0.json deleted file mode 100644 index 1168217..0000000 --- a/src/Events/OpenSkills/OpenSkills0.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039757, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills1.json b/src/Events/OpenSkills/OpenSkills1.json deleted file mode 100644 index 17e821c..0000000 --- a/src/Events/OpenSkills/OpenSkills1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039760, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills2.json b/src/Events/OpenSkills/OpenSkills2.json deleted file mode 100644 index dac95f0..0000000 --- a/src/Events/OpenSkills/OpenSkills2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039763, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills3.json b/src/Events/OpenSkills/OpenSkills3.json deleted file mode 100644 index 6330f00..0000000 --- a/src/Events/OpenSkills/OpenSkills3.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039764, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills4.json b/src/Events/OpenSkills/OpenSkills4.json deleted file mode 100644 index 76a0f52..0000000 --- a/src/Events/OpenSkills/OpenSkills4.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039766, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/OpenSkills/OpenSkills5.json b/src/Events/OpenSkills/OpenSkills5.json deleted file mode 100644 index 1b45f8c..0000000 --- a/src/Events/OpenSkills/OpenSkills5.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "idUser": "hola", - "idGame": "20012", - "timestamp": 1650039782, - "eventType": "OpenSkills", - "points": 0 -} \ No newline at end of file diff --git a/src/Events/noDel.txt b/src/Events/noDel.txt new file mode 100644 index 0000000..945c9b4 --- /dev/null +++ b/src/Events/noDel.txt @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/src/Sources/Application.cpp b/src/Sources/Application.cpp index 19bb0ac..39d1b6e 100644 --- a/src/Sources/Application.cpp +++ b/src/Sources/Application.cpp @@ -25,11 +25,10 @@ Application::Application(GameStateMachine* state) { Application::~Application() { // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); Logout* logout = (Logout*)(Tracker::CreateNewEvent(timest, gameManager_->getIdUser(), "a", (int)EventInfo::EventType::Logout)); Tracker::TrackEvent(logout); - tracker_->End(); // FLUSH DE PRUEBA - BORRAR + tracker_->End(); tracker_->Free(); delete machine_; @@ -69,9 +68,9 @@ bool Application::initTracker() //USABILIDAD std::string cmd = "getmac"; - std::string filename = "macaddress.txt"; + std::string auxFile = "macaddress.txt"; - system((cmd + ">" + filename).c_str()); + system((cmd + ">" + auxFile).c_str()); std::string line; std::ifstream myfile("macaddress.txt"); @@ -89,13 +88,18 @@ bool Application::initTracker() else std::cout << "Unable to open the file"; - system(("del " + filename).c_str()); + system(("del " + auxFile).c_str()); + + if (gameManager_ == nullptr) { + std::cout << "Error al inicializar el tracker. Gamemanager sin inicializar...\n"; + return false; + } gameManager_->setIdUser(mac); trackerStarted_ = tracker_->Init(PersistenceType::FILE, TypeOfFile::Json, PATH_TRACKER); - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); + Login* login = (Login*)(Tracker::CreateNewEvent(timest, mac, "a", (int)EventInfo::EventType::Login)); Tracker::TrackEvent(login); diff --git a/src/Sources/BeerButton.cpp b/src/Sources/BeerButton.cpp index 625ab1d..2a6f654 100644 --- a/src/Sources/BeerButton.cpp +++ b/src/Sources/BeerButton.cpp @@ -36,7 +36,7 @@ bool BeerButton::update(){ if (!clicked_ && SDL_PointInRect(&mouse, &getDestiny())) { select_ = true; //Cuando se ha clickado - if (input->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) { + if (input->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { app_->getAudioManager()->playChannel(Resources::Shout, 0, Resources::BeerButtonChanel); currentState_->setButtonClick(true); clicked_ = true; diff --git a/src/Sources/Button.cpp b/src/Sources/Button.cpp index 6170892..c44915e 100644 --- a/src/Sources/Button.cpp +++ b/src/Sources/Button.cpp @@ -23,7 +23,7 @@ bool Button::update() { Vector2D aux = input->getRealMousePos(); //Guardas la posicion del raton SDL_Point mouse = { (int)round(aux.getX()), (int)round(aux.getY()) }; - if (SDL_PointInRect(&mouse, &getDestiny()) && input->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) { + if (SDL_PointInRect(&mouse, &getDestiny()) && input->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { if (cbClick_ != nullptr) { cbClick_(app_); //app_->getAudioManager()->playChannel(Resources::Time, 0, Resources::AuxMusicChannel2); diff --git a/src/Sources/CaribbeanIslandState.cpp b/src/Sources/CaribbeanIslandState.cpp index dd418f2..f683d53 100644 --- a/src/Sources/CaribbeanIslandState.cpp +++ b/src/Sources/CaribbeanIslandState.cpp @@ -8,7 +8,7 @@ #include "EndState.h" #include "WinState.h" -CaribbeanIslandState::~CaribbeanIslandState() { +CaribbeanIslandState::~CaribbeanIslandState() { if (currentMap_ != nullptr) delete currentMap_; //Reseteo de misiones if (!gm_->isThatMissionPass(missions::gallegaEnProblemas)) { @@ -24,9 +24,10 @@ void CaribbeanIslandState::update() gm_->setUnlockedIslands(Island::Spooky); // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); - LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); + long long timest = Tracker::GetTimeStamp(); + std::string idUser = gm_->getIdUser(); + std::string idGame = "a"; + LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, idUser, "a", (int)EventInfo::EventType::LogoutZone)); logoutZone->setZone(14); //USABILIDAD logoutZone->setNext(0); @@ -45,7 +46,7 @@ void CaribbeanIslandState::initState() { //Resteo de la isla // USABILIDAD - + gm_->setCurrentZone(Zone::CaribeanA); gm_->setCurrIsland(Island::Caribbean); @@ -53,14 +54,14 @@ void CaribbeanIslandState::initState() //Inicializamos la musica app_->resetMusicChannels(); app_->resetSoundsChannels(); - + //Borramos la lista de objetos del CollisionCtrl collisionCtrl_->clearList(); gm_->setOnShip(false); //Inicializamos el mapa de la zona 1 initZone1(); - + //Inicializamos el hud hud_ = new HUD(app_); player_->initSkills(); @@ -80,12 +81,11 @@ void CaribbeanIslandState::initZone1() //Creamos el mapa currentMap_ = new TiledMap(app_, this, ZONE1_TILEMAP, TILESET_TILE_WIDTH, TILESET_TILE_HEIGHT, TILE_DRAWING_SIZE, app_->getTextureManager()->getTexture(Resources::TextureId::Tileset1), - TILESET_FILS, TILESET_COLS, Vector2D(app_->getWindowWidth() / 2, 0), collisionTilesIdZone1, wallTilesIdZone1); + TILESET_FILS, TILESET_COLS, Vector2D(app_->getWindowWidth() / 2, 0), collisionTilesIdZone1, wallTilesIdZone1); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); - LoginZone*logzone = (LoginZone*)(Tracker::CreateNewEvent(timest,gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); + long long timest = Tracker::GetTimeStamp(); + LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); logzone->setZone(11); Tracker::TrackEvent(logzone); } @@ -98,8 +98,7 @@ void CaribbeanIslandState::initZone2() currentMap_ = new TiledMap(app_, this, ZONE2_TILEMAP, TILESET_TILE_WIDTH, TILESET_TILE_HEIGHT, TILE_DRAWING_SIZE, app_->getTextureManager()->getTexture(Resources::TextureId::Tileset1), TILESET_FILS, TILESET_COLS, Vector2D(app_->getWindowWidth() / 2, 0), collisionTilesIdZone1, wallTilesIdZone2); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); logzone->setZone(12); Tracker::TrackEvent(logzone); @@ -111,16 +110,15 @@ void CaribbeanIslandState::initZone3() if (!gm_->isThatMissionPass(missions::masValePajaroEnMano)) { gm_->setMissionFinished(missions::masValePajaroEnMano, true); } - + //Se inicia la música app_->getAudioManager()->playChannel(Resources::Isle1Zone3, -1, Resources::MainMusicChannel); currentMap_ = new TiledMap(app_, this, ZONE3_TILEMAP, TILESET_TILE_WIDTH, TILESET_TILE_HEIGHT, TILE_DRAWING_SIZE, app_->getTextureManager()->getTexture(Resources::TextureId::Tileset1), TILESET_FILS, TILESET_COLS, Vector2D(app_->getWindowWidth() / 2, 0), collisionTilesIdZone1, wallTilesIdZone2); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); - LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest,gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); + long long timest = Tracker::GetTimeStamp(); + LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); logzone->setZone(13); Tracker::TrackEvent(logzone); } @@ -135,23 +133,20 @@ void CaribbeanIslandState::initBossZone() GameManager::instance()->activeHealthBoss(boss); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); logzone->setZone(14); Tracker::TrackEvent(logzone); } void CaribbeanIslandState::changeZone() -{ - +{ // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); logoutZone->setZone((int)GameManager::instance()->getCurrIsland() * 10 + (int)GameManager::instance()->getCurrentZone()); - logoutZone->setNext((int)GameManager::instance()->getCurrIsland() * 10 + (int)GameManager::instance()->getCurrentZone()+1); + logoutZone->setNext((int)GameManager::instance()->getCurrIsland() * 10 + (int)GameManager::instance()->getCurrentZone() + 1); Tracker::TrackEvent(logoutZone); // @@ -177,5 +172,5 @@ void CaribbeanIslandState::changeZone() hud_->setPlayerInHUD(player_); player_->initSkills(); - + } \ No newline at end of file diff --git a/src/Sources/Chest.cpp b/src/Sources/Chest.cpp index 7537286..cd0461f 100644 --- a/src/Sources/Chest.cpp +++ b/src/Sources/Chest.cpp @@ -45,8 +45,7 @@ void Chest::onCollider() { open = true; app_->getAudioManager()->playChannel(Resources::ChestOpeningAudio, 0, Resources::ChestChannelChannel); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); OpenChest* opchest = (OpenChest*)(Tracker::CreateNewEvent(timest, GameManager::instance()->getIdUser(), "a", (int)EventInfo::EventType::OpenChest)); Tracker::TrackEvent(opchest); // diff --git a/src/Sources/CollisionCtrl.cpp b/src/Sources/CollisionCtrl.cpp index 9730ef0..9ff5525 100644 --- a/src/Sources/CollisionCtrl.cpp +++ b/src/Sources/CollisionCtrl.cpp @@ -173,7 +173,7 @@ void CollisionCtrl::shipCollisions() { //Est� comentado porque falta a�adir Vector2D mousePos = input_->getRelativeMousePos(); //Guardamos la posici�n del rat�n //Comprobamos si se ha hecho click - if (input_->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) { + if (input_->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { SDL_Point mouse = { (int)mousePos.getX(), (int)mousePos.getY() }; //Las ponemos todas a false por si no se ha pulsado ninguno de los objetos for (int i = 0; i < shipObjects_.size(); i++) { diff --git a/src/Sources/GameObject.h b/src/Sources/GameObject.h index 5086841..317f7ef 100644 --- a/src/Sources/GameObject.h +++ b/src/Sources/GameObject.h @@ -7,7 +7,6 @@ //USABILIDAD #include "Tracker.h" #include -#include // using namespace std; diff --git a/src/Sources/GameState.h b/src/Sources/GameState.h index e3bc6ac..a86778d 100644 --- a/src/Sources/GameState.h +++ b/src/Sources/GameState.h @@ -4,8 +4,6 @@ #include "HandleEvents.h" #include "GameManager.h" #include -//USABILIDAD -#include class Draw; class Button; diff --git a/src/Sources/HandleEvents.h b/src/Sources/HandleEvents.h index ac022b4..10b0d49 100644 --- a/src/Sources/HandleEvents.h +++ b/src/Sources/HandleEvents.h @@ -48,19 +48,19 @@ class HandleEvents inline void onMouseButtonChange(SDL_Event& event, bool isDown) { isMouseButton_ = true; if (event.button.button == SDL_BUTTON_LEFT) { - mbState_[LEFT] = isDown; + mbState_[(Uint8)MOUSEBUTTON::LEFT] = isDown; } else if (event.button.button == SDL_BUTTON_MIDDLE) { - mbState_[MIDDLE] = isDown; + mbState_[(Uint8)MOUSEBUTTON::MIDDLE] = isDown; } else if (event.button.button == SDL_BUTTON_RIGHT) { - mbState_[RIGHT] = isDown; + mbState_[(Uint8)MOUSEBUTTON::RIGHT] = isDown; } } public: //enum para diferenciar los botones del raton - enum MOUSEBUTTON : Uint8 { + enum class MOUSEBUTTON : Uint8 { LEFT = 0, MIDDLE = 1, RIGHT = 2 }; @@ -144,12 +144,7 @@ class HandleEvents } //devuelve el estado del boton que le pases por paremtro - inline bool getMouseButtonState(MOUSEBUTTON button) { - return mbState_[button]; - } - - //devuelve el estado del boton que le pases por paremtro - inline int getMouseButtonState(int button) { //No s� usar el MOUSEBUTTON xD + inline bool getMouseButtonState(Uint8 button) { return mbState_[button]; } #pragma endregion diff --git a/src/Sources/Inventory.cpp b/src/Sources/Inventory.cpp index 715f021..4e6629b 100644 --- a/src/Sources/Inventory.cpp +++ b/src/Sources/Inventory.cpp @@ -116,8 +116,7 @@ void Inventory::initState() { descriptionBox = new TextBox(app_, descriptionPoint); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); openInv = (OpenInv*)(Tracker::CreateNewEvent(timest,gm_->getIdUser(), "a", (int)EventInfo::EventType::OpenInv)); // @@ -655,8 +654,8 @@ Inventory::~Inventory() { delete equipment_.potion2_; delete descriptionBox; //USABILIDAD - openInv->setTimeOut(std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count()); + long long timeOut = Tracker::GetTimeStamp(); + openInv->setTimeOut(timeOut); openInv->setEquipPot(equipPot); Tracker::TrackEvent(openInv); } diff --git a/src/Sources/InventoryButton.cpp b/src/Sources/InventoryButton.cpp index edb4162..ac3a24e 100644 --- a/src/Sources/InventoryButton.cpp +++ b/src/Sources/InventoryButton.cpp @@ -107,7 +107,7 @@ bool InventoryButton::update() { HandleEvents* input = HandleEvents::instance(); Vector2D aux = input->getRealMousePos(); SDL_Point mouse = { (int)round(aux.getX()), (int)round(aux.getY()) }; - if (SDL_PointInRect(&mouse, &getDestiny()) && input->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) { + if (SDL_PointInRect(&mouse, &getDestiny()) && input->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { callBackInventory_(app_, this); return true; } diff --git a/src/Sources/PauseState.cpp b/src/Sources/PauseState.cpp index e8969fa..f4796b3 100644 --- a/src/Sources/PauseState.cpp +++ b/src/Sources/PauseState.cpp @@ -23,8 +23,7 @@ void PauseState::showControls(Application* app) { void PauseState::goMainMenuState(Application* app) { // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, GameManager::instance()->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); if (!GameManager::instance()->getStayShip()) { diff --git a/src/Sources/Player.cpp b/src/Sources/Player.cpp index a858c34..52668d2 100644 --- a/src/Sources/Player.cpp +++ b/src/Sources/Player.cpp @@ -570,8 +570,7 @@ void Player::dieAnim() dead_ = true; // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); logoutZone->setZone((int) GameManager::instance()->getCurrIsland() *10 +(int)GameManager::instance()->getCurrentZone()); logoutZone->setNext(-1); @@ -617,8 +616,7 @@ void Player::checkInput() } //USABILIDAD if (auxskill != nullptr) { - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); UseSkill* usSkill = (UseSkill*)Tracker::CreateNewEvent(timest,gm_->getIdUser(), "20012", (int)EventInfo::EventType::UseSkill); usSkill->setZone((int)auxskill->getSkillType() * 10 + (int)auxskill->getSkillBranch()); Tracker::TrackEvent(usSkill); @@ -640,13 +638,13 @@ void Player::checkInput() if (eventHandler_->isKeyDown(SDL_SCANCODE_SPACE)) shout(); //Disparo - if (eventHandler_->getMouseButtonState(HandleEvents::MOUSEBUTTON::RIGHT) && !shootCD_.isCooldownActive()) { + if (eventHandler_->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::RIGHT) && !shootCD_.isCooldownActive()) { shootCD_.initCooldown(currStats_.distRate_); initShoot(); } //Ataque/movimiento - if (eventHandler_->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) + if (eventHandler_->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { Enemy* obj; obj = checkAttack(); updateDirVisMouse(); @@ -889,8 +887,7 @@ void Player::usePotion(usable* potion, int key) { case potionType::Health: { if (currStats_.health_ < maxHealth_ * 0.4) { //USABILIDAD - int timest= std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest= Tracker::GetTimeStamp(); UsePot* usPot = (UsePot*)Tracker::CreateNewEvent(timest,gm_->getIdUser(), "20012", (int)EventInfo::EventType::UsePot); Tracker::TrackEvent(usPot); // diff --git a/src/Sources/ShipState.cpp b/src/Sources/ShipState.cpp index f797043..a839a21 100644 --- a/src/Sources/ShipState.cpp +++ b/src/Sources/ShipState.cpp @@ -19,8 +19,7 @@ void ShipState::goIsland(Application* app) GameManager* gm = GameManager::instance(); Island currIsland = gm->getCurrIsland(); // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, gm->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); logoutZone->setZone(0); logoutZone->setNext((int)gm->getCurrIsland() * 10 + 1); @@ -126,8 +125,7 @@ void ShipState::initState() app_->getAudioManager()->playChannel(Resources::ShipTheme, -1, 0); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LoginZone* logzone = (LoginZone*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::LoginZone)); logzone->setZone(0); logzone->setCompleted(true); diff --git a/src/Sources/SkillButton.cpp b/src/Sources/SkillButton.cpp index b69542a..844bb3b 100644 --- a/src/Sources/SkillButton.cpp +++ b/src/Sources/SkillButton.cpp @@ -12,7 +12,7 @@ bool SkillButton::update() { SDL_Point mouse = { (int)round(handleEvents_->getRealMousePos().getX()), (int)round(handleEvents_->getRealMousePos().getY()) }; - if (unlocked_ && SDL_PointInRect(&mouse, &getDestiny()) && handleEvents_->getMouseButtonState(HandleEvents::MOUSEBUTTON::LEFT)) { + if (unlocked_ && SDL_PointInRect(&mouse, &getDestiny()) && handleEvents_->getMouseButtonState((Uint8)HandleEvents::MOUSEBUTTON::LEFT)) { callbackSkill_(app_, this); return true; } diff --git a/src/Sources/SkillState.cpp b/src/Sources/SkillState.cpp index bd52831..88c84a3 100644 --- a/src/Sources/SkillState.cpp +++ b/src/Sources/SkillState.cpp @@ -29,8 +29,7 @@ void SkillState::initState() { createBars(); createSkillsIcons(); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); openSkills = (OpenSkills*)Tracker::CreateNewEvent(timest,gm_->getIdUser(), "20012", (int)EventInfo::EventType::OpenSkills); pointsInOpen= GameManager::instance()->getAchievementPoints(); diff --git a/src/Sources/TextBox.cpp b/src/Sources/TextBox.cpp index 4cfa470..9a4713d 100644 --- a/src/Sources/TextBox.cpp +++ b/src/Sources/TextBox.cpp @@ -24,8 +24,7 @@ void TextBox::goShopState(Application* app) dynamic_cast(GameManager::instance()->getPlayer())->stop(); app->getGameStateMachine()->pushState(new ShopState(app)); //USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); OpenShop* openShop = (OpenShop*)Tracker::CreateNewEvent(timest, GameManager::instance()->getIdUser(), "20012", (int)EventInfo::EventType::OpenShop); Tracker::TrackEvent(openShop); // @@ -55,8 +54,7 @@ void TextBox::goToShipState(Application* app) GameManager::instance()->resetIsland(); // USABILIDAD - int timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + long long timest = Tracker::GetTimeStamp(); LogoutZone* logoutZone = (LogoutZone*)(Tracker::CreateNewEvent(timest, GameManager::instance()->getIdUser(), "a", (int)EventInfo::EventType::LogoutZone)); logoutZone->setZone((int)GameManager::instance()->getCurrIsland() * 10 + (int)GameManager::instance()->getCurrentZone()); logoutZone->setNext(0); @@ -367,7 +365,7 @@ void TextBox::dialogElderMan(int num) { text.render(lineSpacing, dest.y + lineSpacing * 2); break; } - + break; case Island::Spooky: switch (num) { @@ -475,7 +473,7 @@ void TextBox::dialogElderMan(int num) { text.loadFromText(app_->getRenderer(), "y uno de ellos no se lo deseo ni a mis enemigos... ", app_->getFontManager()->getFont(Resources::FontId::RETRO), { COLOR(0x00000000) }); text.render(lineSpacing, dest.y + lineSpacing * 3); - + break; default: break; } diff --git a/src/Sources/tutorialState.cpp b/src/Sources/tutorialState.cpp index 8bae88b..20efe58 100644 --- a/src/Sources/tutorialState.cpp +++ b/src/Sources/tutorialState.cpp @@ -19,8 +19,7 @@ void tutorialState::update() //crear botella if (!bottleCreated_) { //USABILIDAD - timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timest = Tracker::GetTimeStamp(); tutoTask1 = (TutoTask*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::TutoTask)); tutoTask1->setName("Aprender a disparar."); createBottle(); @@ -29,16 +28,14 @@ void tutorialState::update() //Aprender el ataque a melee case 2: //USABILIDAD - timeOut = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timeOut = Tracker::GetTimeStamp(); tutoTask1->setTimeOut(timeOut); Tracker::TrackEvent(tutoTask1); //crear dummy if (!dummyCreated_) { //USABILIDAD - timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timest = Tracker::GetTimeStamp(); tutoTask2 = (TutoTask*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::TutoTask)); tutoTask2->setName("Aprender ataque melee."); @@ -50,14 +47,12 @@ void tutorialState::update() //Apreder a usar habilidades case 3: //USABILIDAD - timeOut = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timeOut = Tracker::GetTimeStamp(); tutoTask2->setTimeOut(timeOut); Tracker::TrackEvent(tutoTask2); //USABILIDAD - timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timest = Tracker::GetTimeStamp(); tutoTask3 = (TutoTask*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::TutoTask)); tutoTask3->setName("Aprender a usar habilidades."); //crear dummy @@ -67,20 +62,18 @@ void tutorialState::update() createDummy(); } break; - - //Aprender los cofres + + //Aprender los cofres case 4: //USABILIDAD - timeOut = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timeOut = Tracker::GetTimeStamp(); tutoTask3->setTimeOut(timeOut); Tracker::TrackEvent(tutoTask3); //crear cofre con oro if (!chestCreated_) { //USABILIDAD - timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timest = Tracker::GetTimeStamp(); tutoTask4 = (TutoTask*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::TutoTask)); tutoTask4->setName("Aprender los cofres."); @@ -96,17 +89,15 @@ void tutorialState::update() GameManager::instance()->nextPhaseVenancio(); } break; - //Aprender sobre pociones + //Aprender sobre pociones case 5: //USABILIDAD - timeOut = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timeOut = Tracker::GetTimeStamp(); tutoTask4->setTimeOut(timeOut); Tracker::TrackEvent(tutoTask4); //USABILIDAD - timest = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timest = Tracker::GetTimeStamp(); tutoTask5 = (TutoTask*)(Tracker::CreateNewEvent(timest, gm_->getIdUser(), "a", (int)EventInfo::EventType::TutoTask)); tutoTask5->setName("Aprender sobre pociones."); @@ -118,8 +109,7 @@ void tutorialState::update() { GameManager::instance()->nextPhaseVenancio(); //USABILIDAD - timeOut = std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()).count(); + timeOut = Tracker::GetTimeStamp(); tutoTask5->setTimeOut(timeOut); Tracker::TrackEvent(tutoTask5); } @@ -131,11 +121,9 @@ void tutorialState::update() void tutorialState::createBottle() { - - bottleCreated_ = true; bottlePos_ = Vector2D(app_->getWindowWidth() / 3, app_->getWindowHeight() / 7); - tutorialObject* bottle = new tutorialObject(app_, bottlePos_, Vector2D(50, 60), app_->getTextureManager()->getTexture(Resources::Bottle),1); + tutorialObject* bottle = new tutorialObject(app_, bottlePos_, Vector2D(50, 60), app_->getTextureManager()->getTexture(Resources::Bottle), 1); collisionCtrl_->setBottle(bottle); dynamic_cast(app_->getCurrState())->addEnemy(bottle); collisionCtrl_->addEnemy(bottle); @@ -145,7 +133,7 @@ void tutorialState::createDummy() { dummyCreated_ = true; dummyPos_ = Vector2D(app_->getWindowWidth() / 3, app_->getWindowHeight() * 7 / 10); - tutorialObject* dummy = new tutorialObject(app_, dummyPos_, Vector2D(100, 100), app_->getTextureManager()->getTexture(Resources::Dummy),2); + tutorialObject* dummy = new tutorialObject(app_, dummyPos_, Vector2D(100, 100), app_->getTextureManager()->getTexture(Resources::Dummy), 2); collisionCtrl_->setDummy(dummy); addEnemy(dummy); collisionCtrl_->addEnemy(dummy); @@ -154,7 +142,9 @@ void tutorialState::createDummy() void tutorialState::createChest() { chestCreated_ = true; - Chest* chest = new Chest(app_, Vector2D(app_->getWindowWidth() * 2 / 3, app_->getWindowHeight() / 6), Vector2D(150,150), 100); + double x = app_->getWindowWidth() * 2 / 3; + double y = app_->getWindowHeight() / 6; + Chest* chest = new Chest(app_, Vector2D(x, y), Vector2D(150, 150), 100); //collisionCtrl_->addChest(chest); addRenderUpdateLists(chest); } \ No newline at end of file diff --git a/src/Sources/tutorialState.h b/src/Sources/tutorialState.h index bd09267..f649ed3 100644 --- a/src/Sources/tutorialState.h +++ b/src/Sources/tutorialState.h @@ -35,12 +35,12 @@ class tutorialState : public ShipState { const int POTION_COST = 250; //USABILIDAD - TutoTask* tutoTask1; - TutoTask* tutoTask2; - TutoTask* tutoTask3; - TutoTask* tutoTask4; - TutoTask* tutoTask5; + TutoTask* tutoTask1 = nullptr; + TutoTask* tutoTask2 = nullptr; + TutoTask* tutoTask3 = nullptr; + TutoTask* tutoTask4 = nullptr; + TutoTask* tutoTask5 = nullptr; - int timest; - int timeOut; + long long timest = 0; + long long timeOut = 0; }; \ No newline at end of file diff --git a/src/deps/UsabilidadTelemetria b/src/deps/UsabilidadTelemetria index 804ae5d..925c948 160000 --- a/src/deps/UsabilidadTelemetria +++ b/src/deps/UsabilidadTelemetria @@ -1 +1 @@ -Subproject commit 804ae5d72b1873ca100574e1a66c28e7cbbf3fc7 +Subproject commit 925c948c124ed9a721b99d84906bc76b32948f46 diff --git a/src/lib/tracker/Win32/Debug/TrackerEvent_d.lib b/src/lib/tracker/Win32/Debug/TrackerEvent_d.lib new file mode 100644 index 0000000..c67788a Binary files /dev/null and b/src/lib/tracker/Win32/Debug/TrackerEvent_d.lib differ diff --git a/src/lib/tracker/Win32/Debug/TrackerGrupo02_d.lib b/src/lib/tracker/Win32/Debug/TrackerGrupo02_d.lib new file mode 100644 index 0000000..bf96fd2 Binary files /dev/null and b/src/lib/tracker/Win32/Debug/TrackerGrupo02_d.lib differ diff --git a/src/lib/tracker/Win32/Release/TrackerEvent.lib b/src/lib/tracker/Win32/Release/TrackerEvent.lib new file mode 100644 index 0000000..351376a Binary files /dev/null and b/src/lib/tracker/Win32/Release/TrackerEvent.lib differ diff --git a/src/lib/tracker/Win32/Release/TrackerGrupo02.lib b/src/lib/tracker/Win32/Release/TrackerGrupo02.lib new file mode 100644 index 0000000..220ffa4 Binary files /dev/null and b/src/lib/tracker/Win32/Release/TrackerGrupo02.lib differ diff --git a/src/lib/tracker/x64/Debug/TrackerEvent_d.lib b/src/lib/tracker/x64/Debug/TrackerEvent_d.lib index b8d2422..8523779 100644 Binary files a/src/lib/tracker/x64/Debug/TrackerEvent_d.lib and b/src/lib/tracker/x64/Debug/TrackerEvent_d.lib differ diff --git a/src/lib/tracker/x64/Debug/TrackerGrupo02_d.lib b/src/lib/tracker/x64/Debug/TrackerGrupo02_d.lib index ae2fb93..4326fba 100644 Binary files a/src/lib/tracker/x64/Debug/TrackerGrupo02_d.lib and b/src/lib/tracker/x64/Debug/TrackerGrupo02_d.lib differ diff --git a/src/lib/tracker/x64/Release/TrackerEvent.lib b/src/lib/tracker/x64/Release/TrackerEvent.lib index 7097c39..d1c0ce2 100644 Binary files a/src/lib/tracker/x64/Release/TrackerEvent.lib and b/src/lib/tracker/x64/Release/TrackerEvent.lib differ diff --git a/src/lib/tracker/x64/Release/TrackerGrupo02.lib b/src/lib/tracker/x64/Release/TrackerGrupo02.lib index 5e797db..f1cd263 100644 Binary files a/src/lib/tracker/x64/Release/TrackerGrupo02.lib and b/src/lib/tracker/x64/Release/TrackerGrupo02.lib differ