forked from jaildesigner-jailgames/jaildoctors_dilemma
Añadida la clase item_tracker
This commit is contained in:
42
source/item_tracker.h
Normal file
42
source/item_tracker.h
Normal 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
|
||||
Reference in New Issue
Block a user