QTfrontend/newnetclient.cpp
changeset 1319 fedaae857a50
parent 1318 18da1c5e960d
child 1320 bffc7262e25e
equal deleted inserted replaced
1318:18da1c5e960d 1319:fedaae857a50
   326     m_networkToLocalteams.insert(lst[2].toUInt(), lst[1]);
   326     m_networkToLocalteams.insert(lst[2].toUInt(), lst[1]);
   327     m_pTeamSelWidget->changeTeamStatus(lst[1]);
   327     m_pTeamSelWidget->changeTeamStatus(lst[1]);
   328     return;
   328     return;
   329   }
   329   }
   330 
   330 
   331   if (lst[0] == "CONFIG_PARAM") {
   331 	if (lst[0] == "CONFIG_PARAM") {
   332     if(lst.size() < 3)
   332 		if(lst.size() < 3)
   333     {
   333 		{
   334       qWarning("Net: Bad CONFIG_PARAM message");
   334 			qWarning("Net: Bad CONFIG_PARAM message");
   335       return;
   335 			return;
   336     }
   336 		}
   337   	if (lst[1] == "SEED") {
   337 		if (lst[1] == "SEED") {
   338 	  emit seedChanged(lst[2]);
   338 			emit seedChanged(lst[2]);
   339 	  return;
   339 			return;
   340   	}
   340 		}
   341   	if (lst[1] == "MAP") {
   341 		if (lst[1] == "MAP") {
   342 	  emit mapChanged(lst[2]);
   342 			emit mapChanged(lst[2]);
   343 	  return;
   343 			return;
   344   	}
   344 		}
   345   	if (lst[1] == "THEME") {
   345 		if (lst[1] == "THEME") {
   346 	  emit themeChanged(lst[2]);
   346 			emit themeChanged(lst[2]);
   347 	  return;
   347 			return;
   348   	}
   348 		}
   349   	if (lst[1] == "HEALTH") {
   349 		if (lst[1] == "HEALTH") {
   350 	  emit initHealthChanged(lst[2].toUInt());
   350 			emit initHealthChanged(lst[2].toUInt());
   351 	  return;
   351 			return;
   352   	}
   352 		}
   353   	if (lst[1] == "TURNTIME") {
   353 		if (lst[1] == "TURNTIME") {
   354 	  emit turnTimeChanged(lst[2].toUInt());
   354 			emit turnTimeChanged(lst[2].toUInt());
   355 	  return;
   355 			return;
   356   	}
   356 		}
   357   	if (lst[1] == "FORTSMODE") {
   357 		if (lst[1] == "FORTSMODE") {
   358 	  emit fortsModeChanged(lst[2].toInt() != 0);
   358 			emit fortsModeChanged(lst[2].toInt() != 0);
   359 	  return;
   359 			return;
   360   	}
   360 		}
   361 	if (lst[1] == "AMMO") {
   361 		if (lst[1] == "AMMO") {
   362 	  if(lst.size() < 4) return;
   362 			if(lst.size() < 4) return;
   363 	  emit ammoChanged(lst[3], lst[2]);
   363 			emit ammoChanged(lst[3], lst[2]);
   364 	  return;
   364 			return;
   365 	}
   365 		}
   366 	QStringList hhTmpList=lst[1].split('+');
   366 		QStringList hhTmpList=lst[1].split('+');
   367   	if (hhTmpList[0] == "TEAM_COLOR") {
   367 		if (hhTmpList[0] == "TEAM_COLOR") {
   368 	  HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
   368 			HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
   369 	  if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
   369 			if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
   370 	    tmptm=HWTeam(hhTmpList[1]); // local team should be changed
   370 				tmptm=HWTeam(hhTmpList[1]); // local team should be changed
   371 	  }
   371 			}
   372 	  tmptm.teamColor=QColor(lst[2]);
   372 			tmptm.teamColor=QColor(lst[2]);
   373 	  emit teamColorChanged(tmptm);
   373 			emit teamColorChanged(tmptm);
   374 	  return;
   374 			return;
   375   	}
   375 		}
   376   	if (hhTmpList[0] == "HHNUM") {
   376 		if (hhTmpList[0] == "HHNUM") {
   377 	  HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
   377 			HWTeam tmptm(hhTmpList[1], hhTmpList[2].toUInt());
   378 	  if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
   378 			if(m_networkToLocalteams.find(hhTmpList[2].toUInt())!=m_networkToLocalteams.end()) {
   379 	    tmptm=HWTeam(hhTmpList[1]); // local team should be changed
   379 				tmptm=HWTeam(hhTmpList[1]); // local team should be changed
   380 	  }
   380 			}
   381 	  tmptm.numHedgehogs=lst[2].toUInt();
   381 			tmptm.numHedgehogs=lst[2].toUInt();
   382 	  emit hhnumChanged(tmptm);
   382 			emit hhnumChanged(tmptm);
   383 	  return;
   383 			return;
   384   	}
   384 		}
   385     qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst;
   385 		qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst;
   386     return;
   386 		return;
   387   }
   387 	}
   388 
   388 
   389 
   389 
   390   // should be kinda game states, which don't allow "GAMEMSG:" at configure step,
   390   // should be kinda game states, which don't allow "GAMEMSG:" at configure step,
   391   // "CONNECTED" at round phase, etc.
   391   // "CONNECTED" at round phase, etc.
   392   if (lst[0] == "GAMEMSG") {
   392   if (lst[0] == "GAMEMSG") {