33 QObject(parent) |
33 QObject(parent) |
34 { |
34 { |
35 QList<QByteArray> baList; |
35 QList<QByteArray> baList; |
36 |
36 |
37 flib_team team; |
37 flib_team team; |
38 bzero(&team, sizeof(team)); |
38 memset(&team, 0, sizeof(team)); |
39 baList << teamname.toUtf8(); |
39 baList << teamname.toUtf8(); |
40 team.name = baList.last().data(); |
40 team.name = baList.last().data(); |
41 team.grave = "Statue"; |
41 team.grave = const_cast<char *>("Statue"); |
42 team.fort = "Plane"; |
42 team.fort = const_cast<char *>("Plane"); |
43 team.voicepack = "Default"; |
43 team.voicepack = const_cast<char *>("Default"); |
44 team.flag = "hedgewars"; |
44 team.flag = const_cast<char *>("hedgewars"); |
45 |
45 |
46 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
46 for (int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
47 { |
47 { |
48 baList << QLineEdit::tr("hedgehog %1").arg(i+1).toUtf8(); |
48 baList << QLineEdit::tr("hedgehog %1").arg(i+1).toUtf8(); |
49 team.hogs[i].name = baList.last().data(); |
49 team.hogs[i].name = baList.last().data(); |
50 team.hogs[i].hat = "NoHat"; |
50 team.hogs[i].hat = const_cast<char *>("NoHat"); |
51 } |
51 } |
52 |
52 |
53 m_oldTeamName = teamname; |
53 m_oldTeamName = teamname; |
54 |
54 |
55 QVector<flib_binding> binds(BINDS_NUMBER); |
55 QVector<flib_binding> binds(BINDS_NUMBER); |
72 QList<QByteArray> baList; |
72 QList<QByteArray> baList; |
73 |
73 |
74 // net teams are configured from QStringList |
74 // net teams are configured from QStringList |
75 if(strLst.size() != 23) throw HWTeamConstructException(); |
75 if(strLst.size() != 23) throw HWTeamConstructException(); |
76 flib_team team; |
76 flib_team team; |
77 bzero(&team, sizeof(team)); |
77 memset(&team, 0, sizeof(team)); |
78 |
78 |
79 for(int i = 0; i < 6; ++i) |
79 for(int i = 0; i < 6; ++i) |
80 baList << strLst[i].toUtf8(); |
80 baList << strLst[i].toUtf8(); |
81 team.name = baList[0].data(); |
81 team.name = baList[0].data(); |
82 m_oldTeamName = strLst[0]; |
82 m_oldTeamName = strLst[0]; |
92 baList << strLst[i * 2 + 7].toUtf8(); |
92 baList << strLst[i * 2 + 7].toUtf8(); |
93 team.hogs[i].name = baList.last().data(); |
93 team.hogs[i].name = baList.last().data(); |
94 |
94 |
95 QString hat = strLst[i * 2 + 8]; |
95 QString hat = strLst[i * 2 + 8]; |
96 if (hat.isEmpty()) |
96 if (hat.isEmpty()) |
97 team.hogs[i].hat = "NoHat"; |
97 team.hogs[i].hat = const_cast<char *>("NoHat"); |
98 else |
98 else |
99 { |
99 { |
100 baList << hat.toUtf8(); |
100 baList << hat.toUtf8(); |
101 team.hogs[i].hat = baList.last().data(); |
101 team.hogs[i].hat = baList.last().data(); |
102 } |
102 } |