mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
host of changes to accommodate Atlas:
- input.cpp allows feeding in events from the outside (will be used by main.cpp and Atlas msg loop) - most of main.cpp split into ps/GameSetup.* - main.cpp is now a "controller" that drives the game via SDL events (Atlas is another such controller that can override main.cpp). it calls GameSetup functions to set up and processes messages. - add functions to import AtlasUI.dll automatically also, the usual refactoring ;) This was SVN commit r2622.
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
#define UNIDOUBLER_HEADER "CStr.cpp"
|
||||
#include "UniDoubler.h"
|
||||
|
||||
#ifndef PERFORM_SELF_TEST
|
||||
#define PERFORM_SELF_TEST 0
|
||||
#endif
|
||||
|
||||
|
||||
// Only include these function definitions in the first instance of CStr.cpp:
|
||||
CStrW::CStrW(const CStr8 &asciStr) : std::wstring(asciStr.begin(), asciStr.end()) {}
|
||||
@@ -581,4 +585,37 @@ uint CStr::GetSerializedLength() const
|
||||
#undef _totlower
|
||||
#undef _totupper
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// built-in self test
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if PERFORM_SELF_TEST
|
||||
namespace test {
|
||||
|
||||
static void test1()
|
||||
{
|
||||
const wchar_t chr_utf16[] = { 0x12, 0xff, 0x1234, 0x3456, 0x5678, 0x7890, 0x9abc, 0xbcde, 0xfffe };
|
||||
const unsigned char chr_utf8[] = { 0x12, 0xc3, 0xbf, 0xe1, 0x88, 0xb4, 0xe3, 0x91, 0x96, 0xe5, 0x99, 0xb8, 0xe7, 0xa2, 0x90, 0xe9, 0xaa, 0xbc, 0xeb, 0xb3, 0x9e, 0xef, 0xbf, 0xbe };
|
||||
CStrW str_utf16 (chr_utf16, sizeof(chr_utf16)/sizeof(wchar_t));
|
||||
CStr8 str_utf8 = str_utf16.ToUTF8();
|
||||
debug_assert(str_utf8.length() == sizeof(chr_utf8));
|
||||
debug_assert(memcmp(str_utf8.data(), chr_utf8, sizeof(chr_utf8)) == 0);
|
||||
debug_assert(str_utf8.FromUTF8() == str_utf16);
|
||||
}
|
||||
|
||||
|
||||
static int run_tests()
|
||||
{
|
||||
test1();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dummy = run_tests();
|
||||
|
||||
} // namespace test
|
||||
#endif // #if PERFORM_SELF_TEST
|
||||
|
||||
|
||||
#endif // CStr_CPP_FIRST
|
||||
|
||||
Reference in New Issue
Block a user