43 lines
952 B
C
43 lines
952 B
C
// Laboratorio 7 - Esercizio 1 - inv.h
|
|
// Matteo Schiff - s295565
|
|
|
|
#ifndef INV_H_DEFINED
|
|
#define INV_H_DEFINED
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#define LEN 50
|
|
#define MIN_STAT 1
|
|
|
|
/* quasi ADT statistiche */
|
|
typedef struct stat_s {
|
|
int hp, mp, atk, def, mag, spr;
|
|
} stat_t;
|
|
|
|
/* quasi ADT oggetto di inventario */
|
|
typedef struct inv_s {
|
|
char nome[LEN];
|
|
char tipo[LEN];
|
|
stat_t stat;
|
|
} inv_t;
|
|
|
|
/* funzioni di input/output delle statistiche */
|
|
void stat_read(FILE *fp, stat_t *statp);
|
|
void stat_print(FILE *fp, stat_t *statp, int soglia);
|
|
|
|
void stat_copy(stat_t *a, stat_t *b);
|
|
void stat_sum(stat_t *a, stat_t *b);
|
|
|
|
/* funzioni di input/output di un oggetto dell'inventario */
|
|
void inv_read(FILE *fp, inv_t *invp);
|
|
void inv_print(FILE *fp, inv_t *invp);
|
|
|
|
/* ritorna il campo stat di un oggetto dell'inventario */
|
|
stat_t inv_getStat(inv_t *invp);
|
|
|
|
/* Si possono aggiungere altre funzioni se ritenute necessarie */
|
|
|
|
#endif
|