PythonNetworkStreamPhaseGame/PhaseGameActor/PhaseGameItem/Command, NetworkActorManager and PythonChat/PythonChatModule are ported verbatim and dispatched at runtime; the 2V0 chat stub module is removed and initChat() runs before initnet() as in 40250. InstanceBase, PythonCharacterManager and GameLib ActorInstance/RaceData/RaceManager compile but stay TODO until 2V2-c/d wire them. Units not ported yet get their singletons from PythonBoot's GameSingletons (CPythonApplication member order) and platform/pending stand-ins generated by platform_stub.py pending; const char* stand-ins return "". port.login_flow's fake server now sends the CInputLogin::Entergame order (actor insert, NPC positions, PHASE_GAME, land list, time, channel, greet notice, ping) and a TraceError observer asserts no unknown packet header. port.login_live passes against the real server for 10 s of game phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
#pragma once
|
|
// Support for the generated platform skeleton (platform_stub.py, docs/PORT-PLAN.md 2A). A function whose
|
|
// body still starts with MT_PLATFORM_STUB() has no platform implementation yet; it does nothing and
|
|
// returns a default value. With MT_PLATFORM_STUB_TRACE set in the environment, the first call of each
|
|
// one is reported on stderr.
|
|
|
|
#include <cstdlib>
|
|
#include <type_traits>
|
|
|
|
void mt_platform_stub_called(const char* function, bool* reported);
|
|
|
|
#define MT_PLATFORM_STUB() \
|
|
do \
|
|
{ \
|
|
static bool mt_platform_stub_reported = false; \
|
|
mt_platform_stub_called(__func__, &mt_platform_stub_reported); \
|
|
} while (0)
|
|
|
|
template <class T>
|
|
T mt_platform_stub_return()
|
|
{
|
|
if constexpr (std::is_reference_v<T>)
|
|
{
|
|
using U = std::remove_cv_t<std::remove_reference_t<T>>;
|
|
if constexpr (std::is_default_constructible_v<U> && !std::is_abstract_v<U>)
|
|
{
|
|
static U value{};
|
|
return static_cast<T>(value);
|
|
}
|
|
else
|
|
{
|
|
// Never constructed: a caller that uses the referent of an unimplemented platform function
|
|
// is a bug the stub cannot hide.
|
|
alignas(U) static unsigned char storage[sizeof(U)];
|
|
return static_cast<T>(*reinterpret_cast<U*>(storage));
|
|
}
|
|
}
|
|
else if constexpr (std::is_same_v<T, const char*>)
|
|
{
|
|
// Callers strcmp/strlen/format the names these return (CPythonPlayer::GetName in RecvGuild); a
|
|
// null string would crash where the real function never returns one.
|
|
return "";
|
|
}
|
|
else if constexpr (std::is_default_constructible_v<T>)
|
|
{
|
|
return T{};
|
|
}
|
|
else
|
|
{
|
|
std::abort();
|
|
}
|
|
}
|