示例#1
0
文件: lang.cpp 项目: drodin/Crimson
int Language::ReadCatalog( MemBuffer &file ) {
  int rc;

  // dump old messages
  cat.clear();

  id = file.ReadS( 2 );

  // load messages
  unsigned long msg_len = file.Read32();
  char *ptr, *msgs = new char[msg_len];

  file.Read( msgs, msg_len );

  ptr = msgs;
  while ( ptr < &msgs[msg_len] ) {
    string text = StringUtil::crypt( ptr );
    AddMsg( text.c_str() );

    while ( *ptr != '\0' ) ++ptr;
    ++ptr;
  }

  delete [] msgs;

  rc = cat.size();

  return rc;
}
示例#2
0
文件: lset.cpp 项目: drodin/Crimson
int UnitType::Load( MemBuffer &file, const UnitSet *set ) {
  ut_snd_move = ut_snd_fire = NULL;
  ut_terrain = file.Read16();
  ut_image = file.Read16();
  ut_flags = file.Read16();
  file.Read( &ut_moves, 13 );

  // set sound effects
  unsigned char sfx[2];
  sfx[0] = file.Read8();
  sfx[1] = file.Read8();
  if ( sfx[0] != UT_NO_SOUND ) ut_snd_move = set->GetSound( sfx[0] );
  if ( sfx[1] != UT_NO_SOUND ) ut_snd_fire = set->GetSound( sfx[1] );

  file.Read( &ut_trans_slots, 5 );
  return 0;
}