1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#ifndef _FLAGS_H
#define _FLAGS_H
#include <stdio.h>
#define DEFAULT_NUM_FLAGS 6
#ifndef CONVERTER
#include "errlog.h"
class Builder;
#else
class ErrLog;
#endif
struct save_flags {
long flag6;
long flag5;
long flag4;
long flag3;
long flag2;
long flag1;
};
#ifdef FLAGS_C
int null_frozen[] = { -1 };
#else
extern int null_frozen[];
#endif
struct flag_long_int {
long flags;
flag_long_int *next_flag;
};
class Flags
{
public:
virtual ~Flags();
Flags();
Flags(int the_value);
int copy_flags(Flags *old_flags);
int operator = (Flags *old_flags);
int operator = (flag_long_int *old_flags);
int set_flag(int flag_num);
int get_flag(int flag_num);
int clr_flag(int flag_num);
int write_flag(FILE *the_file);
int read_flags(FILE *the_file, ErrLog *error_log);
#ifndef CONVERTER
int display_flags(Player *the_player, char *the_name,
char *nametable[], char *flagname, int frozen[]);
int display_flags(Builder *the_builder, char *the_name,
char *nametable[], char *flagname, int frozen[]);
#endif
int get_by_name(char *the_name, char *flaglist[]);
flag_long_int *get_flagstruct(void);
int set_all(char *flagnames[]);
int clr_all(char *flagnames[]);
int set_by_table(int flag_table[]);
int copy_from_save_struct(save_flags *the_flags);
int copy_to_save_struct(save_flags *the_flags);
void clr_frozen(int the_list[]);
int is_frozen(int the_list[], int the_flag);
virtual int get_mem_size();
virtual int get_mem_size_dynamic();
int check_null();
private:
int copy_flags(flag_long_int *old_flags);
int num_flags;
flag_long_int *flag_list;
};
#endif
|