(svn r21201) -Document: some GRFText methods/fields

pull/155/head
rubidium 14 years ago
parent e52ee78d94
commit 83d1edc2a7

@ -121,6 +121,11 @@ enum GRFExtendedLanguages {
*/ */
struct GRFText { struct GRFText {
public: public:
/**
* Allocate, and assign a new GRFText with the given text.
* @param langid The language of the text.
* @param text The text to store in the new GRFText.
*/
static GRFText *New(byte langid, const char *text) static GRFText *New(byte langid, const char *text)
{ {
return new (strlen(text) + 1) GRFText(langid, text); return new (strlen(text) + 1) GRFText(langid, text);
@ -128,8 +133,8 @@ public:
/** /**
* Create a copy of this GRFText. * Create a copy of this GRFText.
* @param orig the grftext to copy * @param orig the grftext to copy.
* @return an exact copy of the given text * @return an exact copy of the given text.
*/ */
static GRFText *Copy(GRFText *orig) static GRFText *Copy(GRFText *orig)
{ {
@ -139,7 +144,7 @@ public:
/** /**
* Helper allocation function to disallow something. * Helper allocation function to disallow something.
* Don't allow simple 'news'; they wouldn't have enough memory. * Don't allow simple 'news'; they wouldn't have enough memory.
* @param size the amount of space not to allocate * @param size the amount of space not to allocate.
*/ */
void *operator new(size_t size) void *operator new(size_t size)
{ {
@ -147,14 +152,19 @@ public:
} }
/** /**
* Free the memory we allocated * Free the memory we allocated.
* @param p memory to free * @param p memory to free.
*/ */
void operator delete(void *p) void operator delete(void *p)
{ {
free(p); free(p);
} }
private: private:
/**
* Actually construct the GRFText.
* @param langid_ The language of the text.
* @param text_ The text to store in this GRFText.
*/
GRFText(byte langid_, const char *text_) : next(NULL), langid(langid_) GRFText(byte langid_, const char *text_) : next(NULL), langid(langid_)
{ {
strcpy(text, text_); strcpy(text, text_);
@ -172,9 +182,9 @@ private:
} }
public: public:
GRFText *next; GRFText *next; ///< The next GRFText in this chain.
byte langid; byte langid; ///< The language associated with this GRFText.
char text[]; char text[]; ///< The actual (translated) text.
}; };

Loading…
Cancel
Save