Created
December 14, 2011 15:47
-
-
Save angavrilov/1477094 to your computer and use it in GitHub Desktop.
Sample structures from the code generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DF_GENERAL_REF_UNIT_H | |
#define DF_GENERAL_REF_UNIT_H | |
#ifndef DF_GENERAL_REF_H | |
#include "general_ref.h" | |
#endif | |
namespace df { | |
struct general_ref_unit : general_ref { | |
int32_t unit_id; | |
static virtual_identity<general_ref_unit> _identity; | |
protected: | |
virtual ~general_ref_unit() {} | |
}; | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DF_LANGUAGE_WORD_FLAGS_H | |
#define DF_LANGUAGE_WORD_FLAGS_H | |
namespace df { | |
namespace enums { | |
namespace language_word_flags { | |
enum language_word_flags { | |
FRONT_COMPOUND_NOUN_SING, | |
FRONT_COMPOUND_NOUN_PLUR, | |
FRONT_COMPOUND_ADJ, | |
FRONT_COMPOUND_PREFIX, | |
REAR_COMPOUND_NOUN_SING, | |
REAR_COMPOUND_NOUN_PLUR, | |
REAR_COMPOUND_ADJ, | |
THE_NOUN_SING, | |
THE_NOUN_PLUR, | |
THE_COMPOUND_NOUN_SING, | |
THE_COMPOUND_NOUN_PLUR, | |
THE_COMPOUND_ADJ, | |
THE_COMPOUND_PREFIX, | |
OF_NOUN_SING, | |
OF_NOUN_PLUR, | |
STANDARD_VERB, | |
_last_item_of_language_word_flags | |
}; | |
const char *get_key(language_word_flags value); | |
} | |
} | |
using enums::language_word_flags::language_word_flags; | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DF_SQUAD_H | |
#define DF_SQUAD_H | |
#ifndef DF_LANGUAGE_NAME_H | |
#include "language_name.h" | |
#endif | |
#ifndef DF_SQUAD_USE_FLAGS_H | |
#include "squad_use_flags.h" | |
#endif | |
namespace df { | |
struct squad_ammo_spec; | |
struct squad_position; | |
struct squad { | |
int32_t id; | |
language_name name; | |
std::string unk; | |
std::vector<squad_position*> positions; | |
std::vector<void*> unk_9c; | |
struct T_schedule { | |
std::string name; | |
int16_t sleep_mode; | |
int16_t uniform_mode; | |
struct T_orders { | |
void* order; | |
int32_t min_count; | |
std::vector<int32_t> unk_8; | |
int32_t unk_18; | |
}; | |
std::vector<T_orders*> orders; | |
std::vector<int32_t> order_assignments; | |
}; | |
typedef T_schedule T_schedule_1[12]; | |
std::vector<T_schedule_1*> schedule; | |
int32_t cur_alert_idx; | |
struct T_rooms { | |
int32_t building_id; | |
squad_use_flags mode; | |
}; | |
std::vector<T_rooms*> rooms; | |
std::vector<void*> unk_d0; | |
std::vector<void*> unk_e0; | |
int32_t uniform_priority; | |
int32_t activity; | |
std::vector<squad_ammo_spec*> ammunition; | |
std::vector<void*> unk_108; | |
std::vector<void*> unk_118; | |
std::vector<int32_t> ammo_items; | |
std::vector<int32_t> ammo_units; | |
int16_t carry_food; | |
int16_t carry_water; | |
}; | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DF_SQUAD_USE_FLAGS_H | |
#define DF_SQUAD_USE_FLAGS_H | |
namespace df { | |
union squad_use_flags { | |
uint32_t whole; | |
struct { | |
unsigned sleep : 1; | |
unsigned train : 1; | |
unsigned indiv_eq : 1; | |
unsigned squad_eq : 1; | |
} bits; | |
}; | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
#include "general_ref_unit.h" | |
... | |
#include "language_word_flags.h" | |
... | |
namespace df { | |
... | |
virtual_identity<general_ref_unit> general_ref_unit::_identity("general_ref_unit","general_ref_unitst",&general_ref::_identity); | |
... | |
namespace enums { | |
namespace language_word_flags { | |
static const char *_keys[] = { | |
"FRONT_COMPOUND_NOUN_SING", | |
"FRONT_COMPOUND_NOUN_PLUR", | |
"FRONT_COMPOUND_ADJ", | |
"FRONT_COMPOUND_PREFIX", | |
"REAR_COMPOUND_NOUN_SING", | |
"REAR_COMPOUND_NOUN_PLUR", | |
"REAR_COMPOUND_ADJ", | |
"THE_NOUN_SING", | |
"THE_NOUN_PLUR", | |
"THE_COMPOUND_NOUN_SING", | |
"THE_COMPOUND_NOUN_PLUR", | |
"THE_COMPOUND_ADJ", | |
"THE_COMPOUND_PREFIX", | |
"OF_NOUN_SING", | |
"OF_NOUN_PLUR", | |
"STANDARD_VERB", | |
NULL | |
}; | |
const char *get_key(language_word_flags value) { | |
return (value >= 0 && value < _last_item_of_language_word_flags) ? _keys[value-0] : NULL; | |
} | |
} | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment