All pastes #785018 Raw Edit

Anonym

public text v1 · immutable
·published 2007-11-19 23:57 UTC
rendered paste body
			case NETMSG_KILLALLUNITS: {
				const int player = inbuf[3];
				if ((player < 0) || (player >= MAX_PLAYERS)) {
					logOutput.Print("Got invalid player num %i in KillAllUnits message", player);
				}
				CUnitSet* tu = &gs->Team(gu->myTeam)->units;
				//select all units
				selectedUnits.ClearSelected();
				for(CUnitSet::iterator ui = tu->begin(); ui != tu->end() ;++ui) {
					selectedUnits.AddUnit(*ui);
				}
				for(vector<int>::iterator ui = selectedUnits.netSelected[player].begin(); ui != selectedUnits.netSelected[player].end(); ++ui) {
					if  (uh->units[*ui]) {
						if (uh->units[*ui]->beingBuilt) {
							uh->units[*ui]->KillUnit(false, true, NULL); // kill units under construction without explosion
						}
						else {
							uh->units[*ui]->KillUnit(true, false, NULL);
						}
					}
					logOutput.Print("NET_MSGKILLALLUNITS(%i) for ID:%i / NAME:%s recieved.", player, (int)*ui, uh->units[*ui]->unitDefName.c_str());
				}
				selectedUnits.ClearSelected();
				AddTraffic(player, packetCode, dataLength);
				break;
			}