Browse Source

Clean up control_WriteStringToBuffer

pull/93/head
Anders Jenbo 7 years ago
parent
commit
ea8eeefc57
  1. 25
      Source/control.cpp
  2. 2
      Source/control.h
  3. 6
      Source/items.cpp

25
Source/control.cpp

@ -1617,20 +1617,21 @@ void FreeControlPan()
MemFreeDbg(pGBoxBuff);
}
int control_WriteStringToBuffer(char *str)
BOOL control_WriteStringToBuffer(BYTE *str)
{
signed int v1; // edx
unsigned char v2; // al
int k;
BYTE ichar;
v1 = 0;
do {
v2 = *str;
if (!*str)
return 1;
++str;
v1 += fontkern[fontframe[gbFontTransTbl[v2]]];
} while (v1 < 125);
return 0;
k = 0;
while (*str) {
ichar = gbFontTransTbl[*str];
str++;
k += fontkern[fontframe[ichar]];
if (k >= 125)
return FALSE;
}
return TRUE;
}
void DrawInfoBox()

2
Source/control.h

@ -83,7 +83,7 @@ void DoAutoMap();
void CheckPanelInfo();
void CheckBtnUp();
void FreeControlPan();
int control_WriteStringToBuffer(char *str);
BOOL control_WriteStringToBuffer(BYTE *str);
void DrawInfoBox();
void control_print_info_str(int y, char *str, BOOLEAN center, int lines);
void PrintGameStr(int x, int y, char *str, int color);

6
Source/items.cpp

@ -1192,7 +1192,7 @@ void GetStaffPower(int i, int lvl, int bs, unsigned char onlygood)
}
v12 = ia;
v13 = item[ia]._iIName;
if (!control_WriteStringToBuffer(item[ia]._iIName)) {
if (!control_WriteStringToBuffer((BYTE *)item[ia]._iIName)) {
strcpy(v13, AllItemsList[item[v12].IDidx].iSName);
if (v5 != -1) {
sprintf(istr, "%s %s", PL_Prefix[v5].PLName, v13);
@ -1241,7 +1241,7 @@ void GetStaffSpell(int i, int lvl, unsigned char onlygood)
goto LABEL_15;
}
sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText);
if (!control_WriteStringToBuffer(istr))
if (!control_WriteStringToBuffer((BYTE *)istr))
sprintf(istr, "Staff of %s", spelldata[bs].sNameText);
strcpy(item[i]._iName, istr);
strcpy(item[i]._iIName, istr);
@ -1835,7 +1835,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, int onlygood)
}
}
}
if (!control_WriteStringToBuffer(item[i]._iIName)) {
if (!control_WriteStringToBuffer((BYTE *)item[i]._iIName)) {
strcpy(item[i]._iIName, AllItemsList[item[i].IDidx].iSName);
if (preidx != -1) {
sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);

Loading…
Cancel
Save