108 } |
108 } |
109 return; |
109 return; |
110 } |
110 } |
111 |
111 |
112 if(lst[0]=="HHNUM") { |
112 if(lst[0]=="HHNUM") { |
113 if(!m_hwserver->isChiefClient(this) || lst.size()<4) |
113 if (lst.size()<4) { |
114 { |
114 qWarning((QString("Net: Bad 'HHNUM' message: ")+msg+" size="+QString("%1").arg(lst.size())).toAscii().data()); |
115 qWarning((QString("Net: Bad 'HHNUM' message: ")+msg).toAscii().data()); |
115 return; |
116 return; // error or permission denied :) |
116 } |
117 } |
117 if(!m_hwserver->isChiefClient(this)) |
|
118 { |
|
119 return; // permission denied |
|
120 } |
118 const QString confstr=lst[0]+"+"+lst[1]+"+"+lst[2]; |
121 const QString confstr=lst[0]+"+"+lst[1]+"+"+lst[2]; |
119 QMap<QString, QStringList>::iterator it=m_hwserver->m_gameCfg.find(confstr); |
122 QMap<QString, QStringList>::iterator it=m_hwserver->m_gameCfg.find(confstr); |
120 int oldTeamHHNum = it==m_hwserver->m_gameCfg.end() ? 0 : it.value()[0].toUInt(); |
123 int oldTeamHHNum = it==m_hwserver->m_gameCfg.end() ? 0 : it.value()[0].toUInt(); |
121 int newTeamHHNum = lst[3].toUInt(); |
124 int newTeamHHNum = lst[3].toUInt(); |
122 m_hwserver->hhnum+=newTeamHHNum-oldTeamHHNum; |
125 m_hwserver->hhnum+=newTeamHHNum-oldTeamHHNum; |
123 // create CONFIG_PARAM to save HHNUM at server from lst |
126 // create CONFIG_PARAM to save HHNUM at server from lst |
124 lst=QStringList("CONFIG_PARAM") << confstr << lst[3]; |
127 lst=QStringList("CONFIG_PARAM") << confstr << lst[3]; |
|
128 m_hwserver->sendOthers(this, lst.join(QString(delimeter))); |
125 } |
129 } |
126 |
130 |
127 if(lst[0]=="CONFIG_PARAM") { |
131 if(lst[0]=="CONFIG_PARAM") { |
128 if(!m_hwserver->isChiefClient(this) || lst.size()<3) |
132 if (lst.size()<3) { |
129 { |
|
130 qWarning((QString("Net: Bad 'CONFIG_PARAM' message: ")+msg).toAscii().data()); |
133 qWarning((QString("Net: Bad 'CONFIG_PARAM' message: ")+msg).toAscii().data()); |
131 //qWarning("Net: Bad 'CONFIG_PARAM' message"); |
134 return; |
132 return; // error or permission denied :) |
135 } |
133 } |
136 |
|
137 if(!m_hwserver->isChiefClient(this)) |
|
138 { |
|
139 return; // permission denied |
|
140 } |
134 else m_hwserver->m_gameCfg[lst[1]]=lst.mid(2); |
141 else m_hwserver->m_gameCfg[lst[1]]=lst.mid(2); |
135 } |
142 } |
136 |
143 |
137 if(lst[0]=="ADDTEAM:") { |
144 if(lst[0]=="ADDTEAM:") { |
138 if(lst.size() < 14) |
145 if(lst.size() < 14) |