当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerInfo::Unserialize方法代码示例

本文整理汇总了C++中PlayerInfo::Unserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::Unserialize方法的具体用法?C++ PlayerInfo::Unserialize怎么用?C++ PlayerInfo::Unserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerInfo的用法示例。


在下文中一共展示了PlayerInfo::Unserialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Unserialize

int GameInfo::Unserialize(LArchive &a)
{
  int i, n;
  // treat all enums as ints
  a << demoversion;
  a << n; mode = gamemode_t(n);
  a << n; state = gamestate_t(n);
  a << n; skill = skill_t(n);

  // flags
  a << netgame << multiplayer << modified << paused << inventory;

  a << maxteams;
  a << maxplayers;

  if (!a.Marker(MARK_GROUP))
    return -1;

  // mapinfo (and maps)
  a << n;
  for (i = 0; i < n; i++)
    {
      MapInfo *m = new MapInfo;
      if (m->Unserialize(a))
	return -2;
      mapinfo[m->mapnumber] = m;
    }

  if (!a.Marker(MARK_GROUP))
    return -1;

  // clustermap
  a << n;
  for (i = 0; i < n; i++)
    {
      MapCluster *c = new MapCluster;
      if (c->Unserialize(a))
	return -3;
      clustermap[c->number] = c;
    }

  a << n;
  currentcluster = clustermap[n];

  if (!a.Marker(MARK_GROUP))
    return -1;

  // episodes
  a << n;
  episodes.resize(n);
  for (i = 0; i < n; i++)
    {
      episodes[i] = new Episode;
      if (episodes[i]->Unserialize(a))
	return -666;
    }

  if (!a.Marker(MARK_GROUP))
    return -1;

  // teams
  a << n;
  teams.resize(n);
  for (i = 0; i < n; i++)
    {
      teams[i] = new TeamInfo;
      if (teams[i]->Unserialize(a))
	return -4;
    }

  if (!a.Marker(MARK_GROUP))
    return -1;

  // players 
  a << n;
  for (i = 0; i < n; i++)
    {
      PlayerInfo *p = new PlayerInfo;
      if (p->Unserialize(a))
	return -5;
      Players[p->number] = p;
    }

  if (!a.Marker(MARK_GROUP))
    return -1;

  // global script data
  a.Read((byte *)ACS_world_vars, sizeof(ACS_world_vars));

  if (!a.Marker(MARK_GROUP))
    return -1;

  // client stuff
  a << n;
  for (i = 0; i < n; i++)
    {
      int num;
      a << num;
      if (num == -1)
	LocalPlayers[i].info = NULL;
//.........这里部分代码省略.........
开发者ID:meiavy,项目名称:doom-legacy,代码行数:101,代码来源:p_saveg.cpp


注:本文中的PlayerInfo::Unserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。