QTfrontend/newnetclient.cpp
changeset 1330 12c13ffb426f
parent 1329 69ddc231a911
child 1333 b0b0510eb82d
equal deleted inserted replaced
1329:69ddc231a911 1330:12c13ffb426f
   252 		emit AddNetTeam(tmp);
   252 		emit AddNetTeam(tmp);
   253 		return;
   253 		return;
   254 	}
   254 	}
   255 
   255 
   256   if (lst[0] == "REMOVE_TEAM") {
   256   if (lst[0] == "REMOVE_TEAM") {
   257     if(lst.size() < 3)
   257     if(lst.size() != 2)
   258     {
   258     {
   259       qWarning("Net: Bad REMOVETEAM message");
   259       qWarning("Net: Bad REMOVETEAM message");
   260       return;
   260       return;
   261     }
   261     }
   262     m_pTeamSelWidget->removeNetTeam(HWTeam(lst[1]));
   262     m_pTeamSelWidget->removeNetTeam(HWTeam(lst[1]));
   343 		if (lst[1] == "AMMO") {
   343 		if (lst[1] == "AMMO") {
   344 			if(lst.size() < 4) return;
   344 			if(lst.size() < 4) return;
   345 			emit ammoChanged(lst[3], lst[2]);
   345 			emit ammoChanged(lst[3], lst[2]);
   346 			return;
   346 			return;
   347 		}
   347 		}
   348 /*		QStringList hhTmpList = lst[1].split('+');// deprecated stuff
       
   349 		if (hhTmpList[0] == "TEAM_COLOR") {
       
   350 			HWTeam tmptm(hhTmpList[1]);
       
   351 			tmptm.teamColor = QColor(lst[2]);
       
   352 			emit teamColorChanged(tmptm);
       
   353 			return;
       
   354 		}*/
       
   355 		qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst;
   348 		qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst;
   356 		return;
   349 		return;
   357 	}
   350 	}
   358 
   351 
   359 	if (lst[0] == "HH_NUM") {
   352 	if (lst[0] == "HH_NUM") {
   363 			return;
   356 			return;
   364 		}
   357 		}
   365 		HWTeam tmptm(lst[1]);
   358 		HWTeam tmptm(lst[1]);
   366 		tmptm.numHedgehogs = lst[2].toUInt();
   359 		tmptm.numHedgehogs = lst[2].toUInt();
   367 		emit hhnumChanged(tmptm);
   360 		emit hhnumChanged(tmptm);
       
   361 		return;
       
   362 	}
       
   363 
       
   364 	if (lst[0] == "TEAM_COLOR") {
       
   365 		if (lst.size() != 3)
       
   366 		{
       
   367 			qWarning("Net: Bad TEAM_COLOR message");
       
   368 			return;
       
   369 		}
       
   370 		HWTeam tmptm(lst[1]);
       
   371 		tmptm.teamColor = QColor(lst[2]);
       
   372 		emit teamColorChanged(tmptm);
   368 		return;
   373 		return;
   369 	}
   374 	}
   370 
   375 
   371   if (lst[0] == "GAMEMSG") {
   376   if (lst[0] == "GAMEMSG") {
   372     if(lst.size() < 2)
   377     if(lst.size() < 2)
   403 	emit AskForRunGame();
   408 	emit AskForRunGame();
   404 }
   409 }
   405 
   410 
   406 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team)
   411 void HWNewNet::onHedgehogsNumChanged(const HWTeam& team)
   407 {
   412 {
       
   413 	if (isChief)
   408 	RawSendNet(QString("HH_NUM%1%2%1%3")
   414 	RawSendNet(QString("HH_NUM%1%2%1%3")
   409 			.arg(delimeter)
   415 			.arg(delimeter)
   410 			.arg(team.TeamName)
   416 			.arg(team.TeamName)
   411 			.arg(team.numHedgehogs));
   417 			.arg(team.numHedgehogs));
   412 }
   418 }
   413 
   419 
   414 void HWNewNet::onTeamColorChanged(const HWTeam& team)
   420 void HWNewNet::onTeamColorChanged(const HWTeam& team)
   415 {
   421 {
   416 	RawSendNet(QString("CONFIG_PARAM%1TEAM_COLOR%1%2%1%3")
   422 	if (isChief)
       
   423 	RawSendNet(QString("TEAM_COLOR%1%2%1%3")
   417 			.arg(delimeter)
   424 			.arg(delimeter)
   418 			.arg(team.TeamName)
   425 			.arg(team.TeamName)
   419 			.arg(team.teamColor.name()));
   426 			.arg(team.teamColor.name()));
   420 }
   427 }
   421 
   428