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;
|
QUEUE player_q;
|
||||||
CONTEXT OldContext;
|
CONTEXT OldContext;
|
||||||
SIS_STATE SaveSS;
|
SIS_STATE SaveSS;
|
||||||
UNICODE buf[80];
|
unsigned char buf[80];
|
||||||
|
|
||||||
SaveSS = GlobData.SIS_state;
|
SaveSS = GlobData.SIS_state;
|
||||||
player_q = GLOBAL (built_ship_q);
|
player_q = GLOBAL (built_ship_q);
|
||||||
@@ -810,7 +810,8 @@ ShowSummary (SUMMARY_DESC *pSD)
|
|||||||
MAX_BUILT_SHIPS, sizeof (SHIP_FRAGMENT));
|
MAX_BUILT_SHIPS, sizeof (SHIP_FRAGMENT));
|
||||||
for (i = 0; i < pSD->NumShips; ++i)
|
for (i = 0; i < pSD->NumShips; ++i)
|
||||||
CloneShipFragment (pSD->ShipList[i], &GLOBAL (built_ship_q), 0);
|
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);
|
ClearSISRect (DRAW_SIS_DISPLAY);
|
||||||
DrawStatusMessage (buf);
|
DrawStatusMessage (buf);
|
||||||
UninitQueue (&GLOBAL (built_ship_q));
|
UninitQueue (&GLOBAL (built_ship_q));
|
||||||
@@ -1146,7 +1147,8 @@ Restart:
|
|||||||
RECT r;
|
RECT r;
|
||||||
TEXT t;
|
TEXT t;
|
||||||
BYTE i, SHIFT;
|
BYTE i, SHIFT;
|
||||||
UNICODE buf[80],buf2[15];
|
UNICODE buf[80];
|
||||||
|
unsigned char buf2[15];
|
||||||
LockMutex (GraphicsLock);
|
LockMutex (GraphicsLock);
|
||||||
|
|
||||||
BatchGraphics ();
|
BatchGraphics ();
|
||||||
@@ -1224,7 +1226,7 @@ ChangeGameSelection:
|
|||||||
wsprintf (buf, "Empty Slot");
|
wsprintf (buf, "Empty Slot");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DateToString (buf2,
|
DateToString (buf2, sizeof buf2,
|
||||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].month_index,
|
((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].day_index,
|
||||||
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index);
|
((SUMMARY_DESC *)pMS->CurString)[NewState - SHIFT + i].year_index);
|
||||||
|
|||||||
+6
-22
@@ -225,28 +225,12 @@ SetContextClipRect (NULL_PTR);
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DateToString (UNICODE *buf, BYTE month_index, BYTE day_index, COUNT
|
DateToString (unsigned char *buf, size_t bufLen,
|
||||||
year_index)
|
BYTE month_index, BYTE day_index, COUNT year_index)
|
||||||
{
|
{
|
||||||
COUNT i;
|
snprintf (buf, bufLen, "%s %02d_%04d",
|
||||||
|
GAME_STRING (MONTHS_STRING_BASE + month_index - 1),
|
||||||
wstrcpy (buf, GAME_STRING (MONTHS_STRING_BASE + month_index - 1));
|
day_index, year_index);
|
||||||
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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -291,7 +275,7 @@ DrawStatusMessage (UNICODE *pStr)
|
|||||||
}
|
}
|
||||||
else if (pStr == 0)
|
else if (pStr == 0)
|
||||||
{
|
{
|
||||||
DateToString (buf,
|
DateToString (buf, sizeof buf,
|
||||||
GLOBAL (GameClock.month_index),
|
GLOBAL (GameClock.month_index),
|
||||||
GLOBAL (GameClock.day_index),
|
GLOBAL (GameClock.day_index),
|
||||||
GLOBAL (GameClock.year_index));
|
GLOBAL (GameClock.year_index));
|
||||||
|
|||||||
@@ -256,8 +256,8 @@ extern void DrawHyperCoords (POINT puniverse);
|
|||||||
extern void DrawSISTitle (UNICODE *pStr);
|
extern void DrawSISTitle (UNICODE *pStr);
|
||||||
extern void DrawSISMessage (UNICODE *pStr);
|
extern void DrawSISMessage (UNICODE *pStr);
|
||||||
extern void DrawGameDate (void);
|
extern void DrawGameDate (void);
|
||||||
extern void DateToString (UNICODE *buf, BYTE month_index, BYTE day_index,
|
extern void DateToString (unsigned char *buf, size_t bufLen,
|
||||||
COUNT year_index);
|
BYTE month_index, BYTE day_index, COUNT year_index);
|
||||||
extern void DrawStatusMessage (UNICODE *pStr);
|
extern void DrawStatusMessage (UNICODE *pStr);
|
||||||
extern void DrawLanders (void);
|
extern void DrawLanders (void);
|
||||||
extern void DrawStorageBays (BOOLEAN Refresh);
|
extern void DrawStorageBays (BOOLEAN Refresh);
|
||||||
|
|||||||
Reference in New Issue
Block a user