MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / LoadMessage

Method LoadMessage

PanzerChasm/map_loader.cpp:698–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696}
697
698void MapLoader::LoadMessage(
699 const unsigned int message_number,
700 std::istringstream& stream,
701 MapData& map_data )
702{
703 if( message_number >= map_data.messages.size() )
704 map_data.messages.resize( message_number + 1u );
705 MapData::Message& message= map_data.messages[ message_number ];
706
707 while( !stream.eof() )
708 {
709 char line[ 512 ];
710 stream.getline( line, sizeof(line), '\n' );
711
712 if( stream.eof() )
713 break;
714
715 std::istringstream line_stream{ std::string( line ) };
716
717 char thing[64];
718 line_stream >> thing;
719 if( StringEquals( thing, "#end" ) )
720 break;
721
722 else if( StringEquals( thing, "Delay" ) )
723 line_stream >> message.delay_s;
724
725 else if( std::strncmp( thing, "Text", std::strlen("Text") ) == 0 )
726 {
727 message.texts.emplace_back();
728 MapData::Message::Text& text= message.texts.back();
729
730 line_stream >> text.x;
731 line_stream >> text.y;
732
733 // Read line in ""
734 char text_line[512];
735 line_stream >> text_line;
736 const int len= std::strlen(text_line);
737 line_stream.getline( text_line + len, sizeof(text_line) - len, '\n' );
738
739 text.data= std::string( text_line + 1u, text_line + std::strlen( text_line ) - 2u );
740 }
741 }
742}
743
744void MapLoader::LoadProcedure(
745 const unsigned int procedure_number,

Callers

nothing calls this directly

Calls 1

StringEqualsFunction · 0.70

Tested by

no test coverage detected