Skip to content

Commit 7a23cbc

Browse files
committed
[GEN] Fix type mismatch errors for Generals build (#484)
1 parent 2af198a commit 7a23cbc

File tree

11 files changed

+44
-44
lines changed

11 files changed

+44
-44
lines changed

Generals/Code/GameEngine/Include/GameClient/LanguageFilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class LanguageFilter : public SubsystemInterface {
8282
void filterLine(UnicodeString &line);
8383

8484
protected:
85-
Bool readWord(File *file1, UnsignedShort *buf);
85+
Bool readWord(File *file1, WideChar *buf);
8686
void unHaxor(UnicodeString &word);
8787
LangMap m_wordList;
8888
LangMap m_subWordList;

Generals/Code/GameEngine/Source/Common/Recorder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ Bool RecorderClass::playbackFile(AsciiString filename)
11621162
* Read a unicode string from the current file position. The string is assumed to be 0-terminated.
11631163
*/
11641164
UnicodeString RecorderClass::readUnicodeString() {
1165-
UnsignedShort str[1024] = L"";
1165+
WideChar str[1024] = L"";
11661166
Int index = 0;
11671167

11681168
Int c = fgetwc(m_file);

Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,7 @@ void initMemoryManager()
34613461
linktest = new char[8];
34623462
delete [] linktest;
34633463

3464-
linktest = new char("",1);
3464+
linktest = new char('\0');
34653465
delete linktest;
34663466

34673467
#ifdef MEMORYPOOL_OVERRIDE_MALLOC

Generals/Code/GameEngine/Source/Common/System/QuotedPrintable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ AsciiString AsciiStringToQuotedPrintable(AsciiString original)
114114
// Convert ascii quoted-printable strings into unicode strings
115115
UnicodeString QuotedPrintableToUnicodeString(AsciiString original)
116116
{
117-
static unsigned short dest[1024];
117+
static WideChar dest[1024];
118118
int i=0;
119119

120120
unsigned char *c = (unsigned char *)dest;

Generals/Code/GameEngine/Source/GameClient/Input/Keyboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ Bool Keyboard::isAlt()
976976
WideChar Keyboard::getPrintableKey( UnsignedByte key, Int state )
977977
{
978978
if((key < 0 || key >=KEY_NAMES_COUNT) || ( state < 0 || state >= MAX_KEY_STATES))
979-
return L'';
979+
return L'\0';
980980
if(state == 0)
981981
return m_keyNames[key].stdKey;
982982
else if(state == 1)

Generals/Code/GameEngine/Source/GameClient/LanguageFilter.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ void LanguageFilter::init() {
5858
return;
5959
}
6060

61-
wchar_t word[128];
62-
while (readWord(file1, (UnsignedShort*)word)) {
61+
WideChar word[128];
62+
while (readWord(file1, word)) {
6363
Int wordLen = wcslen(word);
6464
if (wordLen == 0) {
6565
continue;
@@ -159,14 +159,14 @@ void LanguageFilter::unHaxor(UnicodeString &word) {
159159
}
160160

161161
// returning true means that there are more words in the file.
162-
Bool LanguageFilter::readWord(File *file1, UnsignedShort *buf) {
162+
Bool LanguageFilter::readWord(File *file1, WideChar *buf) {
163163
Int index = 0;
164164
Bool retval = TRUE;
165165
Int val = 0;
166166

167-
UnsignedShort c;
167+
WideChar c;
168168

169-
val = file1->read(&c, sizeof(UnsignedShort));
169+
val = file1->read(&c, sizeof(WideChar));
170170
if ((val == -1) || (val == 0)) {
171171
buf[index] = 0;
172172
return FALSE;
@@ -175,7 +175,7 @@ Bool LanguageFilter::readWord(File *file1, UnsignedShort *buf) {
175175

176176
while (buf[index] != L' ') {
177177
++index;
178-
val = file1->read(&c, sizeof(UnsignedShort));
178+
val = file1->read(&c, sizeof(WideChar));
179179
if ((val == -1) || (val == 0)) {
180180
c = WEOF;
181181
}

Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5998,7 +5998,7 @@ Path *Pathfinder::internalFindPath( Object *obj, const LocomotorSet& locomotorSe
59985998
worldToCell( to, &cell );
59995999

60006000
if (!checkDestination(obj, cell.x, cell.y, destinationLayer, radius, centerInCell)) {
6001-
return false;
6001+
return NULL;
60026002
}
60036003
// determine start cell
60046004
ICoord2D startCellNdx;
@@ -9553,7 +9553,7 @@ if (g_UT_startTiming) return false;
95539553
Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
95549554
Path *pathToAvoid, Object *otherObj2, Path *pathToAvoid2)
95559555
{
9556-
if (m_isMapReady == false) return false; // Should always be ok.
9556+
if (m_isMapReady == false) return NULL; // Should always be ok.
95579557
#if defined _DEBUG || defined _INTERNAL
95589558
Int startTimeMS = ::GetTickCount();
95599559
#endif
@@ -9585,9 +9585,9 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
95859585
worldToCell(&startPos, &startCellNdx);
95869586
PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() );
95879587
if (parentCell == NULL)
9588-
return false;
9588+
return NULL;
95899589
if (!obj->getAIUpdateInterface()) {
9590-
return false; // shouldn't happen, but can't move it without an ai.
9590+
return NULL; // shouldn't happen, but can't move it without an ai.
95919591
}
95929592
const LocomotorSet& locomotorSet = obj->getAIUpdateInterface()->getLocomotorSet();
95939593

@@ -9608,7 +9608,7 @@ Path *Pathfinder::getMoveAwayFromPath(Object* obj, Object *otherObj,
96089608
}
96099609

96109610
if (!parentCell->allocateInfo(startCellNdx)) {
9611-
return false;
9611+
return NULL;
96129612
}
96139613
parentCell->startPathfind(NULL);
96149614

@@ -9759,15 +9759,15 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
97599759
//worldToCell(obj->getPosition(), &startCellNdx);
97609760
PathfindCell *parentCell = getClippedCell( obj->getLayer(), &currentPosition);
97619761
if (parentCell == NULL)
9762-
return false;
9762+
return NULL;
97639763
if (!obj->getAIUpdateInterface()) {
9764-
return false; // shouldn't happen, but can't move it without an ai.
9764+
return NULL; // shouldn't happen, but can't move it without an ai.
97659765
}
97669766

97679767
m_isTunneling = false;
97689768

97699769
if (!parentCell->allocateInfo(startCellNdx)) {
9770-
return false;
9770+
return NULL;
97719771
}
97729772
parentCell->startPathfind( NULL);
97739773

@@ -9904,7 +9904,7 @@ Path *Pathfinder::patchPath( const Object *obj, const LocomotorSet& locomotorSet
99049904
candidateGoal->releaseInfo();
99059905
}
99069906
cleanOpenAndClosedLists();
9907-
return false;
9907+
return NULL;
99089908
}
99099909

99109910

@@ -9941,7 +9941,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
99419941
AS_INT(victimPos->x), AS_INT(victimPos->y), AS_INT(victimPos->z)));
99429942
}
99439943
*/
9944-
if (m_isMapReady == false) return false; // Should always be ok.
9944+
if (m_isMapReady == false) return NULL; // Should always be ok.
99459945
#if defined _DEBUG || defined _INTERNAL
99469946
// Int startTimeMS = ::GetTickCount();
99479947
#endif
@@ -10026,14 +10026,14 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
1002610026
worldToCell(&objPos, &startCellNdx);
1002710027
PathfindCell *parentCell = getClippedCell( obj->getLayer(), &objPos );
1002810028
if (parentCell == NULL)
10029-
return false;
10029+
return NULL;
1003010030
if (!obj->getAIUpdateInterface()) {
10031-
return false; // shouldn't happen, but can't move it without an ai.
10031+
return NULL; // shouldn't happen, but can't move it without an ai.
1003210032
}
1003310033
const PathfindCell *startCell = parentCell;
1003410034

1003510035
if (!parentCell->allocateInfo(startCellNdx)) {
10036-
return false;
10036+
return NULL;
1003710037
}
1003810038
parentCell->startPathfind(NULL);
1003910039

@@ -10047,7 +10047,7 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
1004710047
return NULL;
1004810048

1004910049
if (!goalCell->allocateInfo(victimCellNdx)) {
10050-
return false;
10050+
return NULL;
1005110051
}
1005210052

1005310053
// initialize "open" list to contain start cell
@@ -10202,15 +10202,15 @@ Path *Pathfinder::findAttackPath( const Object *obj, const LocomotorSet& locomot
1020210202
goalCell->releaseInfo();
1020310203
}
1020410204
cleanOpenAndClosedLists();
10205-
return false;
10205+
return NULL;
1020610206
}
1020710207

1020810208
/** Find a short, valid path to a location that is safe from the repulsors. */
1020910209
Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotorSet,
1021010210
const Coord3D *from, const Coord3D* repulsorPos1, const Coord3D* repulsorPos2, Real repulsorRadius)
1021110211
{
1021210212
//CRCDEBUG_LOG(("Pathfinder::findSafePath()\n"));
10213-
if (m_isMapReady == false) return false; // Should always be ok.
10213+
if (m_isMapReady == false) return NULL; // Should always be ok.
1021410214
#if defined _DEBUG || defined _INTERNAL
1021510215
// Int startTimeMS = ::GetTickCount();
1021610216
#endif
@@ -10236,12 +10236,12 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
1023610236
worldToCell(obj->getPosition(), &startCellNdx);
1023710237
PathfindCell *parentCell = getClippedCell( obj->getLayer(), obj->getPosition() );
1023810238
if (parentCell == NULL)
10239-
return false;
10239+
return NULL;
1024010240
if (!obj->getAIUpdateInterface()) {
10241-
return false; // shouldn't happen, but can't move it without an ai.
10241+
return NULL; // shouldn't happen, but can't move it without an ai.
1024210242
}
1024310243
if (!parentCell->allocateInfo(startCellNdx)) {
10244-
return false;
10244+
return NULL;
1024510245
}
1024610246
parentCell->startPathfind( NULL);
1024710247

@@ -10360,7 +10360,7 @@ Path *Pathfinder::findSafePath( const Object *obj, const LocomotorSet& locomotor
1036010360
#endif
1036110361
m_isTunneling = false;
1036210362
cleanOpenAndClosedLists();
10363-
return false;
10363+
return NULL;
1036410364
}
1036510365

1036610366
//-----------------------------------------------------------------------------

Generals/Code/GameEngine/Source/GameNetwork/NetPacket.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ NetPacketList NetPacket::ConstructBigCommandPacketList(NetCommandRef *ref) {
158158

159159
if (!DoesCommandRequireACommandID(msg->getNetCommandType())) {
160160
DEBUG_CRASH(("Trying to wrap a command that doesn't have a unique command ID"));
161-
return NULL;
161+
return NetPacketList();
162162
}
163163

164164
UnsignedInt bufferSize = GetBufferSizeNeededForCommand(msg); // need to implement. I have a drinking problem.
@@ -5560,12 +5560,12 @@ NetCommandMsg * NetPacket::readPacketRouterAckMessage(UnsignedByte *data, Int &i
55605560
NetCommandMsg * NetPacket::readDisconnectChatMessage(UnsignedByte *data, Int &i) {
55615561
NetDisconnectChatCommandMsg *msg = newInstance(NetDisconnectChatCommandMsg);
55625562

5563-
UnsignedShort text[256];
5563+
WideChar text[256];
55645564
UnsignedByte length;
55655565
memcpy(&length, data + i, sizeof(UnsignedByte));
55665566
++i;
5567-
memcpy(text, data + i, length * sizeof(UnsignedShort));
5568-
i += length * sizeof(UnsignedShort);
5567+
memcpy(text, data + i, length * sizeof(WideChar));
5568+
i += length * sizeof(WideChar);
55695569
text[length] = 0;
55705570

55715571
UnicodeString unitext;
@@ -5583,13 +5583,13 @@ NetCommandMsg * NetPacket::readDisconnectChatMessage(UnsignedByte *data, Int &i)
55835583
NetCommandMsg * NetPacket::readChatMessage(UnsignedByte *data, Int &i) {
55845584
NetChatCommandMsg *msg = newInstance(NetChatCommandMsg);
55855585

5586-
UnsignedShort text[256];
5586+
WideChar text[256];
55875587
UnsignedByte length;
55885588
Int playerMask;
55895589
memcpy(&length, data + i, sizeof(UnsignedByte));
55905590
++i;
5591-
memcpy(text, data + i, length * sizeof(UnsignedShort));
5592-
i += length * sizeof(UnsignedShort);
5591+
memcpy(text, data + i, length * sizeof(WideChar));
5592+
i += length * sizeof(WideChar);
55935593
text[length] = 0;
55945594
memcpy(&playerMask, data + i, sizeof(Int));
55955595
i += sizeof(Int);

Generals/Code/Libraries/Source/WWVegas/WW3D2/pointgr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,9 @@ void PointGroupClass::Update_Arrays(
10361036

10371037
if (VertexLoc.Length() < total_vnum) {
10381038
// Resize arrays (2x guardband to prevent frequent reallocations).
1039-
VertexLoc.Resize(total_vnum * 2, false);
1040-
VertexUV.Resize(total_vnum * 2, false);
1041-
VertexDiffuse.Resize(total_vnum * 2, false);
1039+
VertexLoc.Resize(total_vnum * 2, NULL);
1040+
VertexUV.Resize(total_vnum * 2, NULL);
1041+
VertexDiffuse.Resize(total_vnum * 2, NULL);
10421042
}
10431043

10441044
int vert, i, j;

Generals/Code/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,8 +1720,8 @@ FontCharsClass::Grow_Unicode_Array (WCHAR ch)
17201720
return ;
17211721
}
17221722

1723-
uint16 first_index = min( FirstUnicodeChar, ch );
1724-
uint16 last_index = max( LastUnicodeChar, ch );
1723+
uint16 first_index = min( FirstUnicodeChar, static_cast<uint16>(ch) );
1724+
uint16 last_index = max( LastUnicodeChar, static_cast<uint16>(ch) );
17251725
uint16 count = (last_index - first_index) + 1;
17261726

17271727
//

0 commit comments

Comments
 (0)