本文整理汇总了C++中PlayerData::set_local_player_idx方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerData::set_local_player_idx方法的具体用法?C++ PlayerData::set_local_player_idx怎么用?C++ PlayerData::set_local_player_idx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerData
的用法示例。
在下文中一共展示了PlayerData::set_local_player_idx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: net_recv_game_init_data
void net_recv_game_init_data(SerializeBuffer& sb, int sender,
GameStateInitData& init_data, PlayerData& pd) {
//Write seed
sb.read_int(init_data.seed);
init_data.seed_set_by_network_message = true;
//Read player data
int localidx;
sb.read_int(localidx);
pd.set_local_player_idx(localidx);
int playern;
sb.read_int(playern);
LANARTS_ASSERT(pd.all_players().empty());
for (int i = 0; i < playern; i++) {
std::string name;
class_id classtype;
int net_id;
sb.read(name);
sb.read_int(classtype);
sb.read_int(net_id);
pd.register_player(name, NULL, classtype, net_id);
}
printf("Received init packet: seed = 0x%X, localid = %d, nplayers = %d\n",
init_data.seed, localidx, playern);
}
示例2: net_recv_connection_affirm
// Only the server is concerned with this message
void net_recv_connection_affirm(SerializeBuffer& sb, int sender,
PlayerData& pd) {
std::string name;
class_id classtype;
sb.read(name);
sb.read_int(classtype);
printf("connection affirm read\n");
pd.register_player(name, NULL, classtype, sender);
printf("now there are %d players\n", (int)pd.all_players().size());
pd.set_local_player_idx(0);
}