<commit_before>var initBases = function() {
	var basesContainer = new createjs.Container();
	basesContainer.name = "basesContainer";
	basesContainer.x = 0;
	basesContainer.y = 0;

	for ( var p = 0; p < clientGame.game.players.length; p++){

		var base = new createjs.Shape();
		base.name = "base" + p;
		base.planetid = undefined;
		base.player = p;
		base.visible = false;

		base.on("mouseover", function() {
			selectBase( this.planetid, this.player );
		});

		base.on("mouseout", function() {
			hideSelection();
		});

		base.on("click", function() {
			handleClickBase( this.planetid, this.player );
		});

		var baseImg = loader.getResult( OBJ_ENGLISH[ OBJ_BASE ] + p);
		base.graphics.beginBitmapFill( baseImg, 
									   "no-repeat" ).drawRect( 0, 
									   						   0, 
									   						   baseImg.width, 
									   						   baseImg.height );

		basesContainer.addChild(base);
	}

	board.addChild(basesContainer);
};

var updateBasesInteractivity = function() {

	var basesContainer = board.getChildByName('basesContainer');

	for ( var p = 0; p < clientGame.game.players.length; p++){
		
		var base = basesContainer.getChildByName('base' + p);
			
		if ( base.planetid != undefined) {

			switch ( clientGame.game.phase ) {

				case PHS_UPKEEP:

					if ( base.player == clientTurn ){
						base.mouseEnabled = true;
					}
					break;

				case PHS_MISSIONS:
					
					if ( pendingAction.agenttype == AGT_SABATEUR 
						&& base.player != clientTurn
						&& base.planetid == pendingAction.planetid ) {
						
						base.mouseEnabled = true;
					}
					else {
						base.mouseEnabled = false;
					}
					break;
				
				default:
					break;
			}
		}
	}
};

var updateRemovedBases = function(){
		
	var basesContainer = board.getChildByName('basesContainer');

	for ( var p = 0; p < clientGame.game.players.length; p++){
		var base = basesContainer.getChildByName('base' + p);
		var planetid = base.planetid;

		if ( planetid != undefined ){
			var planet = clientGame.game.board.planets[planetid];
			if ( !planet.base ){
				base.planetid = undefined;
				fadeOut(base, 500, true);
			}
		}
	}
};

var updateBases = function( planetid ) {

	var planet = clientGame.game.board.planets[planetid];

	if ( planet.base ) {

		var basesContainer = board.getChildByName("basesContainer");
		var player = planet.base.player;
		var base = basesContainer.getChildByName("base" + player);

		base.planetid = planetid;
		base.player = player;

		if ( !base.visible ){

			switch (planet.w) {
				case 1:
					base.x = tiles[planetid].x - 25;
					base.y = tiles[planetid].y - 25;
					break;
				case 2:
					base.x = tiles[planetid].x + 25;
					base.y = tiles[planetid].y + 25;
					break;
			}

			fadeIn(base, 500, true);
		}

		if ( clientTurn == player ) { 
			base.mouseEnabled = true;
		}

		// var baseImg = loader.getResult( OBJ_ENGLISH[ OBJ_BASE ] + player);
		// base.graphics.beginBitmapFill( baseImg, 
		// 							   "no-repeat" ).drawRect( 0, 
		// 							   						   0, 
		// 							   						   baseImg.width, 
		// 							   						   baseImg.height );
		
	}
};

var handleClickBase = function( planetid, player ) {
	switch( clientGame.game.phase ) {
		
		case PHS_UPKEEP:
			setPendingAction( ACT_REMOVE );
			setPendingObject( OBJ_BASE );
			setPendingPlanet( planetid );
			setPendingResource( RES_NONE );
			break;
		
		case PHS_ACTIONS:
			break;

		case PHS_MISSIONS:
			var planet = clientGame.game.board.planets[planetid];<commit_msg>remove commented code<commit_after>var initBases = function() {
	var basesContainer = new createjs.Container();
	basesContainer.name = "basesContainer";
	basesContainer.x = 0;
	basesContainer.y = 0;

	for ( var p = 0; p < clientGame.game.players.length; p++){

		var base = new createjs.Shape();
		base.name = "base" + p;
		base.planetid = undefined;
		base.player = p;
		base.visible = false;

		base.on("mouseover", function() {
			selectBase( this.planetid, this.player );
		});

		base.on("mouseout", function() {
			hideSelection();
		});

		base.on("click", function() {
			handleClickBase( this.planetid, this.player );
		});

		var baseImg = loader.getResult( OBJ_ENGLISH[ OBJ_BASE ] + p);
		base.graphics.beginBitmapFill( baseImg, 
									   "no-repeat" ).drawRect( 0, 
									   						   0, 
									   						   baseImg.width, 
									   						   baseImg.height );

		basesContainer.addChild(base);
	}

	board.addChild(basesContainer);
};

var updateBasesInteractivity = function() {

	var basesContainer = board.getChildByName('basesContainer');

	for ( var p = 0; p < clientGame.game.players.length; p++){
		
		var base = basesContainer.getChildByName('base' + p);
			
		if ( base.planetid != undefined) {

			switch ( clientGame.game.phase ) {

				case PHS_UPKEEP:

					if ( base.player == clientTurn ){
						base.mouseEnabled = true;
					}
					break;

				case PHS_MISSIONS:
					
					if ( pendingAction.agenttype == AGT_SABATEUR 
						&& base.player != clientTurn
						&& base.planetid == pendingAction.planetid ) {
						
						base.mouseEnabled = true;
					}
					else {
						base.mouseEnabled = false;
					}
					break;
				
				default:
					break;
			}
		}
	}
};

var updateRemovedBases = function(){
		
	var basesContainer = board.getChildByName('basesContainer');

	for ( var p = 0; p < clientGame.game.players.length; p++){
		var base = basesContainer.getChildByName('base' + p);
		var planetid = base.planetid;

		if ( planetid != undefined ){
			var planet = clientGame.game.board.planets[planetid];
			if ( !planet.base ){
				base.planetid = undefined;
				fadeOut(base, 500, true);
			}
		}
	}
};

var updateBases = function( planetid ) {

	var planet = clientGame.game.board.planets[planetid];

	if ( planet.base ) {

		var basesContainer = board.getChildByName("basesContainer");
		var player = planet.base.player;
		var base = basesContainer.getChildByName("base" + player);

		base.planetid = planetid;
		base.player = player;

		if ( !base.visible ){

			switch (planet.w) {
				case 1:
					base.x = tiles[planetid].x - 25;
					base.y = tiles[planetid].y - 25;
					break;
				case 2:
					base.x = tiles[planetid].x + 25;
					base.y = tiles[planetid].y + 25;
					break;
			}

			fadeIn(base, 500, true);
		}

		if ( clientTurn == player ) { 
			base.mouseEnabled = true;
		}		
	}
};

var handleClickBase = function( planetid, player ) {
	switch( clientGame.game.phase ) {
		
		case PHS_UPKEEP:
			setPendingAction( ACT_REMOVE );
			setPendingObject( OBJ_BASE );
			setPendingPlanet( planetid );
			setPendingResource( RES_NONE );
			break;
		
		case PHS_ACTIONS:
			break;

		case PHS_MISSIONS:
			var planet = clientGame.game.board.planets[planetid];
{'fraction_non_alphanumeric': 0.13310375804761193, 'fraction_numerical': 0.007186704596496482, 'mean_word_length': 2.6482796286182415, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4961318', 'n_tokens_mistral': 2933, 'n_tokens_neox': 2286, 'n_words': 457}