Remove ATL dependency so VC++ Express can build
The Express editions of Visual C++ ship without ATL. The only ATL usage was in MUNGA_L4/L4APP.cpp (atlbase.h/atlconv.h + USES_CONVERSION/W2A macros, all in that one file) for wide-to-ANSI conversion of command-line arguments. - Replace the ATL includes with a self-contained L4WideToAnsi helper (a WideCharToMultiByte wrapper) and local USES_CONVERSION/W2A macros that reproduce ATL's W2A semantics. All call sites consume the result immediately (stricmp / CString assignment / atoi / atol), so behaviour is unchanged. - Set UseOfATL="0" in Munga_L4.vcproj, RP_L4.vcproj and their VS2008 variants. - Document the Express build path and the confirmed June 2010 DirectX SDK in BUILD.md (new section 6) and docs/BUILD-NOTES.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+39
-2
@@ -13,8 +13,45 @@
|
||||
#include "l4mppr.h"
|
||||
#include "..\munga\player.h"
|
||||
#include "..\munga\mission.h"
|
||||
#include <atlbase.h>
|
||||
#include <atlconv.h>
|
||||
//
|
||||
// Minimal stand-in for ATL's <atlconv.h> USES_CONVERSION / W2A macros.
|
||||
// VC++ Express and the Windows SDK do not ship ATL, and the only ATL feature
|
||||
// this file used was wide-to-ANSI conversion of command-line tokens below.
|
||||
// L4WideToAnsi mirrors ATL's W2A semantics: each use produces an independent
|
||||
// buffer that stays valid until the end of the enclosing full-expression.
|
||||
//
|
||||
namespace
|
||||
{
|
||||
class L4WideToAnsi
|
||||
{
|
||||
public:
|
||||
explicit L4WideToAnsi(const wchar_t* wide) : mBuffer(0)
|
||||
{
|
||||
int needed = (wide != 0)
|
||||
? ::WideCharToMultiByte(CP_ACP, 0, wide, -1, 0, 0, 0, 0)
|
||||
: 0;
|
||||
if (needed <= 0)
|
||||
{
|
||||
needed = 1;
|
||||
}
|
||||
mBuffer = new char[needed];
|
||||
if (wide == 0 ||
|
||||
::WideCharToMultiByte(CP_ACP, 0, wide, -1, mBuffer, needed, 0, 0) <= 0)
|
||||
{
|
||||
mBuffer[0] = '\0';
|
||||
}
|
||||
}
|
||||
~L4WideToAnsi() { delete [] mBuffer; }
|
||||
operator char*() { return mBuffer; }
|
||||
private:
|
||||
char* mBuffer;
|
||||
L4WideToAnsi(const L4WideToAnsi&); // non-copyable
|
||||
L4WideToAnsi& operator=(const L4WideToAnsi&);
|
||||
};
|
||||
}
|
||||
|
||||
#define USES_CONVERSION ((void)0)
|
||||
#define W2A(w) (static_cast<char*>(L4WideToAnsi(w)))
|
||||
|
||||
L4Application*&
|
||||
l4_application = (L4Application*&)application;
|
||||
|
||||
Reference in New Issue
Block a user