s/formated/formatted/
This commit is contained in:
parent
a33f7a65b6
commit
6a8de1a518
4 changed files with 55 additions and 55 deletions
src
|
@ -265,7 +265,7 @@ typedef struct _content_type_ {
|
|||
int Index; ///< Index of the variable to show.
|
||||
EnumVariable Component; ///< Component of the variable.
|
||||
char Centered; ///< if true, center the display.
|
||||
} FormatedText; ///< Show formated text with variable value.
|
||||
} FormattedText; ///< Show formatted text with variable value.
|
||||
struct {
|
||||
char* Format; ///< Text to display
|
||||
int Font; ///< Font to use.
|
||||
|
@ -274,7 +274,7 @@ typedef struct _content_type_ {
|
|||
int Index2; ///< Index of the variable to show.
|
||||
EnumVariable Component2; ///< Component of the variable.
|
||||
char Centered; ///< if true, center the display.
|
||||
} FormatedText2; ///< Show formated text with 2 variable value.
|
||||
} FormattedText2; ///< Show formatted text with 2 variable value.
|
||||
struct {
|
||||
EnumUnit UnitRef; ///< Which unit icon to display.(itself, container, ...)
|
||||
} Icon; ///< Show icon of the unit
|
||||
|
@ -567,8 +567,8 @@ extern void ViewportSetViewpoint(Viewport* vp, int x, int y, int offsetx, int of
|
|||
extern void ViewportCenterViewpoint(Viewport* vp, int x, int y, int offsetx, int offsety);
|
||||
|
||||
extern FDrawData DrawSimpleText;
|
||||
extern FDrawData DrawFormatedText;
|
||||
extern FDrawData DrawFormatedText2;
|
||||
extern FDrawData DrawFormattedText;
|
||||
extern FDrawData DrawFormattedText2;
|
||||
extern FDrawData DrawPanelIcon;
|
||||
extern FDrawData DrawLifeBar;
|
||||
extern FDrawData DrawCompleteBar;
|
||||
|
|
|
@ -365,7 +365,7 @@ void DrawSimpleText(const Unit* unit, ContentType* content, int defaultfont)
|
|||
}
|
||||
|
||||
/**
|
||||
** Draw formated text with variable value.
|
||||
** Draw formatted text with variable value.
|
||||
**
|
||||
** @param unit unit with variable to show.
|
||||
** @param content extra data.
|
||||
|
@ -375,7 +375,7 @@ void DrawSimpleText(const Unit* unit, ContentType* content, int defaultfont)
|
|||
** @note text must have exactly 1 %d.
|
||||
** @bug if text format is incorrect.
|
||||
*/
|
||||
void DrawFormatedText(const Unit* unit, ContentType* content, int defaultfont)
|
||||
void DrawFormattedText(const Unit* unit, ContentType* content, int defaultfont)
|
||||
{
|
||||
const char* text; // Format of the Text to display.
|
||||
int font; // Font to use.
|
||||
|
@ -384,16 +384,16 @@ void DrawFormatedText(const Unit* unit, ContentType* content, int defaultfont)
|
|||
|
||||
Assert(content);
|
||||
Assert(unit);
|
||||
text = content->Data.FormatedText.Format;
|
||||
font = content->Data.FormatedText.Font;
|
||||
text = content->Data.FormattedText.Format;
|
||||
font = content->Data.FormattedText.Font;
|
||||
if (font == -1) {
|
||||
font = defaultfont;
|
||||
}
|
||||
Assert(font != -1);
|
||||
index = content->Data.FormatedText.Index;
|
||||
index = content->Data.FormattedText.Index;
|
||||
Assert(0 <= index && index < UnitTypeVar.NumberVariable);
|
||||
sprintf(buf, text, GetComponent(unit, index, content->Data.FormatedText.Component));
|
||||
if (content->Data.FormatedText.Centered) {
|
||||
sprintf(buf, text, GetComponent(unit, index, content->Data.FormattedText.Component));
|
||||
if (content->Data.FormattedText.Centered) {
|
||||
VideoDrawTextCentered(content->PosX, content->PosY, font, buf);
|
||||
} else {
|
||||
VideoDrawText(content->PosX, content->PosY, font, buf);
|
||||
|
@ -401,7 +401,7 @@ void DrawFormatedText(const Unit* unit, ContentType* content, int defaultfont)
|
|||
}
|
||||
|
||||
/**
|
||||
** Draw formated text with variable value.
|
||||
** Draw formatted text with variable value.
|
||||
**
|
||||
** @param unit unit with variable to show.
|
||||
** @param content extra data.
|
||||
|
@ -412,7 +412,7 @@ void DrawFormatedText(const Unit* unit, ContentType* content, int defaultfont)
|
|||
** @bug if text format is incorrect.
|
||||
** @bug if sizeof(int) != sizeof(char*) for sprintf.
|
||||
*/
|
||||
void DrawFormatedText2(const Unit* unit, ContentType* content, int defaultfont)
|
||||
void DrawFormattedText2(const Unit* unit, ContentType* content, int defaultfont)
|
||||
{
|
||||
const char* text; // Format of the Text to display.
|
||||
int font; // Font to use.
|
||||
|
@ -422,17 +422,17 @@ void DrawFormatedText2(const Unit* unit, ContentType* content, int defaultfont)
|
|||
|
||||
Assert(content);
|
||||
Assert(unit);
|
||||
text = content->Data.FormatedText2.Format;
|
||||
font = content->Data.FormatedText2.Font;
|
||||
text = content->Data.FormattedText2.Format;
|
||||
font = content->Data.FormattedText2.Font;
|
||||
if (font == -1) {
|
||||
font = defaultfont;
|
||||
}
|
||||
Assert(font != -1);
|
||||
index1 = content->Data.FormatedText2.Index1;
|
||||
index2 = content->Data.FormatedText2.Index2;
|
||||
sprintf(buf, text, GetComponent(unit, index1, content->Data.FormatedText2.Component1),
|
||||
GetComponent(unit, index2, content->Data.FormatedText2.Component2));
|
||||
if (content->Data.FormatedText2.Centered) {
|
||||
index1 = content->Data.FormattedText2.Index1;
|
||||
index2 = content->Data.FormattedText2.Index2;
|
||||
sprintf(buf, text, GetComponent(unit, index1, content->Data.FormattedText2.Component1),
|
||||
GetComponent(unit, index2, content->Data.FormattedText2.Component2));
|
||||
if (content->Data.FormattedText2.Centered) {
|
||||
VideoDrawTextCentered(content->PosX, content->PosY, font, buf);
|
||||
} else {
|
||||
VideoDrawText(content->PosX, content->PosY, font, buf);
|
||||
|
|
|
@ -1895,71 +1895,71 @@ static int CclDefinePanelContents(lua_State* l)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(key, "FormatedText")) {
|
||||
content->DrawData = DrawFormatedText;
|
||||
} else if (!strcmp(key, "FormattedText")) {
|
||||
content->DrawData = DrawFormattedText;
|
||||
Assert(lua_istable(l, -1));
|
||||
// Invalid value by default.
|
||||
content->Data.FormatedText.Index = -1;
|
||||
content->Data.FormatedText.Font = -1;
|
||||
content->Data.FormattedText.Index = -1;
|
||||
content->Data.FormattedText.Font = -1;
|
||||
for (lua_pushnil(l); lua_next(l, -2); lua_pop(l, 1)) {
|
||||
key = LuaToString(l, -2);
|
||||
if (!strcmp(key, "Format")) {
|
||||
content->Data.FormatedText.Format = strdup(LuaToString(l, -1));
|
||||
content->Data.FormattedText.Format = strdup(LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Font")) {
|
||||
content->Data.FormatedText.Font = FontByIdent(LuaToString(l, -1));
|
||||
content->Data.FormattedText.Font = FontByIdent(LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Variable")) {
|
||||
content->Data.FormatedText.Index = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormatedText.Index == -1) {
|
||||
content->Data.FormattedText.Index = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormattedText.Index == -1) {
|
||||
LuaError(l, "unknown variable '%s'" _C_ LuaToString(l, -1));
|
||||
}
|
||||
} else if (!strcmp(key, "Component")) {
|
||||
content->Data.FormatedText.Component = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormattedText.Component = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Centered")) {
|
||||
content->Data.FormatedText.Centered = LuaToBoolean(l, -1);
|
||||
content->Data.FormattedText.Centered = LuaToBoolean(l, -1);
|
||||
} else {
|
||||
LuaError(l, "'%s' invalid for method 'FormatedText' in DefinePanels" _C_ key);
|
||||
LuaError(l, "'%s' invalid for method 'FormattedText' in DefinePanels" _C_ key);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(key, "FormatedText2")) {
|
||||
content->DrawData = DrawFormatedText2;
|
||||
} else if (!strcmp(key, "FormattedText2")) {
|
||||
content->DrawData = DrawFormattedText2;
|
||||
Assert(lua_istable(l, -1));
|
||||
// Invalid value by default.
|
||||
content->Data.FormatedText2.Index1 = -1;
|
||||
content->Data.FormatedText2.Index2 = -1;
|
||||
content->Data.FormatedText2.Font = -1;
|
||||
content->Data.FormattedText2.Index1 = -1;
|
||||
content->Data.FormattedText2.Index2 = -1;
|
||||
content->Data.FormattedText2.Font = -1;
|
||||
for (lua_pushnil(l); lua_next(l, -2); lua_pop(l, 1)) {
|
||||
key = LuaToString(l, -2);
|
||||
if (!strcmp(key, "Format")) {
|
||||
content->Data.FormatedText2.Format = strdup(LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Format = strdup(LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Font")) {
|
||||
content->Data.FormatedText2.Font = FontByIdent(LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Font = FontByIdent(LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Variable")) {
|
||||
content->Data.FormatedText2.Index1 = GetVariableIndex(LuaToString(l, -1));
|
||||
content->Data.FormatedText2.Index2 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormatedText2.Index1 == -1) {
|
||||
content->Data.FormattedText2.Index1 = GetVariableIndex(LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Index2 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormattedText2.Index1 == -1) {
|
||||
LuaError(l, "unknown variable '%s'" _C_ LuaToString(l, -1));
|
||||
}
|
||||
} else if (!strcmp(key, "Component")) {
|
||||
content->Data.FormatedText2.Component1 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormatedText2.Component2 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Component1 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Component2 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Variable1")) {
|
||||
content->Data.FormatedText2.Index1 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormatedText2.Index1 == -1) {
|
||||
content->Data.FormattedText2.Index1 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormattedText2.Index1 == -1) {
|
||||
LuaError(l, "unknown variable '%s'" _C_ LuaToString(l, -1));
|
||||
}
|
||||
} else if (!strcmp(key, "Component1")) {
|
||||
content->Data.FormatedText2.Component1 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Component1 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Variable2")) {
|
||||
content->Data.FormatedText2.Index2 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormatedText2.Index2 == -1) {
|
||||
content->Data.FormattedText2.Index2 = GetVariableIndex(LuaToString(l, -1));
|
||||
if (content->Data.FormattedText2.Index2 == -1) {
|
||||
LuaError(l, "unknown variable '%s'" _C_ LuaToString(l, -1));
|
||||
}
|
||||
} else if (!strcmp(key, "Component2")) {
|
||||
content->Data.FormatedText2.Component2 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
content->Data.FormattedText2.Component2 = Str2EnumVariable(l, LuaToString(l, -1));
|
||||
} else if (!strcmp(key, "Centered")) {
|
||||
content->Data.FormatedText2.Centered = LuaToBoolean(l, -1);
|
||||
content->Data.FormattedText2.Centered = LuaToBoolean(l, -1);
|
||||
} else {
|
||||
LuaError(l, "'%s' invalid for method 'FormatedText2' in DefinePanels" _C_ key);
|
||||
LuaError(l, "'%s' invalid for method 'FormattedText2' in DefinePanels" _C_ key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -276,10 +276,10 @@ static void CleanContent(ContentType* content)
|
|||
CleanConditionPanel(content->Condition);
|
||||
if (content->DrawData == DrawSimpleText) {
|
||||
free(content->Data.SimpleText.Text);
|
||||
} else if (content->DrawData == DrawFormatedText) {
|
||||
free(content->Data.FormatedText.Format);
|
||||
} else if (content->DrawData == DrawFormatedText2) {
|
||||
free(content->Data.FormatedText2.Format);
|
||||
} else if (content->DrawData == DrawFormattedText) {
|
||||
free(content->Data.FormattedText.Format);
|
||||
} else if (content->DrawData == DrawFormattedText2) {
|
||||
free(content->Data.FormattedText2.Format);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue