[Freeciv-Dev] Re: (PR#8854) remove some specialist references
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8854 >
On Thu, May 27, 2004 at 05:52:49PM -0700, Jason Short wrote:
/* First try to kill off the specialists */
while (pop_loss > 0 && city_specialists(pcity) > 0) {
- if (pcity->specialists[SP_TAXMAN] > 0) {
- pcity->specialists[SP_TAXMAN]--;
- } else if (pcity->specialists[SP_SCIENTIST] > 0) {
- pcity->specialists[SP_SCIENTIST]--;
- } else {
- assert(pcity->specialists[SP_ELVIS] > 0);
- pcity->specialists[SP_ELVIS]--;
+ /* This loop could be more efficient. */
+ for (i = SP_COUNT - 1; i >= 0; i--) {
+ if (pcity->specialists[i] > 0) {
+ pcity->specialists[i]--;
+ pop_loss--;
+ break;
+ }
Here you loose information. You have to define an order/importance for
each specialist. You encode this information in the SP_* index. This
is bad.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
One nuclear bomb can ruin your whole day.
- [Freeciv-Dev] Re: (PR#8854) remove some specialist references,
Raimar Falke <=
|
|