Serialization of CCreature

sounds in CCreature has been serialized recently, but “gcc” chokes on it. The (bad) workaround is to comment it :

// h & sounds;

Why is it necessary to serialize sounds ? AFAIK It’s only used by the client. If it has to be serialized, shouldn’t we change the sounds types to uiXX ?

../lib/../hch/CCreatureHandler.h: In member function ‘void CCreature::serialize(Handler&, int) [with Handler = CISer<CLoadFile>]’:
../lib/Connection.h:494:   instantiated from ‘void CISer<Serializer>::loadSerializable(T&) [with T = CCreature, Serializer = CLoadFile]’
../lib/Connection.h:166:   instantiated from ‘static void LoadSerializable<Ser, T>::invoke(Ser&, T&) [with Ser = CLoadFile, T = CCreature]’
../lib/Connection.h:484:   instantiated from ‘void CISer<Serializer>::load(T&) [with T = CCreature, Serializer = CLoadFile]’
../lib/Connection.h:451:   instantiated from ‘Serializer& CISer<Serializer>::operator>>(T&) [with T = CCreature, Serializer = CLoadFile]’
../lib/Connection.h:536:   instantiated from ‘void CISer<Serializer>::loadSerializable(std::vector<T, std::allocator<_Tp1> >&) [with T = CCreature, Serializer = CLoadFile]’
../lib/Connection.h:166:   instantiated from ‘static void LoadSerializable<Ser, T>::invoke(Ser&, T&) [with Ser = CLoadFile, T = std::vector<CCreature, std::allocator<CCreature> >]’
../lib/Connection.h:484:   instantiated from ‘void CISer<Serializer>::load(T&) [with T = std::vector<CCreature, std::allocator<CCreature> >, Serializer = CLoadFile]’
../lib/Connection.h:451:   instantiated from ‘Serializer& CISer<Serializer>::operator>>(T&) [with T = std::vector<CCreature, std::allocator<CCreature> >, Serializer = CLoadFile]’
../lib/Connection.h:458:   instantiated from ‘CISer<Serializer>& CISer<Serializer>::operator&(T&) [with T = std::vector<CCreature, std::allocator<CCreature> >, Serializer = CLoadFile]’
../lib/../hch/CCreatureHandler.h:128:   instantiated from ‘void CCreatureHandler::serialize(Handler&, int) [with Handler = CISer<CLoadFile>]’
../lib/Connection.h:494:   instantiated from ‘void CISer<Serializer>::loadSerializable(T&) [with T = CCreatureHandler, Serializer = CLoadFile]’
../lib/Connection.h:166:   instantiated from ‘static void LoadSerializable<Ser, T>::invoke(Ser&, T&) [with Ser = CLoadFile, T = CCreatureHandler]’
../lib/Connection.h:484:   instantiated from ‘void CISer<Serializer>::load(T&) [with T = CCreatureHandler, Serializer = CLoadFile]’
../lib/Connection.h:451:   instantiated from ‘Serializer& CISer<Serializer>::operator>>(T&) [with T = CCreatureHandler, Serializer = CLoadFile]’
../lib/Connection.h:522:   instantiated from ‘void CISer<Serializer>::loadPointer(T&) [with T = CCreatureHandler*, Serializer = CLoadFile]’
../lib/Connection.h:142:   instantiated from ‘static void LoadPointer<Ser, T>::invoke(Ser&, T&) [with Ser = CLoadFile, T = CCreatureHandler*]’
../lib/Connection.h:484:   instantiated from ‘void CISer<Serializer>::load(T&) [with T = CCreatureHandler*, Serializer = CLoadFile]’
../lib/Connection.h:451:   instantiated from ‘Serializer& CISer<Serializer>::operator>>(T&) [with T = CCreatureHandler*, Serializer = CLoadFile]’
../lib/Connection.h:458:   instantiated from ‘CISer<Serializer>& CISer<Serializer>::operator&(T&) [with T = CCreatureHandler*, Serializer = CLoadFile]’
../lib/VCMI_Lib.h:55:   instantiated from ‘void LibClasses::serialize(Handler&, int) [with Handler = CISer<CLoadFile>]’
../lib/Connection.h:494:   instantiated from ‘void CISer<Serializer>::loadSerializable(T&) [with T = LibClasses, Serializer = CLoadFile]’
../lib/Connection.h:166:   instantiated from ‘static void LoadSerializable<Ser, T>::invoke(Ser&, T&) [with Ser = CLoadFile, T = LibClasses]’
../lib/Connection.h:484:   instantiated from ‘void CISer<Serializer>::load(T&) [with T = LibClasses, Serializer = CLoadFile]’
../lib/Connection.h:451:   instantiated from ‘Serializer& CISer<Serializer>::operator>>(T&) [with T = LibClasses, Serializer = CLoadFile]’
Client.cpp:228:   instantiated from here
../lib/../hch/CCreatureHandler.h:98: error: no match for ‘operator&’ in ‘h & ((CCreature*)this)->CCreature::sounds’

We should. Feel free to de that.

Well, I transformed the struct { … } sounds into class { public: … } sounds, and it worked. So I guess that was a bug in g++ since class and struct are almost the same thing.

However that doesn’t fix the underlying issue and I still don’t know why that structure has to be serialized.