src/economy.cpp
changeset 6879 6f2927f456d7
parent 6876 22305fa54101
child 6882 10263ea04cf3
equal deleted inserted replaced
6878:5cefd3ac59c7 6879:6f2927f456d7
    65 	{
    65 	{
    66 		Station *st;
    66 		Station *st;
    67 		uint num = 0;
    67 		uint num = 0;
    68 
    68 
    69 		FOR_ALL_STATIONS(st) {
    69 		FOR_ALL_STATIONS(st) {
    70 			if (st->owner == owner) {
    70 			if (st->owner == owner) num += CountBitsSet(st->facilities);
    71 				uint facil = st->facilities;
       
    72 				do num += (facil&1); while (facil >>= 1);
       
    73 			}
       
    74 		}
    71 		}
    75 
    72 
    76 		value = num * _price.station_value * 25;
    73 		value = num * _price.station_value * 25;
    77 	}
    74 	}
    78 
    75 
   142 	{
   139 	{
   143 		uint num = 0;
   140 		uint num = 0;
   144 		const Station* st;
   141 		const Station* st;
   145 
   142 
   146 		FOR_ALL_STATIONS(st) {
   143 		FOR_ALL_STATIONS(st) {
   147 			if (st->owner == owner) {
   144 			if (st->owner == owner) num += CountBitsSet(st->facilities);
   148 				int facil = st->facilities;
       
   149 				do num += facil&1; while (facil>>=1);
       
   150 			}
       
   151 		}
   145 		}
   152 		_score_part[owner][SCORE_STATIONS] = num;
   146 		_score_part[owner][SCORE_STATIONS] = num;
   153 	}
   147 	}
   154 
   148 
   155 /* Generate statistics depending on recent income statistics */
   149 /* Generate statistics depending on recent income statistics */
   194 		}
   188 		}
   195 	}
   189 	}
   196 
   190 
   197 /* Generate score for variety of cargo */
   191 /* Generate score for variety of cargo */
   198 	{
   192 	{
   199 		uint cargo = p->cargo_types;
   193 		uint num = CountBitsSet(p->cargo_types);
   200 		uint num = 0;
       
   201 		do num += cargo&1; while (cargo>>=1);
       
   202 		_score_part[owner][SCORE_CARGO] = num;
   194 		_score_part[owner][SCORE_CARGO] = num;
   203 		if (update) p->cargo_types = 0;
   195 		if (update) p->cargo_types = 0;
   204 	}
   196 	}
   205 
   197 
   206 /* Generate score for player money */
   198 /* Generate score for player money */