Exemplo n.º 1
0
SkillLevelEvent::SkillLevelEvent( std::iostream& ios )
    :   Event(ios)
{

    // Read bonus
    ios.read( (char*) &bonus, sizeof( bonus ) );

    // Read skill
    ios.read( (char*) &skill, sizeof( skill ) );


}
Exemplo n.º 2
0
Ammo::Ammo( std::iostream& inFile, TargetValue* TVP )
// Read Item base information:
    : Item (inFile, TVP)
{

    // Read char form
    inFile.read( (char*) &form, sizeof(form) );

    // Read bool fired
    inFile.read( (char*) &fired, sizeof(fired) );


}
Exemplo n.º 3
0
Event::Event( std::iostream& ios )
{

    ios.read( (char*) &time, sizeof(time) );

    Timeline::add( this );
}
Exemplo n.º 4
0
bool test_seekable_in_chunks(std::iostream& io)
{
    int i;  // old 'for' scope workaround.

    // Test seeking with ios::cur
    for (i = 0; i < data_reps; ++i) {
        io.write(narrow_data(), chunk_size);
        io.seekp(-chunk_size, BOOST_IOS::cur);
        char buf[chunk_size];
        io.read(buf, chunk_size);
        if (strncmp(buf, narrow_data(), chunk_size) != 0)
            return false;
        io.seekp(-chunk_size, BOOST_IOS::cur);
        io.write(narrow_data(), chunk_size);
    }

    // Test seeking with ios::beg
    std::streamoff off = 0;
    io.seekp(0, BOOST_IOS::beg);
    for (i = 0; i < data_reps; ++i, off += chunk_size) {
        io.write(narrow_data(), chunk_size);
        io.seekp(off, BOOST_IOS::beg);
        char buf[chunk_size];
        io.read(buf, chunk_size);
        if (strncmp(buf, narrow_data(), chunk_size) != 0)
            return false;
        io.seekp(off, BOOST_IOS::beg);
        io.write(narrow_data(), chunk_size);
    }
    
    // Test seeking with ios::end
    io.seekp(0, BOOST_IOS::end);
    off = io.tellp();
    io.seekp(-off, BOOST_IOS::end);
    for (i = 0; i < data_reps; ++i, off -= chunk_size) {
        io.write(narrow_data(), chunk_size);
        io.seekp(-off, BOOST_IOS::end);
        char buf[chunk_size];
        io.read(buf, chunk_size);
        if (strncmp(buf, narrow_data(), chunk_size) != 0)
            return false;
        io.seekp(-off, BOOST_IOS::end);
        io.write(narrow_data(), chunk_size);
    }
    return true;
}
Exemplo n.º 5
0
Fluid::Fluid( std::iostream& inFile, TargetValue* TVP )
// Read Item base information:
    : Item (inFile, TVP)
{

    // Read materialClass f_material
    inFile.read( (char*) &f_material, sizeof(f_material) );


}
Exemplo n.º 6
0
ActionEvent::ActionEvent( std::iostream& ios )
    :   Event(ios)
{

    // Read target
    ios >> target;

    // Read actor
    ios.read( (char*) &action, sizeof( action ) );


}
Exemplo n.º 7
0
bool ResourceManager::saveFile(const std::string& fileName, std::iostream& in)
{
    std::streampos oldPos = in.tellg();
    in.seekg(0, std::ios::end);
    std::streampos size = in.tellg();
    in.seekg(0, std::ios::beg);
    std::vector<char> buffer(size);
    in.read(&buffer[0], size);
    bool ret = saveFile(fileName, (const uchar*)&buffer[0], size);
    in.seekg(oldPos, std::ios::beg);
    return ret;
}
Exemplo n.º 8
0
void FillStream(std::iostream& strm, RawData& expression)
{
	static const std::string s_smallExpression("0123456789abcdefghijklmnopqrstuvwxyz");
	static const int iterationsCount = 10;

	for (int i = 0; i < iterationsCount; ++i)
	{
		strm << s_smallExpression;
	}
	size_t expressionSize = iterationsCount * s_smallExpression.size();
	expression.resize(expressionSize);
	strm.read(reinterpret_cast<char*>(&expression[0]), expressionSize);
	strm.seekg(0);
}