QTfrontend/team.cpp
changeset 239 f9adf3c73bed
parent 231 c77b16e48273
child 245 4f6b53b7a567
equal deleted inserted replaced
238:85949b945906 239:f9adf3c73bed
   109 				if (action == binds[i].action)
   109 				if (action == binds[i].action)
   110 				{
   110 				{
   111 					binds[i].strbind = str;
   111 					binds[i].strbind = str;
   112 					break;
   112 					break;
   113 				}
   113 				}
   114 		} else 
   114 		} else
   115 		if (str.startsWith("difficulty "))
   115 		if (str.startsWith("difficulty "))
   116 		{
   116 		{
   117 		  str.remove(0, 11);
   117 		  str.remove(0, 11);
   118 		  difficulty=str.toUInt();
   118 		  difficulty=str.toUInt();
   119 		  if (difficulty>5) difficulty=0; // this shouldn't normally happen
   119 		  if (difficulty>5) difficulty=0; // this shouldn't normally happen
   179 	{
   179 	{
   180 		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
   180 		binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->currentText();
   181 	}
   181 	}
   182 }
   182 }
   183 
   183 
   184 QByteArray HWTeam::IPCTeamInfo() const
   184 QStringList HWTeam::TeamGameConfig(quint32 color, int hedgehogs) const
   185 {
   185 {
   186 	QByteArray buf;
   186 	QStringList sl;
   187 	#define ADD(a) { \
   187 	sl.push_back("eaddteam");
   188 					QByteArray strmsg = a.toUtf8(); \
   188 	sl.push_back(QString("ecolor %1").arg(color));
   189 					quint8 sz = strmsg.size(); \
   189 	sl.push_back("ename team " + TeamName);
   190 					buf.append(QByteArray((char *)&sz, 1)); \
       
   191 					buf.append(strmsg); \
       
   192 					}
       
   193 
       
   194 	ADD(QString("ename team " + TeamName));
       
   195 	for (int i = 0; i < 8; i++)
   190 	for (int i = 0; i < 8; i++)
   196 		ADD(QString("ename hh%1 ").arg(i).append(HHName[i]));
   191 		sl.push_back(QString("ename hh%1 ").arg(i).append(HHName[i]));
   197 	ADD(QString("egrave " + Grave));
   192 	sl.push_back(QString("egrave " + Grave));
   198 	ADD(QString("efort " + Fort));
   193 	sl.push_back(QString("efort " + Fort));
   199 	for(int i = 0; i < BINDS_NUMBER; i++)
   194 	for(int i = 0; i < BINDS_NUMBER; i++)
   200 	{
   195 	{
   201 		ADD(QString("ebind " + binds[i].strbind + " " + binds[i].action));
   196 		sl.push_back(QString("ebind " + binds[i].strbind + " " + binds[i].action));
   202 	}
   197 	}
   203 	#undef ADD
   198 	for (int t = 0; t < hedgehogs; t++)
   204 	return buf;
   199 		sl.push_back(QString("eadd hh%1 %2")
       
   200 				.arg(QString::number(t), QString::number(difficulty)));
       
   201 	return sl;
   205 }
   202 }
   206 
   203 
   207 bool HWTeam::operator==(const HWTeam& t1) const {
   204 bool HWTeam::operator==(const HWTeam& t1) const {
   208   return TeamName==t1.TeamName;
   205   return TeamName==t1.TeamName;
   209 }
   206 }