I have a character
model class which has this structure:
@interface CharacterModel : NSObject
{
// parent of this character
CharacterModel *parentChar;
// basic details
NSString *fname, *sname, *nick;
NSString *char_type; // categories of characters: dwarf, etc
// health
int health;
// cash
double cash;
double graft;
// flags
bool is_cop, is_player, is_ai, is_playable;
// Skills
int skill_speed;
int skill_stamina;
int skill_aggr;
int skill_another;
int skill_somethingelse;
// Total = 100
// Hidden RPG skills
int corruption;
int greed;
// Rep skills
int reputation;
// Misc. flags
int active, picked, is_locked;
}
The problem are 2 things.
1) I would need to re-write this structure in the @property (nonotomic)... part of the .h file, and I would need to do it again for @synthesize part of the .m file
Is there a way to reduce the need to re-write stuff; can I put all this in a struct or something and then just @synthesize that?
2) The constructor will have a stupidly long function name.
I really, really do not want to be writing a constructor that has hundreds of variables/fields.
ie:
-(id)initCharacter:(NSString *)name, and every other class variable mentioned above ...
Is there are a way around this?
I was thinking of doing a NSMutableDictionary, but you would STILL need to write a constructor with every field you want somewhere.
Any help on this would be great.
Thanks