Correct multi-byte handling in DateToString().
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1846 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -789,7 +789,7 @@ ShowSummary (SUMMARY_DESC *pSD)
|
||||
QUEUE player_q;
|
||||
CONTEXT OldContext;
|
||||
SIS_STATE SaveSS;
|
||||
UNICODE buf[80];
|
||||
unsigned char buf[80];
|
||||
|
||||
SaveSS = GlobData.SIS_state;
|
||||
player_q = GLOBAL (built_ship_q);
|
||||
@@ -810,7 +810,8 @@ ShowSummary (SUMMARY_DESC *pSD)
|
||||
MAX_BUILT_SHIPS, sizeof (SHIP_FRAGMENT));
|
||||
for (i = 0; i < pSD->NumShips; ++i)
|
||||
CloneShipFragment (pSD->ShipList[i], &GLOBAL (built_ship_q), 0);
|
||||
DateToString (buf, pSD->month_index, pSD->day_index, pSD->year_index),
|
||||
DateToString (buf, sizeof buf,
|
||||
pSD->month_index, pSD->day_index, pSD->year_index),
|
||||
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||
DrawStatusMessage (buf);
|
||||
UninitQueue (&GLOBAL (built_ship_q));
|
||||
@@ -1146,7 +1147,8 @@ Restart:
|
||||
RECT r;
|
||||
TEXT t;
|
||||
BYTE i, SHIFT;
|
||||
UNICODE buf[80],buf2[15];
|
||||
UNICODE buf[80];
|
||||
unsigned char buf2[15];
|
||||
LockMutex (GraphicsLock);
|
||||
|
||||
BatchGraphics ();
|
||||
@@ -1224,7 +1226,7 @@ ChangeGameSelection:
|
||||
wsprintf (buf, "Empty Slot");
|
||||
else
|
||||
{
|
||||
DateToString (buf2,
|
||||
DateToString (buf2, sizeof buf2,
|
||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].month_index,
|
||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].day_index,
|
||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index);
|
||||
|
||||
+6
-22
@@ -225,28 +225,12 @@ SetContextClipRect (NULL_PTR);
|
||||
}
|
||||
|
||||
void
|
||||
DateToString (UNICODE *buf, BYTE month_index, BYTE day_index, COUNT
|
||||
year_index)
|
||||
DateToString (unsigned char *buf, size_t bufLen,
|
||||
BYTE month_index, BYTE day_index, COUNT year_index)
|
||||
{
|
||||
COUNT i;
|
||||
|
||||
wstrcpy (buf, GAME_STRING (MONTHS_STRING_BASE + month_index - 1));
|
||||
buf[3] = ' ';
|
||||
i = day_index;
|
||||
buf[5] = (UNICODE)((i % 10) + '0');
|
||||
i /= 10;
|
||||
buf[4] = (UNICODE)((i % 10) + '0');
|
||||
buf[6] = '_';
|
||||
|
||||
i = year_index;
|
||||
buf[10] = (UNICODE)((i % 10) + '0');
|
||||
i /= 10;
|
||||
buf[9] = (UNICODE)((i % 10) + '0');
|
||||
i /= 10;
|
||||
buf[8] = (UNICODE)((i % 10) + '0');
|
||||
i /= 10;
|
||||
buf[7] = (UNICODE)((i % 10) + '0');
|
||||
buf[11] = '\0';
|
||||
snprintf (buf, bufLen, "%s %02d_%04d",
|
||||
GAME_STRING (MONTHS_STRING_BASE + month_index - 1),
|
||||
day_index, year_index);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -291,7 +275,7 @@ DrawStatusMessage (UNICODE *pStr)
|
||||
}
|
||||
else if (pStr == 0)
|
||||
{
|
||||
DateToString (buf,
|
||||
DateToString (buf, sizeof buf,
|
||||
GLOBAL (GameClock.month_index),
|
||||
GLOBAL (GameClock.day_index),
|
||||
GLOBAL (GameClock.year_index));
|
||||
|
||||
@@ -256,8 +256,8 @@ extern void DrawHyperCoords (POINT puniverse);
|
||||
extern void DrawSISTitle (UNICODE *pStr);
|
||||
extern void DrawSISMessage (UNICODE *pStr);
|
||||
extern void DrawGameDate (void);
|
||||
extern void DateToString (UNICODE *buf, BYTE month_index, BYTE day_index,
|
||||
COUNT year_index);
|
||||
extern void DateToString (unsigned char *buf, size_t bufLen,
|
||||
BYTE month_index, BYTE day_index, COUNT year_index);
|
||||
extern void DrawStatusMessage (UNICODE *pStr);
|
||||
extern void DrawLanders (void);
|
||||
extern void DrawStorageBays (BOOLEAN Refresh);
|
||||
|
||||
Reference in New Issue
Block a user