fix msvc build & mingw build

1. Include unified header files using lowercase filenames
2. Change special characters to escape sequences to solve encoding issues
This commit is contained in:
66hh
2026-03-21 18:32:09 +08:00
parent 3dab395af3
commit 83f3284827
8 changed files with 10 additions and 14 deletions

View File

@@ -1,2 +0,0 @@
// For mingw, cuz on linux it case-sensitive
#include <winsock2.h>

View File

@@ -1,2 +0,0 @@
// For mingw, cuz on linux it case-sensitive
#include <ws2tcpip.h>

View File

@@ -1,8 +1,8 @@
#if defined(X360__) #if defined(X360__)
#elif defined (_WIN32) #elif defined (_WIN32)
#include <WinSock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
#include <Ws2tcpip.h> #include <ws2tcpip.h>
// Must always include Winsock2.h before windows.h // Must always include Winsock2.h before windows.h
// or else: // or else:

View File

@@ -186,7 +186,7 @@ void Font::draw( const std::string& str, float x, float y, int color, bool darke
glPushMatrix2(); glPushMatrix2();
glTranslatef2((GLfloat)x, (GLfloat)y, 0.0f); glTranslatef2((GLfloat)x, (GLfloat)y, 0.0f);
for (unsigned int i = 0; i < str.length(); i++) { for (unsigned int i = 0; i < str.length(); i++) {
while (str.length() > i + 1 && str[i] == '§') { while (str.length() > i + 1 && str[i] == '\xa7') {
int cc = hex.find((char)tolower(str[i + 1])); int cc = hex.find((char)tolower(str[i + 1]));
if (cc < 0 || cc > 15) cc = 15; if (cc < 0 || cc > 15) cc = 15;
lists[index++] = listPos + 256 + cc + (darken ? 16 : 0); lists[index++] = listPos + 256 + cc + (darken ? 16 : 0);
@@ -235,7 +235,7 @@ int Font::width( const std::string& str )
int len = 0; int len = 0;
for (unsigned int i = 0; i < str.length(); i++) { for (unsigned int i = 0; i < str.length(); i++) {
if (str[i] == '§') { if (str[i] == '\xa7') {
i++; i++;
} else { } else {
//int ch = SharedConstants.acceptableLetters.indexOf(str.charAt(i)); //int ch = SharedConstants.acceptableLetters.indexOf(str.charAt(i));
@@ -274,7 +274,7 @@ std::string Font::sanitize( const std::string& str )
int j = 0; int j = 0;
for (unsigned int i = 0; i < str.length(); i++) { for (unsigned int i = 0; i < str.length(); i++) {
if (str[i] == '§') { if (str[i] == '\xa7') {
i++; i++;
//} else if (SharedConstants.acceptableLetters.indexOf(str.charAt(i)) >= 0) { //} else if (SharedConstants.acceptableLetters.indexOf(str.charAt(i)) >= 0) {
} else { } else {

View File

@@ -31,7 +31,7 @@
// #else // #else
// // Uglyness to fix redeclaration issues // // Uglyness to fix redeclaration issues
// #ifdef WIN32 // #ifdef WIN32
// #include <WinSock2.h> // #include <winsock2.h>
// #include <Windows.h> // #include <Windows.h>
// #endif // #endif
// #include <gl/glew.h> // #include <gl/glew.h>

View File

@@ -14,7 +14,7 @@
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <WinSock2.h> #include <winsock2.h>
#include <process.h> #include <process.h>
#include "SharedConstants.h" #include "SharedConstants.h"

View File

@@ -5,7 +5,7 @@
#include <vector> #include <vector>
#ifdef WIN32 #ifdef WIN32
#include <WinSock2.h> #include <winsock2.h>
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>

View File

@@ -1,8 +1,8 @@
#if defined(X360__) #if defined(X360__)
#elif defined (_WIN32) #elif defined (_WIN32)
#include <WinSock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
#include <Ws2tcpip.h> #include <ws2tcpip.h>
// Must always include Winsock2.h before windows.h // Must always include Winsock2.h before windows.h
// or else: // or else: