This reverts commit 1030283cf4.
Giving this some more thought, it seems the safer thing to do. In practive, it shouldn't matter. I haven't encountered a single situation with an emty string...
Reported by GCC 12:
../scummvm/engines/kyra/script/script_hof.cpp: In member function 'int Kyra::KyraEngine_HoF::o2_defineSceneAnim(Kyra::EMCState*)':
../scummvm/engines/kyra/script/script_hof.cpp:875:32: warning: comparing the result of pointer addition '(((const char*)script->Kyra::EMCState::dataPtr->Kyra::EMCData::text) + ((sizetype)READ_BE_UINT16((((const void*)script->Kyra::EMCState::dataPtr->Kyra::EMCData::text) + ((sizetype)(((int)((Kyra::KyraEngine_HoF*)this)->Kyra::KyraEngine_HoF::<anonymous>.Kyra::KyraEngine_v2::<anonymous>.Kyra::KyraEngine_v1::emcSafeReadStack(script, 12, 875, ((const char*)"../scummvm/engines/kyra/script/script_hof.cpp"))) << 1))))))' and NULL [-Waddress]
875 | if (stackPosString(12) != nullptr)
Currently const char * points into some random buffer with unclear
lifetime.
Instead use Common::String which ensures lifetime as long as a reference is
held.
This also removes the need of copying into existing buffers in HoF and MR.
UnkBuf* are gone as well.
Co-authored-by: athrxx <athrxx@scummvm.org>
This reverts the change from 1d5fd780 which was clearly wrong and caused this new bug (no idea what I was thinking there). To prevent the revival of bug #3721 I now added the proper code for a fix after tracking the whole bug with the DOSBox debugger.
Reorganize all files in sub directories. The file placement isn't as intuitive as it might be for other engines, which is probably the reason why this hasn't been done before.