Añadida la clase item_tracker

This commit is contained in:
2022-07-14 10:36:24 +02:00
parent 6152dc4255
commit e752e90630
7 changed files with 126 additions and 8 deletions

42
source/item_tracker.h Normal file
View File

@@ -0,0 +1,42 @@
#pragma once
#include "ifdefs.h"
#include "utils.h"
#include <string>
#include <vector>
#ifndef ITEM_TRACKER_H
#define ITEM_TRACKER_H
struct item_tracker_t
{
std::string name; // Nombre de la habitación donde se encuentra el objeto
std::vector<SDL_Point> pos; // Lista de objetos cogidos de la habitación
};
// Clase Item_tracker
class Item_tracker
{
private:
std::vector<item_tracker_t> list; // Lista con todos los objetos recogidos
// Busca una entrada en la lista por nombre
int findByName(std::string name);
// Busca una entrada en la lista por posición
int findByPos(int index, SDL_Point pos);
public:
// Constructor
Item_tracker();
// Destructor
~Item_tracker();
// Comprueba si el objeto ya ha sido cogido
bool hasBeenPicked(std::string name, SDL_Point pos);
// Añade el objeto a la lista de objetos cogidos
void addItem(std::string name, SDL_Point pos);
};
#endif