def repackStatsVectors():

	# remove disconnected players
	cleanoutStatsVector()
	cleanoutMedalsVector()
	
	# repack stats and medal vector so there are no holes. gamespy doesnt like holes.
	medalMap = getMedalMap()
	statsMap = getStatsMap()
	playerOrderIt = getPlayerConnectionOrderIterator()

	newOrderIterator = 0
	newStatsMap = {}
	newMedalMap = {}

	highestId = 0
	for id, statsItem in statsMap.iteritems():

		newStatsMap[newOrderIterator] = statsItem
		if id in medalMap:
			newMedalMap[newOrderIterator] = medalMap[id]

		statsItem.connectionOrderNr = newOrderIterator
		newOrderIterator += 1
		
	print "Repacked stats map. Stats map size=%d. OrderIt changed from %d to %d" % (len(statsMap), playerOrderIt, newOrderIterator)

	setPlayerConnectionOrderIterator(newOrderIterator)
	setStatsMap(newStatsMap)
	setMedalMap(newMedalMap)
Beispiel #2
0
def repackStatsVectors():

    # remove disconnected players
    cleanoutStatsVector()
    cleanoutMedalsVector()

    # repack stats and medal vector so there are no holes. gamespy doesnt like holes.
    medalMap = getMedalMap()
    statsMap = getStatsMap()
    playerOrderIt = getPlayerConnectionOrderIterator()

    newOrderIterator = 0
    newStatsMap = {}
    newMedalMap = {}

    highestId = 0
    for id, statsItem in statsMap.iteritems():

        newStatsMap[newOrderIterator] = statsItem
        if id in medalMap:
            newMedalMap[newOrderIterator] = medalMap[id]

        statsItem.connectionOrderNr = newOrderIterator
        newOrderIterator += 1

    print "Repacked stats map. Stats map size=%d. OrderIt changed from %d to %d" % (
        len(statsMap), playerOrderIt, newOrderIterator)

    setPlayerConnectionOrderIterator(newOrderIterator)
    setStatsMap(newStatsMap)
    setMedalMap(newMedalMap)