Distribute resources to islands according to their probabilities
Fix a crash in the buildingtool