[Freeciv-Dev] (PR#12927) RFC: rename pplayer->player_no
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12927 >
And attached is a patch. It is strict search-and-replace.
-jason
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.74
diff -u -r1.74 advdiplomacy.c
--- ai/advdiplomacy.c 26 Apr 2005 10:54:27 -0000 1.74
+++ ai/advdiplomacy.c 28 Apr 2005 20:40:57 -0000
@@ -190,7 +190,7 @@
return (ai1->diplomacy.target != player2 &&
(player1 == ai1->diplomacy.alliance_leader ||
!pplayers_at_war(player2, ai1->diplomacy.alliance_leader)) &&
- player1->ai.love[player2->player_no] > - (MAX_AI_LOVE * 4 / 10) &&
+ player1->ai.love[player2->index] > - (MAX_AI_LOVE * 4 / 10) &&
(ai1->diplomacy.target == NULL ||
!pplayers_allied(ai1->diplomacy.target, player2)));
}
@@ -265,14 +265,14 @@
int worth = 0; /* worth for pplayer of what aplayer gives */
bool give = (pplayer == pclause->from);
int giver;
- struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
bool is_dangerous;
assert(pplayer != aplayer);
diplomacy_verbose = verbose;
- giver = pclause->from->player_no;
+ giver = pclause->from->index;
switch (pclause->type) {
case CLAUSE_ADVANCE:
@@ -388,7 +388,7 @@
pplayer->name, aplayer->name);
worth = -BIG_NUMBER;
} else {
- worth = greed(pplayer->ai.love[aplayer->player_no]
+ worth = greed(pplayer->ai.love[aplayer->index]
- ai->diplomacy.req_love_for_peace);
}
} else if (pclause->type == CLAUSE_ALLIANCE) {
@@ -397,7 +397,7 @@
pplayer->name, aplayer->name);
worth = -BIG_NUMBER;
} else {
- worth = greed(pplayer->ai.love[aplayer->player_no]
+ worth = greed(pplayer->ai.love[aplayer->index]
- ai->diplomacy.req_love_for_alliance);
}
} else {
@@ -405,7 +405,7 @@
ai_players_can_agree_on_ceasefire(pplayer, aplayer)) {
worth = 0;
} else {
- worth = greed(pplayer->ai.love[aplayer->player_no]
+ worth = greed(pplayer->ai.love[aplayer->index]
- ai->diplomacy.req_love_for_ceasefire);
}
}
@@ -472,7 +472,7 @@
} else {
worth *= 15;
}
- if (aplayer->player_no == offer->original) {
+ if (aplayer->index == offer->original) {
/* Let them buy back their own city cheaper. */
worth /= 2;
}
@@ -581,7 +581,7 @@
/* Accept if balance is good */
if (total_balance >= 0) {
- handle_diplomacy_accept_treaty_req(pplayer, aplayer->player_no);
+ handle_diplomacy_accept_treaty_req(pplayer, aplayer->index);
}
}
@@ -594,7 +594,7 @@
struct Clause *pclause)
{
struct ai_data *ai = ai_data_get(pplayer);
- struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
switch (pclause->type) {
case CLAUSE_ALLIANCE:
@@ -663,7 +663,7 @@
int i = total_balance / ((city_list_size(pplayer->cities) * 50) + 1);
i = MIN(i, ai->diplomacy.love_incr * 150) * 10;
- pplayer->ai.love[aplayer->player_no] += i;
+ pplayer->ai.love[aplayer->index] += i;
DIPLO_LOG(LOG_DIPL2, pplayer, ai, "%s's gift to %s increased love by %d",
aplayer->name, pplayer->name, i);
}
@@ -677,7 +677,7 @@
{
int kill_desire;
struct player_spaceship *ship = &aplayer->spaceship;
- struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
/* Number of cities is a player's base potential. */
kill_desire = city_list_size(aplayer->cities);
@@ -721,7 +721,7 @@
* allies, but we might trigger a wider chain reaction. */
players_iterate(eplayer) {
bool cancel_excuse =
- pplayer->diplstates[eplayer->player_no].has_reason_to_cancel != 0;
+ pplayer->diplstates[eplayer->index].has_reason_to_cancel != 0;
enum diplstate_type ds = pplayer_get_diplstate(pplayer, eplayer)->type;
if (eplayer == pplayer || !eplayer->is_alive) {
@@ -744,7 +744,7 @@
/* Modify by love. Increase the divisor to make ai go to war earlier */
kill_desire -= MAX(0, kill_desire
- * pplayer->ai.love[aplayer->player_no]
+ * pplayer->ai.love[aplayer->index]
/ (2 * MAX_AI_LOVE));
/* Make novice AI more peaceful with human players */
@@ -770,9 +770,9 @@
return;
}
- handle_diplomacy_init_meeting_req(pplayer, aplayer->player_no);
- handle_diplomacy_create_clause_req(pplayer, aplayer->player_no,
- pplayer->player_no, what, value);
+ handle_diplomacy_init_meeting_req(pplayer, aplayer->index);
+ handle_diplomacy_create_clause_req(pplayer, aplayer->index,
+ pplayer->index, what, value);
}
/**********************************************************************
@@ -802,13 +802,13 @@
/* Time to make love. If we've been wronged, hold off that love
* for a while. Also, cool our head each turn with love_coeff. */
players_iterate(aplayer) {
- int a = aplayer->player_no;
+ int a = aplayer->index;
struct ai_dip_intel *adip = &ai->diplomacy.player_intel[a];
if (pplayer == aplayer || !aplayer->is_alive) {
continue;
}
- pplayer->ai.love[aplayer->player_no] -=
+ pplayer->ai.love[aplayer->index] -=
pplayer->diplstates[a].has_reason_to_cancel;
if ((pplayers_non_attack(pplayer, aplayer)
|| pplayers_allied(pplayer, aplayer))
@@ -816,27 +816,27 @@
&& !adip->is_allied_with_enemy
&& !adip->at_war_with_ally
&& adip->ally_patience >= 0) {
- pplayer->ai.love[aplayer->player_no] += ai->diplomacy.love_incr;
+ pplayer->ai.love[aplayer->index] += ai->diplomacy.love_incr;
DIPLO_LOG(LOG_DEBUG, pplayer, ai, "Increased love for %s (now %d)",
- aplayer->name, pplayer->ai.love[aplayer->player_no]);
- } else if (pplayer->diplstates[aplayer->player_no].type == DS_WAR) {
- pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
+ aplayer->name, pplayer->ai.love[aplayer->index]);
+ } else if (pplayer->diplstates[aplayer->index].type == DS_WAR) {
+ pplayer->ai.love[aplayer->index] -= ai->diplomacy.love_incr;
if (ai->diplomacy.target != aplayer &&
- pplayer->ai.love[aplayer->player_no] < 0) {
+ pplayer->ai.love[aplayer->index] < 0) {
/* Give him a better chance for a cease fire */
- pplayer->ai.love[aplayer->player_no] += (MAX_AI_LOVE) * 3 / 100;
+ pplayer->ai.love[aplayer->index] += (MAX_AI_LOVE) * 3 / 100;
}
DIPLO_LOG(LOG_DEBUG, pplayer, ai, "Reduced love for %s (now %d) ",
- aplayer->name, pplayer->ai.love[aplayer->player_no]);
+ aplayer->name, pplayer->ai.love[aplayer->index]);
} else if (pplayer->diplstates[a].has_reason_to_cancel != 0) {
/* Provoked in time of peace */
- if (pplayer->ai.love[aplayer->player_no] > 0) {
+ if (pplayer->ai.love[aplayer->index] > 0) {
DIPLO_LOG(LOG_DEBUG, pplayer, ai, "Provoked by %s! Love halved "
"(was %d)", aplayer->name,
- pplayer->ai.love[aplayer->player_no]);
- pplayer->ai.love[aplayer->player_no] /= 2;
+ pplayer->ai.love[aplayer->index]);
+ pplayer->ai.love[aplayer->index] /= 2;
}
- pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
+ pplayer->ai.love[aplayer->index] -= ai->diplomacy.love_incr;
}
/* Reduce love by number of units in our territory.
@@ -845,25 +845,25 @@
pplayers_at_war(pplayer, aplayer) || adip->is_allied_with_enemy ?
2 : 1;
- pplayer->ai.love[aplayer->player_no] -=
+ pplayer->ai.love[aplayer->index] -=
MIN(player_in_territory(pplayer, aplayer) * (MAX_AI_LOVE / 100),
pplayers_allied(aplayer, pplayer) ?
ai->diplomacy.love_incr - 1 : (MAX_AI_LOVE / 2)) * mult;
/* Increase the love if aplayer has got a building that makes
* us love him more. Typically it's Eiffel Tower */
- pplayer->ai.love[aplayer->player_no] +=
+ pplayer->ai.love[aplayer->index] +=
get_player_bonus(aplayer, EFT_GAIN_AI_LOVE) * MAX_AI_LOVE / 1000;
/* Massage our numbers to keep love and its opposite on the ground.
* Gravitate towards zero. */
- pplayer->ai.love[aplayer->player_no] -=
- (pplayer->ai.love[aplayer->player_no] * ai->diplomacy.love_coeff / 100);
+ pplayer->ai.love[aplayer->index] -=
+ (pplayer->ai.love[aplayer->index] * ai->diplomacy.love_coeff / 100);
/* ai love should always be in range [-MAX_AI_LOVE..MAX_AI_LOVE] */
- pplayer->ai.love[aplayer->player_no] =
+ pplayer->ai.love[aplayer->index] =
MAX(-MAX_AI_LOVE,
- MIN(MAX_AI_LOVE, pplayer->ai.love[aplayer->player_no]));
+ MIN(MAX_AI_LOVE, pplayer->ai.love[aplayer->index]));
} players_iterate_end;
/* Stop war against a dead player */
@@ -899,14 +899,14 @@
/* Calculate average distances to other players' empires. */
players_iterate(aplayer) {
- ai->diplomacy.player_intel[aplayer->player_no].distance =
+ ai->diplomacy.player_intel[aplayer->index].distance =
player_distance_to_player(pplayer, aplayer);
} players_iterate_end;
/* Calculate our desires, and find desired war target */
players_iterate(aplayer) {
enum diplstate_type ds = pplayer_get_diplstate(pplayer, aplayer)->type;
- struct ai_dip_intel *adip =
&ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
/* We don't hate ourselves, those we don't know or team members
* Defer judgement on alliance members we're not (yet) allied to
@@ -923,7 +923,7 @@
== DS_CEASEFIRE)) {
continue;
}
- war_desire[aplayer->player_no] = ai_war_desire(pplayer, aplayer, ai);
+ war_desire[aplayer->index] = ai_war_desire(pplayer, aplayer, ai);
/* We don't want war if we can win through the space race. */
if (ai->diplomacy.strategy == WIN_SPACE && !adip->at_war_with_ally) {
@@ -932,16 +932,16 @@
/* Strongly prefer players we are at war with already. */
if (!pplayers_at_war(pplayer, aplayer)) {
- war_desire[aplayer->player_no] /= 2;
+ war_desire[aplayer->index] /= 2;
}
DIPLO_LOG(LOG_DEBUG, pplayer, ai, "Against %s we have war desire "
- "%d ", aplayer->name, war_desire[aplayer->player_no]);
+ "%d ", aplayer->name, war_desire[aplayer->index]);
/* Find best target */
- if (war_desire[aplayer->player_no] > best_desire) {
+ if (war_desire[aplayer->index] > best_desire) {
target = aplayer;
- best_desire = war_desire[aplayer->player_no];
+ best_desire = war_desire[aplayer->index];
}
} players_iterate_end;
@@ -957,10 +957,10 @@
ai->diplomacy.target = target;
if (ai->diplomacy.strategy == WIN_CAPITAL) {
ai->diplomacy.countdown = 1; /* Quickly!! */
- } else if (pplayer->diplstates[target->player_no].has_reason_to_cancel >
1) {
+ } else if (pplayer->diplstates[target->index].has_reason_to_cancel > 1) {
/* Turns until we lose our casus bellum, exploit that. */
ai->diplomacy.countdown =
- pplayer->diplstates[target->player_no].has_reason_to_cancel
+ pplayer->diplstates[target->index].has_reason_to_cancel
- 1;
} else {
ai->diplomacy.countdown = 6; /* Take the time we need - WAG */
@@ -968,7 +968,7 @@
/* Don't reevaluate too often. */
ai->diplomacy.timer = myrand(6) + 6 + ai->diplomacy.countdown;
players_iterate(aplayer) {
- ai->diplomacy.player_intel[aplayer->player_no].ally_patience = 0;
+ ai->diplomacy.player_intel[aplayer->index].ally_patience = 0;
} players_iterate_end;
}
}
@@ -1091,16 +1091,16 @@
}
/* will take us straight to war */
- handle_diplomacy_cancel_pact(pplayer, target->player_no, CLAUSE_LAST);
+ handle_diplomacy_cancel_pact(pplayer, target->index, CLAUSE_LAST);
/* Continue war at least in this arbitrary number of turns to show
* some spine */
ai->diplomacy.timer = myrand(4) + 3;
- if (pplayer->ai.love[target->player_no] < 0) {
- ai->diplomacy.timer -= pplayer->ai.love[target->player_no] / 10;
+ if (pplayer->ai.love[target->index] < 0) {
+ ai->diplomacy.timer -= pplayer->ai.love[target->index] / 10;
} else {
/* We DO NOT love our enemies! AIs are heatens! */
- pplayer->ai.love[target->player_no] = -1;
+ pplayer->ai.love[target->index] = -1;
}
assert(!gives_shared_vision(pplayer, target));
}
@@ -1125,8 +1125,8 @@
players_iterate(aplayer) {
if (ai->diplomacy.acceptable_reputation > aplayer->reputation
- && pplayer->ai.love[aplayer->player_no] < 0
- && pplayer->diplstates[aplayer->player_no].has_reason_to_cancel >= 2) {
+ && pplayer->ai.love[aplayer->index] < 0
+ && pplayer->diplstates[aplayer->index].has_reason_to_cancel >= 2) {
DIPLO_LOG(LOG_DIPL2, pplayer, ai, "Declaring war on %s in revenge",
target->name);
notify(target, _("*%s (AI)* I will NOT accept such behaviour! This "
@@ -1140,7 +1140,7 @@
if (ai->diplomacy.strategy != WIN_SPACE) {
players_iterate(aplayer) {
struct ai_dip_intel *adip =
- &ai->diplomacy.player_intel[aplayer->player_no];
+ &ai->diplomacy.player_intel[aplayer->index];
struct player_spaceship *ship = &aplayer->spaceship;
if (!aplayer->is_alive || aplayer == pplayer
@@ -1155,13 +1155,13 @@
notify(aplayer, _("*%s (AI)* Your attempt to conquer space for "
"yourself alone betray your true intentions, and I "
"will have no more of our alliance!"), pplayer->name);
- handle_diplomacy_cancel_pact(pplayer, aplayer->player_no,
+ handle_diplomacy_cancel_pact(pplayer, aplayer->index,
CLAUSE_ALLIANCE);
if (gives_shared_vision(pplayer, aplayer)) {
remove_shared_vision(pplayer, aplayer);
}
/* Never forgive this */
- pplayer->ai.love[aplayer->player_no] = -(BIG_NUMBER);
+ pplayer->ai.love[aplayer->index] = -(BIG_NUMBER);
} else if (ship->state == SSHIP_STARTED
&& adip->warned_about_space == 0) {
adip->warned_about_space = 10 + myrand(6);
@@ -1189,11 +1189,11 @@
DIPLO_LOG(LOG_DEBUG, pplayer, ai, "Went to war against %s, who is "
"an ally!", target->name); /* Oh, my. */
}
- if (pplayer->diplstates[target->player_no].has_reason_to_cancel > 0) {
+ if (pplayer->diplstates[target->index].has_reason_to_cancel > 0) {
/* We have good reason */
notify(target, _("*%s (AI)* Your despicable actions will not go "
"unpunished!"), pplayer->name);
- } if (pplayer->ai.love[target->player_no] < 0) {
+ } if (pplayer->ai.love[target->index] < 0) {
/* We have a reason of sorts from way back. */
notify(target, _("*%s (AI)* Finally I get around to you! Did "
"you really think you could get away with your crimes?"),
@@ -1209,7 +1209,7 @@
/*** Declare war - against enemies of allies ***/
players_iterate(aplayer) {
- struct ai_dip_intel *adip =
&ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
if (aplayer->is_alive
&& adip->at_war_with_ally
@@ -1229,7 +1229,7 @@
players_iterate(aplayer) {
enum diplstate_type ds = pplayer_get_diplstate(pplayer, aplayer)->type;
- struct ai_dip_intel *adip =
&ai->diplomacy.player_intel[aplayer->player_no];
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
struct Clause clause;
/* Meaningless values, but rather not have them unset. */
@@ -1326,10 +1326,10 @@
DIPLO_LOG(LOG_DIPL2, pplayer, ai, "breaking useless alliance with "
"%s", aplayer->name);
/* to peace */
- handle_diplomacy_cancel_pact(pplayer, aplayer->player_no,
+ handle_diplomacy_cancel_pact(pplayer, aplayer->index,
CLAUSE_ALLIANCE);
- pplayer->ai.love[aplayer->player_no] =
- MIN(pplayer->ai.love[aplayer->player_no], 0);
+ pplayer->ai.love[aplayer->index] =
+ MIN(pplayer->ai.love[aplayer->index], 0);
if (gives_shared_vision(pplayer, aplayer)) {
remove_shared_vision(pplayer, aplayer);
}
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.213
diff -u -r1.213 aicity.c
--- ai/aicity.c 23 Apr 2005 17:40:21 -0000 1.213
+++ ai/aicity.c 28 Apr 2005 20:40:57 -0000
@@ -699,7 +699,7 @@
if (wonder_city == NULL) {
return;
}
- if (wonder_city->owner != pplayer->player_no) {
+ if (wonder_city->owner != pplayer->index) {
ai->wonder_city = 0;
return;
}
@@ -742,7 +742,7 @@
struct ai_data *ai = ai_data_get(pplayer);
struct city *wonder_city = find_city_by_id(ai->wonder_city);
- if (wonder_city && wonder_city->owner != pplayer->player_no) {
+ if (wonder_city && wonder_city->owner != pplayer->index) {
/* We lost it to the enemy! */
ai->wonder_city = 0;
wonder_city = NULL;
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.64
diff -u -r1.64 aidata.c
--- ai/aidata.c 23 Apr 2005 17:40:21 -0000 1.64
+++ ai/aidata.c 28 Apr 2005 20:40:57 -0000
@@ -372,7 +372,7 @@
**************************************************************************/
void ai_data_analyze_rulesets(struct player *pplayer)
{
- struct ai_data *ai = &aidata[pplayer->player_no];
+ struct ai_data *ai = &aidata[pplayer->index];
ai_data_city_impr_calc(pplayer, ai);
}
@@ -390,7 +390,7 @@
**************************************************************************/
void ai_data_phase_init(struct player *pplayer, bool is_new_phase)
{
- struct ai_data *ai = &aidata[pplayer->player_no];
+ struct ai_data *ai = &aidata[pplayer->index];
int i, nuke_units = num_role_units(F_NUCLEAR);
bool danger_of_nukes = FALSE;
int ally_strength = -1;
@@ -681,7 +681,7 @@
**************************************************************************/
void ai_data_phase_done(struct player *pplayer)
{
- struct ai_data *ai = &aidata[pplayer->player_no];
+ struct ai_data *ai = &aidata[pplayer->index];
free(ai->explore.ocean);
ai->explore.ocean = NULL;
@@ -707,7 +707,7 @@
**************************************************************************/
struct ai_data *ai_data_get(struct player *pplayer)
{
- struct ai_data *ai = &aidata[pplayer->player_no];
+ struct ai_data *ai = &aidata[pplayer->index];
if (ai->num_continents != map.num_continents
|| ai->num_oceans != map.num_oceans) {
@@ -723,7 +723,7 @@
**************************************************************************/
void ai_data_init(struct player *pplayer)
{
- struct ai_data *ai = &aidata[pplayer->player_no];
+ struct ai_data *ai = &aidata[pplayer->index];
int i;
ai->govt_reeval = 0;
Index: ai/aiferry.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiferry.c,v
retrieving revision 1.20
diff -u -r1.20 aiferry.c
--- ai/aiferry.c 23 Apr 2005 17:40:21 -0000 1.20
+++ ai/aiferry.c 28 Apr 2005 20:40:57 -0000
@@ -97,7 +97,7 @@
int n = 1;
freelog(LOG_NORMAL, "Boat stats for %s[%d]",
- pplayer->name, pplayer->player_no);
+ pplayer->name, pplayer->index);
freelog(LOG_NORMAL, "Registered: %d free out of total %d",
ai->stats.available_boats, ai->stats.boats);
unit_list_iterate(pplayer->units, punit) {
@@ -209,7 +209,7 @@
if (boats != ai->stats.available_boats) {
freelog(LOG_ERROR, "Player[%d] in turn %d: boats miscounted.",
- pplayer->player_no, game.turn);
+ pplayer->index, game.turn);
aiferry_print_stats(pplayer);
}
#endif /* DEBUG_FERRY_STATS */
Index: ai/aihunt.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihunt.c,v
retrieving revision 1.17
diff -u -r1.17 aihunt.c
--- ai/aihunt.c 23 Apr 2005 17:40:21 -0000 1.17
+++ ai/aihunt.c 28 Apr 2005 20:40:58 -0000
@@ -240,7 +240,7 @@
bool ai_hunter_qualify(struct player *pplayer, struct unit *punit)
{
if (is_barbarian(pplayer)
- || punit->owner != pplayer->player_no) {
+ || punit->owner != pplayer->index) {
return FALSE;
}
if (unit_has_role(punit->type, L_HUNTER)) {
@@ -265,7 +265,7 @@
unit_list_iterate(punit->tile->units, missile) {
struct unit *sucker = NULL;
- if (missile->owner == pplayer->player_no
+ if (missile->owner == pplayer->index
&& unit_flag(missile, F_MISSILE)) {
UNIT_LOG(LOGLEVEL_HUNT, missile, "checking for hunt targets");
pft_fill_unit_parameter(¶meter, punit);
@@ -402,7 +402,7 @@
}
if (pos.tile->city
|| !can_unit_attack_tile(punit, pos.tile)
- || TEST_BIT(target->ai.hunted, pplayer->player_no)) {
+ || TEST_BIT(target->ai.hunted, pplayer->index)) {
/* Can't hunt this one. The bit is cleared in the beginning
* of each turn. */
continue;
Index: ai/ailog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/ailog.c,v
retrieving revision 1.24
diff -u -r1.24 ailog.c
--- ai/ailog.c 23 Apr 2005 17:40:21 -0000 1.24
+++ ai/ailog.c 28 Apr 2005 20:40:58 -0000
@@ -97,15 +97,15 @@
if (ai->diplomacy.target) {
my_snprintf(targetbuffer, sizeof(targetbuffer), "[ti%d co%d lo%d %s] ",
ai->diplomacy.timer, ai->diplomacy.countdown,
- pplayer->ai.love[ai->diplomacy.target->player_no],
+ pplayer->ai.love[ai->diplomacy.target->index],
ai->diplomacy.target->name);
}
my_snprintf(buffer, sizeof(buffer), "%s %s%s%s ", pplayer->name,
ai->diplomacy.target ? targetbuffer : "",
ai->diplomacy.spacerace_leader &&
- ai->diplomacy.spacerace_leader->player_no == pplayer->player_no
?
+ ai->diplomacy.spacerace_leader->index == pplayer->index ?
"(spacelead) " : "",
- ai->diplomacy.alliance_leader->player_no == pplayer->player_no ?
+ ai->diplomacy.alliance_leader->index == pplayer->index ?
"(*)" : "");
va_start(ap, msg);
Index: ai/aisettler.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aisettler.c,v
retrieving revision 1.19
diff -u -r1.19 aisettler.c
--- ai/aisettler.c 23 Apr 2005 17:40:21 -0000 1.19
+++ ai/aisettler.c 28 Apr 2005 20:40:58 -0000
@@ -419,7 +419,7 @@
}
/* If (x, y) is an existing city, consider immigration */
- if (pcity && pcity->owner == pplayer->player_no) {
+ if (pcity && pcity->owner == pplayer->index) {
return;
}
Index: ai/aitools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aitools.c,v
retrieving revision 1.147
diff -u -r1.147 aitools.c
--- ai/aitools.c 23 Apr 2005 17:40:21 -0000 1.147
+++ ai/aitools.c 28 Apr 2005 20:40:58 -0000
@@ -117,8 +117,8 @@
bool is_player_dangerous(struct player *pplayer, struct player *aplayer)
{
struct ai_data *ai = ai_data_get(pplayer);
- struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->player_no];
- int reason = pplayer->diplstates[aplayer->player_no].has_reason_to_cancel;
+ struct ai_dip_intel *adip = &ai->diplomacy.player_intel[aplayer->index];
+ int reason = pplayer->diplstates[aplayer->index].has_reason_to_cancel;
/* Have to check if aplayer == pplayer explicitly because our reputation
* can be so low that we'd fear being stabbed in the back by ourselves */
@@ -781,7 +781,7 @@
struct unit *target = find_unit_by_id(punit->ai.target);
if (target) {
- target->ai.hunted &= ~(1 << unit_owner(punit)->player_no);
+ target->ai.hunted &= ~(1 << unit_owner(punit)->index);
UNIT_LOG(LOGLEVEL_HUNT, target, "no longer hunted (new role %d, old %d)",
task, punit->ai.ai_role);
}
@@ -817,7 +817,7 @@
struct unit *target = find_unit_by_id(punit->ai.target);
assert(target != NULL);
- target->ai.hunted |= (1 << unit_owner(punit)->player_no);
+ target->ai.hunted |= (1 << unit_owner(punit)->index);
UNIT_LOG(LOGLEVEL_HUNT, target, "is being hunted");
/* Grab missiles lying around and bring them along */
Index: ai/aiunit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
retrieving revision 1.356
diff -u -r1.356 aiunit.c
--- ai/aiunit.c 23 Apr 2005 17:40:22 -0000 1.356
+++ ai/aiunit.c 28 Apr 2005 20:40:59 -0000
@@ -1029,7 +1029,7 @@
CHECK_UNIT(punit);
- if (!pcity || pcity->owner != pplayer->player_no) {
+ if (!pcity || pcity->owner != pplayer->index) {
pcity = punit->tile->city;
punit->ai.charge = 0; /* clear duty */
}
@@ -2166,7 +2166,7 @@
unit_list_iterate(pcity->tile->units, punit) {
if ((punit->ai.ai_role == AIUNIT_NONE || emergency)
&& punit->ai.ai_role != AIUNIT_DEFEND_HOME
- && punit->owner == pplayer->player_no) {
+ && punit->owner == pplayer->index) {
int want = assess_defense_unit(pcity, punit, FALSE);
if (want > best_want) {
Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.162
diff -u -r1.162 climisc.c
--- client/climisc.c 23 Apr 2005 17:40:22 -0000 1.162
+++ client/climisc.c 28 Apr 2005 20:40:59 -0000
@@ -209,8 +209,8 @@
}
} else if (player_has_embassy(them, me)) {
return Q_("?embassy:With Us");
- } else if (me->diplstates[them->player_no].contact_turns_left > 0
- || them->diplstates[me->player_no].contact_turns_left > 0) {
+ } else if (me->diplstates[them->index].contact_turns_left > 0
+ || them->diplstates[me->index].contact_turns_left > 0) {
return Q_("?embassy:Contact");
} else {
return Q_("?embassy:No Contact");
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.495
diff -u -r1.495 packhand.c
--- client/packhand.c 23 Apr 2005 17:40:23 -0000 1.495
+++ client/packhand.c 28 Apr 2005 20:40:59 -0000
@@ -1463,7 +1463,7 @@
int i;
bool poptechup, new_tech = FALSE;
char msg[MAX_LEN_MSG];
- struct player *pplayer = &game.players[pinfo->playerno];
+ struct player *pplayer = &game.players[pinfo->index];
sz_strlcpy(pplayer->name, pinfo->name);
Index: client/plrdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/plrdlg_common.c,v
retrieving revision 1.17
diff -u -r1.17 plrdlg_common.c
--- client/plrdlg_common.c 23 Feb 2005 03:34:05 -0000 1.17
+++ client/plrdlg_common.c 28 Apr 2005 20:40:59 -0000
@@ -152,7 +152,7 @@
if (player == game.player_ptr || !player->ai.control) {
return "-";
} else {
- return love_text(player->ai.love[game.player_ptr->player_no]);
+ return love_text(player->ai.love[game.player_ptr->index]);
}
}
Index: client/text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/text.c,v
retrieving revision 1.34
diff -u -r1.34 text.c
--- client/text.c 27 Apr 2005 02:48:00 -0000 1.34
+++ client/text.c 28 Apr 2005 20:41:00 -0000
@@ -162,8 +162,8 @@
if (owner == game.player_ptr){
add_line(_("Our Territory"));
} else if (owner) {
- if (ds[owner->player_no].type == DS_CEASEFIRE) {
- int turns = ds[owner->player_no].turns_left;
+ if (ds[owner->index].type == DS_CEASEFIRE) {
+ int turns = ds[owner->index].turns_left;
/* TRANS: "Polish territory (5 turn ceasefire)" */
add_line(PL_("%s territory (%d turn ceasefire)",
@@ -174,7 +174,7 @@
/* TRANS: "Territory of the friendly Polish". See the
* ?nation adjectives. */
add_line(_("Territory of the %s %s"),
- diplo_nation_plural_adjectives[ds[owner->player_no].type],
+ diplo_nation_plural_adjectives[ds[owner->index].type],
get_nation_name_plural(owner->nation));
}
} else {
@@ -193,8 +193,8 @@
add_line(_("City: %s (%s)"), pcity->name,
get_nation_name(owner->nation));
} else if (owner) {
- if (ds[owner->player_no].type == DS_CEASEFIRE) {
- int turns = ds[owner->player_no].turns_left;
+ if (ds[owner->index].type == DS_CEASEFIRE) {
+ int turns = ds[owner->index].turns_left;
/* TRANS: "City: Warsaw (Polish, 5 turn ceasefire)" */
add_line(PL_("City: %s (%s, %d turn ceasefire)",
@@ -207,7 +207,7 @@
/* TRANS: "City: Warsaw (Polish,friendly)" */
add_line(_("City: %s (%s, %s)"), pcity->name,
get_nation_name(owner->nation),
- diplo_city_adjectives[ds[owner->player_no].type]);
+ diplo_city_adjectives[ds[owner->index].type]);
}
}
if (city_got_citywalls(pcity)) {
@@ -253,8 +253,8 @@
get_nation_name(owner->nation),
tmp);
} else if (owner) {
- if (ds[owner->player_no].type == DS_CEASEFIRE) {
- int turns = ds[owner->player_no].turns_left;
+ if (ds[owner->index].type == DS_CEASEFIRE) {
+ int turns = ds[owner->index].turns_left;
/* TRANS: "Unit: Musketeers (Polish, 5 turn ceasefire)" */
add_line(PL_("Unit: %s (%s, %d turn ceasefire)",
@@ -267,7 +267,7 @@
/* TRANS: "Unit: Musketeers (Polish,friendly)" */
add_line(_("Unit: %s (%s, %s)"), ptype->name,
get_nation_name(owner->nation),
- diplo_city_adjectives[ds[owner->player_no].type]);
+ diplo_city_adjectives[ds[owner->index].type]);
}
}
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.297
diff -u -r1.297 tilespec.c
--- client/tilespec.c 28 Apr 2005 17:19:52 -0000 1.297
+++ client/tilespec.c 28 Apr 2005 20:41:01 -0000
@@ -3614,11 +3614,11 @@
if (owner0 != owner1) {
if (owner0) {
ADD_SPRITE_SIMPLE(t->sprites.grid.player_borders
- [owner0->player_no][pedge->type][0]);
+ [owner0->index][pedge->type][0]);
}
if (owner1) {
ADD_SPRITE_SIMPLE(t->sprites.grid.player_borders
- [owner1->player_no][pedge->type][1]);
+ [owner1->index][pedge->type][1]);
}
}
}
@@ -3762,7 +3762,7 @@
}
}
if (owner) {
- ADD_SPRITE_SIMPLE(t->sprites.backgrounds.player[owner->player_no]);
+ ADD_SPRITE_SIMPLE(t->sprites.backgrounds.player[owner->index]);
} else if (ptile && !draw_terrain) {
ADD_SPRITE_SIMPLE(t->sprites.backgrounds.background);
}
@@ -4115,7 +4115,7 @@
enum color_std player_color(const struct player *pplayer)
{
return COLOR_STD_RACE0 +
- (pplayer->player_no %
+ (pplayer->index %
(COLOR_STD_RACE13 - COLOR_STD_RACE0 + 1));
}
Index: client/gui-ftwl/gui_text.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/gui_text.c,v
retrieving revision 1.6
diff -u -r1.6 gui_text.c
--- client/gui-ftwl/gui_text.c 23 Apr 2005 17:40:23 -0000 1.6
+++ client/gui-ftwl/gui_text.c 28 Apr 2005 20:41:01 -0000
@@ -394,8 +394,8 @@
if (owner == game.player_ptr){
add_line(_("Our Territory"));
} else if (owner) {
- if (ds[owner->player_no].type == DS_CEASEFIRE) {
- int turns = ds[owner->player_no].turns_left;
+ if (ds[owner->index].type == DS_CEASEFIRE) {
+ int turns = ds[owner->index].turns_left;
add_line(PL_("%s territory (%d turn ceasefire)",
"%s territory (%d turn ceasefire)",
@@ -403,7 +403,7 @@
get_nation_name(owner->nation), turns);
} else {
add_line(_("Territory of the %s %s"),
- diplo_nation_plural_adjectives[ds[owner->player_no].type],
+ diplo_nation_plural_adjectives[ds[owner->index].type],
get_nation_name_plural(owner->nation));
}
} else {
Index: client/gui-gtk-2.0/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/diplodlg.c,v
retrieving revision 1.29
diff -u -r1.29 diplodlg.c
--- client/gui-gtk-2.0/diplodlg.c 10 Apr 2005 19:52:05 -0000 1.29
+++ client/gui-gtk-2.0/diplodlg.c 28 Apr 2005 20:41:01 -0000
@@ -245,8 +245,8 @@
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
g_signal_connect(item, "activate",
G_CALLBACK(diplomacy_dialog_tech_callback),
- GINT_TO_POINTER((plr0->player_no << 24) |
- (plr1->player_no << 16) |
+ GINT_TO_POINTER((plr0->index << 24) |
+ (plr1->index << 16) |
i));
flag = TRUE;
}
@@ -296,8 +296,8 @@
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
g_signal_connect(item, "activate",
G_CALLBACK(diplomacy_dialog_city_callback),
- GINT_TO_POINTER((plr0->player_no << 24) |
- (plr1->player_no << 16) |
+ GINT_TO_POINTER((plr0->index << 24) |
+ (plr1->index << 16) |
city_list_ptrs[j]->id));
}
free(city_list_ptrs);
@@ -378,8 +378,8 @@
if (i == index[0]) {
dsend_packet_diplomacy_remove_clause_req(&aconnection,
pdialog->treaty.plr1->
- player_no,
- pclause->from->player_no,
+ index,
+ pclause->from->index,
pclause->type,
pclause->value);
return;
@@ -413,13 +413,13 @@
dsend_packet_diplomacy_accept_treaty_req(&aconnection,
pdialog->treaty.plr1->
- player_no);
+ index);
break;
default:
dsend_packet_diplomacy_cancel_meeting_req(&aconnection,
pdialog->treaty.plr1->
- player_no);
+ index);
gtk_widget_destroy(w);
break;
}
@@ -696,8 +696,8 @@
pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_MAP, 0);
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_MAP, 0);
}
/****************************************************************
@@ -711,8 +711,8 @@
pgiver = (struct player *)g_object_get_data(G_OBJECT(w), "plr");
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_SEAMAP,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_SEAMAP,
0);
}
@@ -725,8 +725,8 @@
struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *)data;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pdialog->treaty.plr0->player_no,
+ pdialog->treaty.plr1->index,
+ pdialog->treaty.plr0->index,
type, 0);
}
@@ -764,8 +764,8 @@
(struct player *) g_object_get_data(G_OBJECT(w), "plr");
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_VISION,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_VISION,
0);
}
@@ -779,8 +779,8 @@
(struct player *) g_object_get_data(G_OBJECT(w), "plr");
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_EMBASSY,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_EMBASSY,
0);
}
@@ -839,7 +839,7 @@
if (amount >= 0 && amount <= pgiver->economic.gold) {
dsend_packet_diplomacy_create_clause_req(&aconnection,
pdialog->treaty.plr1->
- player_no, pgiver->player_no,
+ index, pgiver->index,
CLAUSE_GOLD, amount);
} else {
append_output_window(_("Invalid amount of gold specified."));
Index: client/gui-gtk-2.0/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/plrdlg.c,v
retrieving revision 1.56
diff -u -r1.56 plrdlg.c
--- client/gui-gtk-2.0/plrdlg.c 11 Apr 2005 22:11:41 -0000 1.56
+++ client/gui-gtk-2.0/plrdlg.c 28 Apr 2005 20:41:01 -0000
@@ -620,14 +620,14 @@
players_iterate(pplayer) {
/* skip barbarians */
if (!is_barbarian(pplayer)) {
- if (!exists[pplayer->player_no]) {
+ if (!exists[pplayer->index]) {
/*
* A nation is not in the player report yet. This happens when
* the report is just opened and after a split.
*/
gtk_list_store_append(store, &it);
- build_row(&it, pplayer->player_no);
+ build_row(&it, pplayer->index);
}
}
} players_iterate_end;
Index: client/gui-gtk-2.0/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/spaceshipdlg.c,v
retrieving revision 1.17
diff -u -r1.17 spaceshipdlg.c
--- client/gui-gtk-2.0/spaceshipdlg.c 9 Mar 2005 18:37:52 -0000 1.17
+++ client/gui-gtk-2.0/spaceshipdlg.c 28 Apr 2005 20:41:01 -0000
@@ -117,7 +117,7 @@
pship=&(pdialog->pplayer->spaceship);
if(game.spacerace
- && pplayer->player_no == game.player_idx
+ && pplayer->index == game.player_idx
&& pship->state == SSHIP_STARTED
&& pship->success_rate > 0.0) {
gui_dialog_set_response_sensitive(pdialog->shell,
Index: client/gui-mui/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/diplodlg.c,v
retrieving revision 1.20
diff -u -r1.20 diplodlg.c
--- client/gui-mui/diplodlg.c 15 Feb 2005 16:43:22 -0000 1.20
+++ client/gui-mui/diplodlg.c 28 Apr 2005 20:41:01 -0000
@@ -88,8 +88,8 @@
{
struct packet_diplomacy_info pa;
- pa.plrno0=treaty->plr0->player_no;
- pa.plrno1=treaty->plr1->player_no;
+ pa.plrno0=treaty->plr0->index;
+ pa.plrno1=treaty->plr1->index;
send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_CANCEL_MEETING,
&pa);
}
@@ -98,8 +98,8 @@
{
struct packet_diplomacy_info pa;
- pa.plrno0=treaty->plr0->player_no;
- pa.plrno1=treaty->plr1->player_no;
+ pa.plrno0=treaty->plr0->index;
+ pa.plrno1=treaty->plr1->index;
pa.clause_type=type;
pa.plrno_from=from;
pa.value=value;
@@ -115,9 +115,9 @@
if (i == clause_no) {
struct packet_diplomacy_info pa;
- pa.plrno0=treaty->plr0->player_no;
- pa.plrno1=treaty->plr1->player_no;
- pa.plrno_from=pclause->from->player_no;
+ pa.plrno0=treaty->plr0->index;
+ pa.plrno1=treaty->plr1->index;
+ pa.plrno_from=pclause->from->index;
pa.clause_type=pclause->type;
pa.value=pclause->value;
send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_REMOVE_CLAUSE,
@@ -132,8 +132,8 @@
{
struct packet_diplomacy_info pa;
- pa.plrno0=treaty->plr0->player_no;
- pa.plrno1=treaty->plr1->player_no;
+ pa.plrno0=treaty->plr0->index;
+ pa.plrno1=treaty->plr1->index;
pa.plrno_from=from;
send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_ACCEPT_TREATY,
&pa);
@@ -220,7 +220,7 @@
struct Diplomacy_data
{
struct Diplomacy_dialog *pdialog;
- int playerno;
+ int index;
Object *obj;
};
@@ -263,7 +263,7 @@
{
entry = MUI_MakeObject(MUIO_Menuitem,advances[i].name,NULL,0,0);
set(entry,MUIA_UserData,i);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,6, MUIM_CallHook, &civstandard_hook, diplomacy_tech, pdialog,
plr0->player_no,entry);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,6, MUIM_CallHook, &civstandard_hook, diplomacy_tech, pdialog,
plr0->index,entry);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
flag = 1;
}
@@ -293,7 +293,7 @@
if (!is_capital(pcity)) {
entry = MUI_MakeObject(MUIO_Menuitem,pcity->name,NULL,0,0);
set(entry,MUIA_UserData,pcity->id);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,6, MUIM_CallHook, &civstandard_hook, diplomacy_city, pdialog,
plr0->player_no,entry);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,6, MUIM_CallHook, &civstandard_hook, diplomacy_city, pdialog,
plr0->index,entry);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
flag=1;
}
@@ -356,7 +356,7 @@
static void diplomacy_world_map( struct Diplomacy_data *data)
{
struct Diplomacy_dialog *pdialog = data->pdialog;
- request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_MAP,
data->playerno,0);
+ request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_MAP, data->index,0);
}
/****************************************************************
@@ -365,7 +365,7 @@
static void diplomacy_sea_map( struct Diplomacy_data *data)
{
struct Diplomacy_dialog *pdialog = data->pdialog;
- request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_SEAMAP,
data->playerno,0);
+ request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_SEAMAP,
data->index,0);
}
/****************************************************************
@@ -376,9 +376,9 @@
struct Diplomacy_dialog *pdialog = data->pdialog;
int amount = xget(data->obj, MUIA_String_Integer);
- if(amount>=0 && amount<=game.players[data->playerno].economic.gold)
+ if(amount>=0 && amount<=game.players[data->index].economic.gold)
{
- request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_GOLD,
data->playerno,amount);
+ request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_GOLD,
data->index,amount);
} else append_output_window(_("Invalid amount of gold specified."));
}
@@ -389,7 +389,7 @@
{
struct Diplomacy_dialog *pdialog = data->pdialog;
int tech = xget(data->obj, MUIA_UserData);
- request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_ADVANCE,
data->playerno,tech);
+ request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_ADVANCE,
data->index,tech);
}
/****************************************************************
@@ -399,7 +399,7 @@
{
struct Diplomacy_dialog *pdialog = data->pdialog;
int cityid = xget(data->obj, MUIA_UserData);
- request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_CITY,
data->playerno,cityid);
+ request_diplomacy_create_clause(&pdialog->treaty, CLAUSE_CITY,
data->index,cityid);
}
/****************************************************************
@@ -410,10 +410,10 @@
struct Diplomacy_dialog *pdialog = data->pdialog;
struct packet_diplomacy_info pa;
- pa.plrno0 = pdialog->treaty.plr0->player_no;
- pa.plrno1 = pdialog->treaty.plr1->player_no;
+ pa.plrno0 = pdialog->treaty.plr0->index;
+ pa.plrno1 = pdialog->treaty.plr1->index;
pa.clause_type = type;
- pa.plrno_from = pdialog->treaty.plr0->player_no;
+ pa.plrno_from = pdialog->treaty.plr0->index;
pa.value = 0;
send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_CREATE_CLAUSE,
&pa);
@@ -451,10 +451,10 @@
struct Diplomacy_dialog *pdialog = data->pdialog;
struct packet_diplomacy_info pa;
- pa.plrno0 = pdialog->treaty.plr0->player_no;
- pa.plrno1 = pdialog->treaty.plr1->player_no;
+ pa.plrno0 = pdialog->treaty.plr0->index;
+ pa.plrno1 = pdialog->treaty.plr1->index;
pa.clause_type = CLAUSE_VISION;
- pa.plrno_from = data->playerno;
+ pa.plrno_from = data->index;
pa.value = 0;
send_packet_diplomacy_info(&aconnection, PACKET_DIPLOMACY_CREATE_CLAUSE,
&pa);
@@ -554,11 +554,11 @@
{
Object *entry;
entry = MUI_MakeObject(MUIO_Menuitem,_("World-Map"),NULL,0,0);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_world_map, pdialog,
plr0->player_no);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_world_map, pdialog,
plr0->index);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
entry = MUI_MakeObject(MUIO_Menuitem,_("Sea-Map"),NULL,0,0);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_sea_map, pdialog,
plr0->player_no);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_sea_map, pdialog,
plr0->index);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
set(pdialog->plr0_maps_button,MUIA_ContextMenu,menu_strip);
}
@@ -572,11 +572,11 @@
{
Object *entry;
entry = MUI_MakeObject(MUIO_Menuitem,_("World-Map"),NULL,0,0);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_world_map, pdialog,
plr1->player_no);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_world_map, pdialog,
plr1->index);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
entry = MUI_MakeObject(MUIO_Menuitem,_("Sea-Map"),NULL,0,0);
- DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_sea_map, pdialog,
plr1->player_no);
+ DoMethod(entry,MUIM_Notify,MUIA_Menuitem_Trigger, MUIV_EveryTime,
entry,5, MUIM_CallHook, &civstandard_hook, diplomacy_sea_map, pdialog,
plr1->index);
DoMethod(menu_title,MUIM_Family_AddTail, entry);
set(pdialog->plr1_maps_button,MUIA_ContextMenu,menu_strip);
}
@@ -659,14 +659,14 @@
get_ruler_title(plr1->government,plr1->is_male,plr1->nation),
plr1->name);
- DoMethod(pdialog->plr0_vision_button, MUIM_Notify, MUIA_Pressed,FALSE,
app,5,MUIM_CallHook, &civstandard_hook, diplomacy_vision, pdialog,
plr0->player_no);
- DoMethod(pdialog->plr1_vision_button, MUIM_Notify, MUIA_Pressed,FALSE,
app,5,MUIM_CallHook, &civstandard_hook, diplomacy_vision, pdialog,
plr1->player_no);
+ DoMethod(pdialog->plr0_vision_button, MUIM_Notify, MUIA_Pressed,FALSE,
app,5,MUIM_CallHook, &civstandard_hook, diplomacy_vision, pdialog, plr0->index);
+ DoMethod(pdialog->plr1_vision_button, MUIM_Notify, MUIA_Pressed,FALSE,
app,5,MUIM_CallHook, &civstandard_hook, diplomacy_vision, pdialog, plr1->index);
DoMethod(pdialog->wnd, MUIM_Notify,
MUIA_Window_CloseRequest,TRUE,app,4,MUIM_CallHook, &civstandard_hook,
diplomacy_close,pdialog);
DoMethod(accept_treaty, MUIM_Notify, MUIA_Pressed,FALSE,
app,4,MUIM_CallHook, &civstandard_hook, diplomacy_accept_treaty,pdialog);
DoMethod(cancel_meeting, MUIM_Notify, MUIA_Pressed,FALSE,
app,4,MUIM_CallHook, &civstandard_hook, diplomacy_close,pdialog);
DoMethod(erase_clause, MUIM_Notify, MUIA_Pressed,FALSE,
app,4,MUIM_CallHook, &civstandard_hook, diplomacy_erase_clause,pdialog);
- DoMethod(pdialog->plr0_gold_integer, MUIM_Notify, MUIA_String_Acknowledge,
MUIV_EveryTime, app, 6, MUIM_CallHook, &civstandard_hook, diplomacy_gold,
pdialog, plr0->player_no,pdialog->plr0_gold_integer);
- DoMethod(pdialog->plr1_gold_integer, MUIM_Notify, MUIA_String_Acknowledge,
MUIV_EveryTime, app, 6, MUIM_CallHook, &civstandard_hook, diplomacy_gold,
pdialog, plr1->player_no,pdialog->plr1_gold_integer);
+ DoMethod(pdialog->plr0_gold_integer, MUIM_Notify, MUIA_String_Acknowledge,
MUIV_EveryTime, app, 6, MUIM_CallHook, &civstandard_hook, diplomacy_gold,
pdialog, plr0->index,pdialog->plr0_gold_integer);
+ DoMethod(pdialog->plr1_gold_integer, MUIM_Notify, MUIA_String_Acknowledge,
MUIV_EveryTime, app, 6, MUIM_CallHook, &civstandard_hook, diplomacy_gold,
pdialog, plr1->index,pdialog->plr1_gold_integer);
DoMethod(app,OM_ADDMEMBER,pdialog->wnd);
return pdialog;
Index: client/gui-mui/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/plrdlg.c,v
retrieving revision 1.30
diff -u -r1.30 plrdlg.c
--- client/gui-mui/plrdlg.c 15 Feb 2005 16:43:22 -0000 1.30
+++ client/gui-mui/plrdlg.c 28 Apr 2005 20:41:01 -0000
@@ -91,11 +91,11 @@
*****************************************************************/
HOOKPROTONH(players_render, void, char **array, APTR msg)
{
- ULONG playerno = (ULONG) msg;
+ ULONG index = (ULONG) msg;
- if (playerno)
+ if (index)
{
- int i = playerno - 100;
+ int i = index - 100;
static char idlebuf[32];
static char statebuf[32];
static char namebuf[32];
@@ -180,15 +180,15 @@
*****************************************************************/
static void players_active(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if (playerno)
+ if (index)
{
struct player *pplayer;
- playerno -= 100;
+ index -= 100;
- pplayer = get_player(playerno);
+ pplayer = get_player(index);
if (pplayer->spaceship.state != SSHIP_NONE)
set(player_spaceship_button, MUIA_Disabled, FALSE);
@@ -202,7 +202,7 @@
break;
default:
- set(player_war_button, MUIA_Disabled, game.player_idx == playerno);
+ set(player_war_button, MUIA_Disabled, game.player_idx == index);
break;
}
@@ -224,15 +224,15 @@
**************************************************************************/
static void players_intelligence(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if (playerno)
+ if (index)
{
- playerno -= 100;
+ index -= 100;
- if (can_intel_with_player(&game.players[playerno])) {
- popup_intel_dialog(&game.players[playerno]);
+ if (can_intel_with_player(&game.players[index])) {
+ popup_intel_dialog(&game.players[index]);
}
}
}
@@ -242,15 +242,15 @@
*****************************************************************/
static void players_meet(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if (playerno)
+ if (index)
{
- playerno -= 100;
+ index -= 100;
- if (can_meet_with_player(&game.players[playerno])) {
- request_diplomacy_init_meeting(game.player_idx, playerno);
+ if (can_meet_with_player(&game.players[index])) {
+ request_diplomacy_init_meeting(game.player_idx, index);
} else {
append_output_window(_("You need an embassy to establish a "
"diplomatic meeting."));
@@ -263,14 +263,14 @@
*****************************************************************/
static void players_war(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if(playerno)
+ if(index)
{
struct packet_generic_values packet;
- packet.id = playerno - 100;
+ packet.id = index - 100;
packet.value1 = CLAUSE_CEASEFIRE;
send_packet_generic_values(&aconnection, PACKET_PLAYER_CANCEL_PACT,
&packet);
@@ -282,14 +282,14 @@
**************************************************************************/
void players_vision(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if(playerno)
+ if(index)
{
struct packet_generic_values packet;
- packet.id = playerno - 100;
+ packet.id = index - 100;
packet.value1 = CLAUSE_VISION;
send_packet_generic_values(&aconnection,
PACKET_PLAYER_CANCEL_PACT, &packet);
@@ -301,12 +301,12 @@
*****************************************************************/
static void players_spaceship(void)
{
- LONG playerno;
- DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &playerno);
+ LONG index;
+ DoMethod(player_players_listview, MUIM_NList_GetEntry,
MUIV_NList_GetEntry_Active, &index);
- if(playerno)
+ if(index)
{
- popup_spaceship_dialog(&game.players[playerno-100]);
+ popup_spaceship_dialog(&game.players[index-100]);
}
}
Index: client/gui-mui/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/spaceshipdlg.c,v
retrieving revision 1.17
diff -u -r1.17 spaceshipdlg.c
--- client/gui-mui/spaceshipdlg.c 22 Jan 2005 19:45:40 -0000 1.17
+++ client/gui-mui/spaceshipdlg.c 28 Apr 2005 20:41:01 -0000
@@ -114,7 +114,7 @@
pship = &(pdialog->pplayer->spaceship);
if (game.spacerace
- && pplayer->player_no == game.player_idx
+ && pplayer->index == game.player_idx
&& pship->state == SSHIP_STARTED
&& pship->success_rate > 0)
{
@@ -200,7 +200,7 @@
pdialog->wnd = WindowObject,
MUIA_Window_Title, pplayer->name,
- MUIA_Window_ID, MAKE_ID('S','P','A',(pplayer->player_no & 0xff)),
+ MUIA_Window_ID, MAKE_ID('S','P','A',(pplayer->index & 0xff)),
WindowContents, VGroup,
Child, HGroup,
Child, ScrollgroupObject,
Index: client/gui-sdl/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/dialogs.c,v
retrieving revision 1.57
diff -u -r1.57 dialogs.c
--- client/gui-sdl/dialogs.c 23 Apr 2005 17:40:25 -0000 1.57
+++ client/gui-sdl/dialogs.c 28 Apr 2005 20:41:02 -0000
@@ -933,8 +933,8 @@
if (pTile->owner == game.player_ptr){
cat_snprintf(cBuf, sizeof(cBuf), _("\nOur Territory"));
} else if (pTile->owner) {
- if (ds[pTile->owner->player_no].type == DS_CEASEFIRE){
- int turns = ds[pTile->owner->player_no].turns_left;
+ if (ds[pTile->owner->index].type == DS_CEASEFIRE){
+ int turns = ds[pTile->owner->index].turns_left;
cat_snprintf(cBuf, sizeof(cBuf),
PL_("\n%s territory (%d turn ceasefire)",
@@ -942,7 +942,7 @@
get_nation_name(pTile->owner->nation), turns);
} else {
cat_snprintf(cBuf, sizeof(cBuf), _("\nTerritory of the %s %s"),
-
diplo_nation_plural_adjectives[ds[pTile->owner->player_no].type],
+ diplo_nation_plural_adjectives[ds[pTile->owner->index].type],
get_nation_name_plural(pTile->owner->nation));
}
} else {
@@ -965,8 +965,8 @@
cat_snprintf(cBuf, sizeof(cBuf), _(" with City Walls"));
}
if (pOwner && pOwner != game.player_ptr) {
- if (ds[pOwner->player_no].type == DS_CEASEFIRE) {
- int turns = ds[pOwner->player_no].turns_left;
+ if (ds[pOwner->index].type == DS_CEASEFIRE) {
+ int turns = ds[pOwner->index].turns_left;
cat_snprintf(cBuf, sizeof(cBuf), PL_("\n(%s, %d turn ceasefire)",
"\n(%s, %d turn ceasefire)", turns),
@@ -975,7 +975,7 @@
/* TRANS: "\nCity: <name> (<nation>,<diplomatic_state>)" */
cat_snprintf(cBuf, sizeof(cBuf), _("\n(%s,%s)"),
get_nation_name(pOwner->nation),
- diplo_city_adjectives[ds[pOwner->player_no].type]);
+ diplo_city_adjectives[ds[pOwner->index].type]);
}
}
}
Index: client/gui-sdl/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/diplodlg.c,v
retrieving revision 1.16
diff -u -r1.16 diplodlg.c
--- client/gui-sdl/diplodlg.c 15 Feb 2005 16:43:22 -0000 1.16
+++ client/gui-sdl/diplodlg.c 28 Apr 2005 20:41:02 -0000
@@ -465,8 +465,8 @@
enum diplstate_type type =
pplayer_get_diplstate(pPlayer0, pPlayer1)->type;
- pCont->id0 = pPlayer0->player_no;
- pCont->id1 = pPlayer1->player_no;
+ pCont->id0 = pPlayer0->index;
+ pCont->id1 = pPlayer1->index;
hh = WINDOW_TILE_HIGH + 2;
pStr = create_str16_from_char(get_nation_name(pPlayer0->nation), 12);
@@ -813,13 +813,13 @@
pClauses_Dlg = MALLOC(sizeof(struct ADVANCED_DLG));
- /*if(game.player_idx != pPlayer0->player_no) {
+ /*if(game.player_idx != pPlayer0->index) {
pPlayer0 = pPlayer1;
pPlayer1 = game.player_idx;
}*/
- pCont->id0 = pPlayer0->player_no;
- pCont->id1 = pPlayer1->player_no;
+ pCont->id0 = pPlayer0->index;
+ pCont->id1 = pPlayer1->index;
my_snprintf(cBuf, sizeof(cBuf), _("Diplomacy meeting"));
@@ -1020,7 +1020,7 @@
popdown_sdip_dialog();
dsend_packet_diplomacy_cancel_pact(&aconnection,
- pWidget->data.player->player_no,
+ pWidget->data.player->index,
CLAUSE_VISION);
flush_dirty();
@@ -1032,7 +1032,7 @@
popdown_sdip_dialog();
dsend_packet_diplomacy_cancel_pact(&aconnection,
- pWidget->data.player->player_no,
+ pWidget->data.player->index,
CLAUSE_CEASEFIRE);
flush_dirty();
@@ -1044,7 +1044,7 @@
popdown_sdip_dialog();
dsend_packet_diplomacy_init_meeting_req(&aconnection,
- pWidget->data.player->player_no);
+ pWidget->data.player->index);
flush_dirty();
return -1;
Index: client/gui-sdl/gotodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gotodlg.c,v
retrieving revision 1.8
diff -u -r1.8 gotodlg.c
--- client/gui-sdl/gotodlg.c 17 Jul 2004 13:35:13 -0000 1.8
+++ client/gui-sdl/gotodlg.c 28 Apr 2005 20:41:02 -0000
@@ -67,7 +67,7 @@
static int toggle_goto_nations_cities_dialog_callback(struct GUI *pWidget)
{
- all_players ^= (1u << (get_player(MAX_ID - pWidget->ID)->player_no));
+ all_players ^= (1u << (get_player(MAX_ID - pWidget->ID)->index));
update_goto_dialog();
return -1;
}
@@ -116,7 +116,7 @@
for(i = 0; i < game.nplayers; i++) {
- if (!TEST_BIT(all_players, game.players[i].player_no)) {
+ if (!TEST_BIT(all_players, game.players[i].index)) {
continue;
}
@@ -272,7 +272,7 @@
FREESURFACE(pFlag);
pBuf = create_checkbox(pWindow->dst,
- TEST_BIT(all_players, game.players[i].player_no),
+ TEST_BIT(all_players, game.players[i].index),
(WF_FREE_STRING|WF_FREE_THEME|WF_DRAW_THEME_TRANSPARENT|WF_WIDGET_HAS_INFO_LABEL));
set_new_checkbox_theme(pBuf, pEnabled, pDisabled);
@@ -360,7 +360,7 @@
if (!can_client_issue_orders() || !get_unit_in_focus()) {
return;
}
- all_players = (1u << (game.player_ptr->player_no));
+ all_players = (1u << (game.player_ptr->index));
popup_goto_airlift_dialog();
}
@@ -372,7 +372,7 @@
if (!can_client_issue_orders() || !get_unit_in_focus()) {
return;
}
- all_players = (1u << (game.player_ptr->player_no));
+ all_players = (1u << (game.player_ptr->index));
GOTO = FALSE;
popup_goto_airlift_dialog();
}
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.84
diff -u -r1.84 mapview.c
--- client/gui-sdl/mapview.c 23 Apr 2005 17:40:25 -0000 1.84
+++ client/gui-sdl/mapview.c 28 Apr 2005 20:41:02 -0000
@@ -630,8 +630,8 @@
cat_snprintf(buffer, sizeof(buffer), _("\nOur Territory"));
} else {
if (pTile->owner) {
- if
(game.player_ptr->diplstates[pTile->owner->player_no].type==DS_CEASEFIRE){
- int turns =
game.player_ptr->diplstates[pTile->owner->player_no].turns_left;
+ if
(game.player_ptr->diplstates[pTile->owner->index].type==DS_CEASEFIRE){
+ int turns =
game.player_ptr->diplstates[pTile->owner->index].turns_left;
cat_snprintf(buffer, sizeof(buffer),
PL_("\n%s territory (%d turn ceasefire)",
"\n%s territory (%d turn ceasefire)", turns),
@@ -639,7 +639,7 @@
} else {
cat_snprintf(buffer, sizeof(buffer), _("\nTerritory of the %s
%s"),
diplo_nation_plural_adjectives[
-
game.player_ptr->diplstates[pTile->owner->player_no].type],
+ game.player_ptr->diplstates[pTile->owner->index].type],
get_nation_name_plural(pTile->owner->nation));
}
} else { /* !pTile->owner */
@@ -700,7 +700,7 @@
cat_snprintf(buffer, sizeof(buffer), _("\n(%s,%s)"),
get_nation_name(pOwner->nation),
diplo_city_adjectives[game.player_ptr->
- diplstates[pOwner->player_no].type]);
+ diplstates[pOwner->index].type]);
}
}
@@ -1822,7 +1822,7 @@
&& (pBorder_Tile = map_get_tile(x1, y1))
&& (this_owner != pBorder_Tile->owner)
&& pBorder_Tile->known) {
- SDL_BlitSurface(pMapBorders[this_owner->player_no][0], NULL,
pBufSurface, &des);
+ SDL_BlitSurface(pMapBorders[this_owner->index][0], NULL, pBufSurface,
&des);
des = dst;
}
/* top side */
@@ -1830,7 +1830,7 @@
&& (pBorder_Tile = map_get_tile(x1, y1))
&& (this_owner != pBorder_Tile->owner)
&& pBorder_Tile->known) {
- SDL_BlitSurface(pMapBorders[this_owner->player_no][1], NULL,
pBufSurface, &des);
+ SDL_BlitSurface(pMapBorders[this_owner->index][1], NULL, pBufSurface,
&des);
des = dst;
}
/* right side */
@@ -1838,7 +1838,7 @@
&& (pBorder_Tile = map_get_tile(x1, y1))
&& (this_owner != pBorder_Tile->owner)
&& pBorder_Tile->known) {
- SDL_BlitSurface(pMapBorders[this_owner->player_no][2], NULL,
pBufSurface, &des);
+ SDL_BlitSurface(pMapBorders[this_owner->index][2], NULL, pBufSurface,
&des);
des = dst;
}
/* bottom side */
@@ -1846,7 +1846,7 @@
&& (pBorder_Tile = map_get_tile(x1, y1))
&& (this_owner != pBorder_Tile->owner)
&& pBorder_Tile->known) {
- SDL_BlitSurface(pMapBorders[this_owner->player_no][3], NULL,
pBufSurface, &des);
+ SDL_BlitSurface(pMapBorders[this_owner->index][3], NULL, pBufSurface,
&des);
des = dst;
}
}
Index: client/gui-sdl/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/plrdlg.c,v
retrieving revision 1.13
diff -u -r1.13 plrdlg.c
--- client/gui-sdl/plrdlg.c 2 Nov 2003 20:50:30 -0000 1.13
+++ client/gui-sdl/plrdlg.c 28 Apr 2005 20:41:03 -0000
@@ -587,7 +587,7 @@
}
break;
default:
- if(pPlayer->player_no != game.player_idx) {
+ if(pPlayer->index != game.player_idx) {
popup_diplomacy_dialog(pPlayer);
}
break;
Index: client/gui-sdl/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/spaceshipdlg.c,v
retrieving revision 1.10
diff -u -r1.10 spaceshipdlg.c
--- client/gui-sdl/spaceshipdlg.c 10 Feb 2005 18:35:17 -0000 1.10
+++ client/gui-sdl/spaceshipdlg.c 28 Apr 2005 20:41:03 -0000
@@ -119,7 +119,7 @@
/* launch button */
pBuf = pSpaceShp->pEndWidgetList->prev->prev;
if(game.spacerace
- && pPlayer->player_no == game.player_idx
+ && pPlayer->index == game.player_idx
&& pPlayer->spaceship.state == SSHIP_STARTED
&& pPlayer->spaceship.success_rate > 0.0) {
set_wstate(pBuf, FC_WS_NORMAL);
Index: client/gui-win32/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/diplodlg.c,v
retrieving revision 1.28
diff -u -r1.28 diplodlg.c
--- client/gui-win32/diplodlg.c 28 Mar 2005 16:59:15 -0000 1.28
+++ client/gui-win32/diplodlg.c 28 Apr 2005 20:41:03 -0000
@@ -129,7 +129,7 @@
static void diplomacy_dialog_close(struct Diplomacy_dialog *pdialog)
{
dsend_packet_diplomacy_cancel_meeting_req(&aconnection,
- pdialog->treaty.plr1->player_no);
+ pdialog->treaty.plr1->index);
DestroyWindow(pdialog->mainwin);
}
@@ -178,8 +178,8 @@
|| get_invention(plr1, i) == TECH_REACHABLE)
&& tech_is_available(plr1, i)) {
AppendMenu(menu,MF_STRING,ID_ADVANCES_BASE+i,advances[i].name);
- iteminfo.dwItemData = plr0->player_no * MAX_NUM_ITEMS * MAX_NUM_ITEMS +
- plr1->player_no * MAX_NUM_ITEMS + i;
+ iteminfo.dwItemData = plr0->index * MAX_NUM_ITEMS * MAX_NUM_ITEMS +
+ plr1->index * MAX_NUM_ITEMS + i;
iteminfo.fMask = MIIM_DATA;
iteminfo.cbSize = sizeof(MENUITEMINFO);
SetMenuItemInfo(menu, ID_ADVANCES_BASE+i, FALSE, &iteminfo);
@@ -226,7 +226,7 @@
for(j=0; j<i; j++) {
AppendMenu(menu,MF_STRING,ID_CITIES_BASE+j,city_list_ptrs[j]->name);
iteminfo.dwItemData=city_list_ptrs[j]->id*1024 +
- plr0->player_no*32 + plr1->player_no;
+ plr0->index*32 + plr1->index;
iteminfo.fMask = MIIM_DATA;
iteminfo.cbSize = sizeof(MENUITEMINFO);
SetMenuItemInfo(menu, ID_CITIES_BASE+j, FALSE, &iteminfo);
@@ -256,8 +256,8 @@
if (sscanf(buf, "%d", &amount) == 1 && amount >= 0
&& amount <= pgiver->economic.gold) {
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no,
+ pdialog->treaty.plr1->index,
+ pgiver->index,
CLAUSE_GOLD, amount);
} else {
append_output_window(_("Invalid amount of gold specified."));
@@ -274,8 +274,8 @@
pgiver=plr?pdialog->treaty.plr1:pdialog->treaty.plr0;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_VISION,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_VISION,
0);
}
@@ -288,8 +288,8 @@
pgiver = plr ? pdialog->treaty.plr1 : pdialog->treaty.plr0;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_EMBASSY,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_EMBASSY,
0);
}
@@ -327,8 +327,8 @@
struct player *pgiver;
pgiver=plr?pdialog->treaty.plr1:pdialog->treaty.plr0;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_SEAMAP,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_SEAMAP,
0);
}
@@ -340,8 +340,8 @@
struct player *pgiver;
pgiver=plr?pdialog->treaty.plr1:pdialog->treaty.plr0;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_MAP,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_MAP,
0);
}
@@ -357,7 +357,7 @@
choice -= plrno0 * 32;
plrno1 = choice;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
+ pdialog->treaty.plr1->index,
plrno0, CLAUSE_CITY, value);
}
@@ -373,7 +373,7 @@
int value = choice % MAX_NUM_ITEMS;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
+ pdialog->treaty.plr1->index,
plrno0, CLAUSE_ADVANCE, value);
}
@@ -384,8 +384,8 @@
int type)
{
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pdialog->treaty.plr0->player_no,
+ pdialog->treaty.plr1->index,
+ pdialog->treaty.plr0->index,
type, 0);
}
@@ -402,8 +402,8 @@
clause_list_iterate(pdialog->treaty.clauses, pclause) {
if(i == row) {
dsend_packet_diplomacy_remove_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pclause->from->player_no,
+ pdialog->treaty.plr1->index,
+ pclause->from->index,
pclause->type, pclause->value);
return;
}
@@ -417,7 +417,7 @@
static void handle_accept_button(struct Diplomacy_dialog *pdialog)
{
dsend_packet_diplomacy_accept_treaty_req(&aconnection,
- pdialog->treaty.plr1->player_no);
+ pdialog->treaty.plr1->index);
}
/****************************************************************
Index: client/gui-win32/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/spaceshipdlg.c,v
retrieving revision 1.16
diff -u -r1.16 spaceshipdlg.c
--- client/gui-win32/spaceshipdlg.c 23 Mar 2005 22:27:10 -0000 1.16
+++ client/gui-win32/spaceshipdlg.c 28 Apr 2005 20:41:03 -0000
@@ -105,7 +105,7 @@
pship=&(pdialog->pplayer->spaceship);
if(game.spacerace
- && pplayer->player_no == game.player_idx
+ && pplayer->index == game.player_idx
&& pship->state == SSHIP_STARTED
&& pship->success_rate > 0) {
EnableWindow(GetDlgItem(pdialog->mainwin,IDOK),TRUE);
Index: client/gui-xaw/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/diplodlg.c,v
retrieving revision 1.41
diff -u -r1.41 diplodlg.c
--- client/gui-xaw/diplodlg.c 15 Feb 2005 16:43:23 -0000 1.41
+++ client/gui-xaw/diplodlg.c 28 Apr 2005 20:41:03 -0000
@@ -257,8 +257,8 @@
XtVaCreateManagedWidget(advances[i].name, smeBSBObjectClass,
popupmenu, NULL);
XtAddCallback(entry, XtNcallback, diplomacy_dialog_tech_callback,
- INT_TO_XTPOINTER((plr0->player_no << 24) |
- (plr1->player_no << 16) |
+ INT_TO_XTPOINTER((plr0->index << 24) |
+ (plr1->index << 16) |
i));
flag=1;
}
@@ -298,8 +298,8 @@
XtVaCreateManagedWidget(city_list_ptrs[j]->name, smeBSBObjectClass,
popupmenu, NULL);
XtAddCallback(entry, XtNcallback, diplomacy_dialog_city_callback,
- INT_TO_XTPOINTER((plr0->player_no << 24) |
- (plr1->player_no << 16) |
+ INT_TO_XTPOINTER((plr0->index << 24) |
+ (plr1->index << 16) |
city_list_ptrs[j]->id));
}
free(city_list_ptrs);
@@ -737,8 +737,8 @@
if (i == ret->list_index) {
dsend_packet_diplomacy_remove_clause_req(&aconnection,
pdialog->treaty.plr1->
- player_no,
- pclause->from->player_no,
+ index,
+ pclause->from->index,
pclause->type,
pclause->value);
return;
@@ -761,8 +761,8 @@
treaty.plr1;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_MAP, 0);
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_MAP, 0);
}
/****************************************************************
@@ -778,8 +778,8 @@
treaty.plr1;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_SEAMAP,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_SEAMAP,
0);
}
@@ -794,8 +794,8 @@
pdialog->treaty.plr0 : pdialog->treaty.plr1;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, CLAUSE_VISION,
+ pdialog->treaty.plr1->index,
+ pgiver->index, CLAUSE_VISION,
0);
}
@@ -810,8 +810,8 @@
pdialog->treaty.plr0 : pdialog->treaty.plr1;
dsend_packet_diplomacy_create_clause_req(&aconnection,
- pdialog->treaty.plr1->player_no,
- pgiver->player_no, type, 0);
+ pdialog->treaty.plr1->index,
+ pgiver->index, type, 0);
}
/****************************************************************
@@ -857,7 +857,7 @@
struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) client_data;
dsend_packet_diplomacy_cancel_meeting_req(&aconnection,
- pdialog->treaty.plr1->player_no);
+ pdialog->treaty.plr1->index);
close_diplomacy_dialog(pdialog);
}
@@ -871,7 +871,7 @@
struct Diplomacy_dialog *pdialog = (struct Diplomacy_dialog *) client_data;
dsend_packet_diplomacy_accept_treaty_req(&aconnection,
- pdialog->treaty.plr1->player_no);
+ pdialog->treaty.plr1->index);
}
@@ -940,7 +940,7 @@
&& amount <= pgiver->economic.gold) {
dsend_packet_diplomacy_create_clause_req(&aconnection,
pdialog->treaty.plr1->
- player_no, pgiver->player_no,
+ index, pgiver->index,
CLAUSE_GOLD, amount);
XtVaSetValues(w, XtNstring, "", NULL);
}
Index: client/gui-xaw/inteldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/inteldlg.c,v
retrieving revision 1.26
diff -u -r1.26 inteldlg.c
--- client/gui-xaw/inteldlg.c 19 Mar 2005 22:41:38 -0000 1.26
+++ client/gui-xaw/inteldlg.c 28 Apr 2005 20:41:03 -0000
@@ -300,7 +300,7 @@
intel_close_callback, (XtPointer)pdialog);
XtAddCallback(pdialog->intel_diplo_command, XtNcallback,
intel_diplo_callback,
- INT_TO_XTPOINTER(pdialog->pplayer->player_no));
+ INT_TO_XTPOINTER(pdialog->pplayer->index));
XtRealizeWidget(pdialog->intel_dialog_shell);
xaw_horiz_center(pdialog->intel_label);
Index: client/gui-xaw/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/spaceshipdlg.c,v
retrieving revision 1.25
diff -u -r1.25 spaceshipdlg.c
--- client/gui-xaw/spaceshipdlg.c 19 Mar 2005 22:41:38 -0000 1.25
+++ client/gui-xaw/spaceshipdlg.c 28 Apr 2005 20:41:03 -0000
@@ -124,7 +124,7 @@
pship=&(pdialog->pplayer->spaceship);
if(game.spacerace
- && pplayer->player_no == game.player_idx
+ && pplayer->index == game.player_idx
&& pship->state == SSHIP_STARTED
&& pship->success_rate > 0) {
XtSetSensitive(pdialog->launch_command, TRUE);
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.333
diff -u -r1.333 city.c
--- common/city.c 28 Apr 2005 03:47:55 -0000 1.333
+++ common/city.c 28 Apr 2005 20:41:03 -0000
@@ -2523,7 +2523,7 @@
pcity = fc_malloc(sizeof(struct city));
pcity->id = 0;
- pcity->owner = pplayer->player_no;
+ pcity->owner = pplayer->index;
pcity->tile = ptile;
sz_strlcpy(pcity->name, name);
pcity->size = 1;
@@ -2543,7 +2543,7 @@
}
pcity->food_stock = 0;
pcity->shield_stock = 0;
- pcity->original = pplayer->player_no;
+ pcity->original = pplayer->index;
/* Initialise improvements list */
for (i = 0; i < ARRAY_SIZE(pcity->improvements); i++) {
Index: common/diptreaty.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.c,v
retrieving revision 1.30
diff -u -r1.30 diptreaty.c
--- common/diptreaty.c 26 Jan 2005 17:50:52 -0000 1.30
+++ common/diptreaty.c 28 Apr 2005 20:41:04 -0000
@@ -52,8 +52,8 @@
&& diplomacy_possible(pplayer,aplayer)
&& (player_has_embassy(aplayer, pplayer)
|| player_has_embassy(pplayer, aplayer)
- || pplayer->diplstates[aplayer->player_no].contact_turns_left > 0
- || aplayer->diplstates[pplayer->player_no].contact_turns_left >
0)
+ || pplayer->diplstates[aplayer->index].contact_turns_left > 0
+ || aplayer->diplstates[pplayer->index].contact_turns_left > 0)
&& (aplayer->is_connected || aplayer->ai.control)
&& (pplayer->is_connected || pplayer->ai.control));
}
@@ -67,8 +67,8 @@
return (pplayer->is_alive
&& aplayer->is_alive
&& pplayer != aplayer
- && (pplayer->diplstates[aplayer->player_no].contact_turns_left > 0
- || aplayer->diplstates[pplayer->player_no].contact_turns_left > 0
+ && (pplayer->diplstates[aplayer->index].contact_turns_left > 0
+ || aplayer->diplstates[pplayer->index].contact_turns_left > 0
|| player_has_embassy(pplayer, aplayer)));
}
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.207
diff -u -r1.207 game.c
--- common/game.c 27 Apr 2005 16:31:46 -0000 1.207
+++ common/game.c 28 Apr 2005 20:41:04 -0000
@@ -463,7 +463,7 @@
for (i = plrno; i < game.nplayers - 1; i++) {
game.players[i]=game.players[i+1];
- game.players[i].player_no=i;
+ game.players[i].index=i;
conn_list_iterate(game.players[i].connections, pconn)
pconn->player = &game.players[i];
conn_list_iterate_end;
@@ -513,7 +513,7 @@
**************************************************************************/
bool is_player_phase(const struct player *pplayer, int phase)
{
- return game.simultaneous_phases_now || pplayer->player_no == phase;
+ return game.simultaneous_phases_now || pplayer->index == phase;
}
/***************************************************************
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.108
diff -u -r1.108 packets.def
--- common/packets.def 23 Apr 2005 04:26:57 -0000 1.108
+++ common/packets.def 28 Apr 2005 20:41:04 -0000
@@ -547,7 +547,7 @@
end
PACKET_PLAYER_INFO=39; is-info,sc
- PLAYER playerno; key
+ PLAYER index; key
STRING name[MAX_LEN_NAME];
STRING username[MAX_LEN_NAME];
Index: common/player.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.c,v
retrieving revision 1.174
diff -u -r1.174 player.c
--- common/player.c 23 Apr 2005 17:40:27 -0000 1.174
+++ common/player.c 28 Apr 2005 20:41:05 -0000
@@ -64,7 +64,7 @@
bool player_has_embassy(const struct player *pplayer,
const struct player *pplayer2)
{
- return (TEST_BIT(pplayer->embassy, pplayer2->player_no)
+ return (TEST_BIT(pplayer->embassy, pplayer2->index)
|| (pplayer == pplayer2)
|| (get_player_bonus(pplayer, EFT_HAVE_EMBASSIES) > 0
&& !is_barbarian(pplayer2)));
@@ -79,7 +79,7 @@
/* better safe than sorry */
return FALSE;
}
- return (pcity->owner==pplayer->player_no);
+ return (pcity->owner==pplayer->index);
}
/***************************************************************
@@ -101,7 +101,7 @@
{
int i;
- plr->player_no=plr-game.players;
+ plr->index=plr-game.players;
sz_strlcpy(plr->name, ANON_PLAYER_NAME);
sz_strlcpy(plr->username, ANON_USER_NAME);
@@ -338,7 +338,7 @@
{
struct city *pcity = idex_lookup_city(city_id);
- if(pcity && (pcity->owner==pplayer->player_no)) {
+ if(pcity && (pcity->owner==pplayer->index)) {
return pcity;
} else {
return NULL;
@@ -355,7 +355,7 @@
{
struct unit *punit = idex_lookup_unit(unit_id);
- if(punit && (punit->owner==pplayer->player_no)) {
+ if(punit && (punit->owner==pplayer->index)) {
return punit;
} else {
return NULL;
@@ -371,7 +371,7 @@
struct city *pcity;
map_city_radius_iterate(ptile, ptile1) {
pcity = tile_get_city(ptile1);
- if (pcity && (pcity->owner == pplayer->player_no))
+ if (pcity && (pcity->owner == pplayer->index))
return TRUE;
} map_city_radius_iterate_end;
return FALSE;
@@ -615,7 +615,7 @@
const struct player_diplstate *pplayer_get_diplstate(const struct player
*pplayer,
const struct player
*pplayer2)
{
- return &(pplayer->diplstates[pplayer2->player_no]);
+ return &(pplayer->diplstates[pplayer2->index]);
}
/***************************************************************
@@ -705,7 +705,7 @@
**************************************************************************/
bool gives_shared_vision(const struct player *me, const struct player *them)
{
- return TEST_BIT(me->gives_shared_vision, them->player_no);
+ return TEST_BIT(me->gives_shared_vision, them->index);
}
/**************************************************************************
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.145
diff -u -r1.145 player.h
--- common/player.h 19 Apr 2005 22:05:58 -0000 1.145
+++ common/player.h 28 Apr 2005 20:41:05 -0000
@@ -184,7 +184,7 @@
BV_DEFINE(bv_debug, PLAYER_DEBUG_LAST);
struct player {
- int player_no;
+ int index;
char name[MAX_LEN_NAME];
char username[MAX_LEN_NAME];
bool is_male;
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.235
diff -u -r1.235 unit.c
--- common/unit.c 27 Apr 2005 02:48:00 -0000 1.235
+++ common/unit.c 28 Apr 2005 20:41:05 -0000
@@ -1420,7 +1420,7 @@
struct unit *punit = fc_calloc(1, sizeof(struct unit));
punit->type = type;
- punit->owner = pplayer->player_no;
+ punit->owner = pplayer->index;
if (pcity) {
punit->tile = pcity->tile;
punit->homecity = pcity->id;
Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.87
diff -u -r1.87 barbarian.c
--- server/barbarian.c 23 Apr 2005 17:40:28 -0000 1.87
+++ server/barbarian.c 28 Apr 2005 20:41:05 -0000
@@ -146,13 +146,13 @@
/* Ensure that we are at war with everyone else */
players_iterate(pplayer) {
if (pplayer != barbarians) {
- pplayer->diplstates[barbarians->player_no].type = DS_WAR;
- barbarians->diplstates[pplayer->player_no].type = DS_WAR;
+ pplayer->diplstates[barbarians->index].type = DS_WAR;
+ barbarians->diplstates[pplayer->index].type = DS_WAR;
}
} players_iterate_end;
freelog(LOG_VERBOSE, "Created barbarian %s, player %d",
- barbarians->name, barbarians->player_no);
+ barbarians->name, barbarians->index);
notify_player_ex(NULL, NULL, E_UPRISING,
_("Barbarians gain a leader by the name %s. Dangerous "
"times may lie ahead."), barbarians->name);
@@ -213,7 +213,7 @@
unit_cnt = 3 + myrand(4);
barbarians = create_barbarian_player(TRUE);
- me = barbarians->player_no;
+ me = barbarians->index;
for (i = 0; i < unit_cnt; i++) {
unit = find_a_unit_type(L_BARBARIAN, L_BARBARIAN_TECH);
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.314
diff -u -r1.314 citytools.c
--- server/citytools.c 25 Apr 2005 19:28:22 -0000 1.314
+++ server/citytools.c 28 Apr 2005 20:41:06 -0000
@@ -788,7 +788,7 @@
/* Has to follow the unfog call above. */
city_list_unlink(pgiver->cities, pcity);
- pcity->owner = ptaker->player_no;
+ pcity->owner = ptaker->index;
city_list_prepend(ptaker->cities, pcity);
/* Update the national borders. */
@@ -1210,7 +1210,7 @@
pplayer->economic.gold += coins;
cplayer->economic.gold -= coins;
send_player_info(cplayer, cplayer);
- if (pcity->original != pplayer->player_no) {
+ if (pcity->original != pplayer->index) {
notify_player_ex(pplayer, pcity->tile, E_UNIT_WIN_ATT,
_("You conquer %s, your lootings accumulate"
" to %d gold!"),
@@ -1863,7 +1863,7 @@
return FALSE;
}
- if (ptile->owner && ptile->owner->player_no != pcity->owner) {
+ if (ptile->owner && ptile->owner->index != pcity->owner) {
return FALSE;
}
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.307
diff -u -r1.307 cityturn.c
--- server/cityturn.c 24 Apr 2005 06:18:28 -0000 1.307
+++ server/cityturn.c 28 Apr 2005 20:41:06 -0000
@@ -1303,7 +1303,7 @@
/* Buy back is cheap, conquered cities are also cheap */
if (pcity->owner != pcity->original) {
- if (pplayer->player_no == pcity->original) {
+ if (pplayer->index == pcity->original) {
cost /= 2; /* buy back: 50% price reduction */
} else {
cost = cost * 2 / 3; /* buy conquered: 33% price reduction */
Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.42
diff -u -r1.42 connecthand.c
--- server/connecthand.c 31 Mar 2005 17:48:34 -0000 1.42
+++ server/connecthand.c 28 Apr 2005 20:41:06 -0000
@@ -570,7 +570,7 @@
if (!pplayer->is_connected) { /* may be still true if multiple connections */
players_iterate(other_player) {
if (find_treaty(pplayer, other_player)) {
- handle_diplomacy_cancel_meeting_req(pplayer, other_player->player_no);
+ handle_diplomacy_cancel_meeting_req(pplayer, other_player->index);
}
} players_iterate_end;
}
@@ -605,7 +605,7 @@
packet->id = pconn->id;
packet->used = pconn->used;
packet->established = pconn->established;
- packet->player_num = pconn->player ? pconn->player->player_no : -1;
+ packet->player_num = pconn->player ? pconn->player->index : -1;
packet->observer = pconn->observer;
packet->access_level = pconn->access_level;
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.92
diff -u -r1.92 diplhand.c
--- server/diplhand.c 14 Feb 2005 22:52:41 -0000 1.92
+++ server/diplhand.c 28 Apr 2005 20:41:06 -0000
@@ -96,7 +96,7 @@
struct player *pother;
bool *player_accept, *other_accept;
- if (!is_valid_player_id(counterpart) || pplayer->player_no == counterpart) {
+ if (!is_valid_player_id(counterpart) || pplayer->index == counterpart) {
return;
}
@@ -164,7 +164,7 @@
"you can't accept treaty."));
return;
}
- if (pcity->owner != pplayer->player_no) {
+ if (pcity->owner != pplayer->index) {
notify_player(pplayer,
_("You are not owner of %s, you can't accept
treaty."),
pcity->name);
@@ -212,21 +212,21 @@
*player_accept = ! *player_accept;
dlsend_packet_diplomacy_accept_treaty(pplayer->connections,
- pother->player_no, *player_accept,
+ pother->index, *player_accept,
*other_accept);
dlsend_packet_diplomacy_accept_treaty(pother->connections,
- pplayer->player_no, *other_accept,
+ pplayer->index, *other_accept,
*player_accept);
if (ptreaty->accept0 && ptreaty->accept1) {
int nclauses = clause_list_size(ptreaty->clauses);
dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
- pother->player_no,
- pplayer->player_no);
+ pother->index,
+ pplayer->index);
dlsend_packet_diplomacy_cancel_meeting(pother->connections,
- pplayer->player_no,
- pplayer->player_no);
+ pplayer->index,
+ pplayer->index);
notify_player(pplayer,
PL_("A treaty containing %d clause was agreed upon.",
@@ -259,7 +259,7 @@
get_nation_name_plural(pother->nation));
goto cleanup;
}
- if (pcity->owner != pother->player_no) {
+ if (pcity->owner != pother->index) {
notify_player(pplayer,
_("The %s no longer control %s! "
"Treaty canceled!"),
@@ -407,10 +407,10 @@
break;
}
case CLAUSE_CEASEFIRE:
- pgiver->diplstates[pdest->player_no].type=DS_CEASEFIRE;
- pgiver->diplstates[pdest->player_no].turns_left=16;
- pdest->diplstates[pgiver->player_no].type=DS_CEASEFIRE;
- pdest->diplstates[pgiver->player_no].turns_left=16;
+ pgiver->diplstates[pdest->index].type=DS_CEASEFIRE;
+ pgiver->diplstates[pdest->index].turns_left=16;
+ pdest->diplstates[pgiver->index].type=DS_CEASEFIRE;
+ pdest->diplstates[pgiver->index].turns_left=16;
notify_player_ex(pgiver, NULL, E_TREATY_CEASEFIRE,
_("You agree on a cease-fire with %s."),
pdest->name);
@@ -422,8 +422,8 @@
check_city_workers(pother);
break;
case CLAUSE_PEACE:
- pgiver->diplstates[pdest->player_no].type=DS_PEACE;
- pdest->diplstates[pgiver->player_no].type=DS_PEACE;
+ pgiver->diplstates[pdest->index].type=DS_PEACE;
+ pdest->diplstates[pgiver->index].type=DS_PEACE;
notify_player_ex(pgiver, NULL, E_TREATY_PEACE,
_("You agree on a peace treaty with %s."),
pdest->name);
@@ -435,8 +435,8 @@
check_city_workers(pother);
break;
case CLAUSE_ALLIANCE:
- pgiver->diplstates[pdest->player_no].type=DS_ALLIANCE;
- pdest->diplstates[pgiver->player_no].type=DS_ALLIANCE;
+ pgiver->diplstates[pdest->index].type=DS_ALLIANCE;
+ pdest->diplstates[pgiver->index].type=DS_ALLIANCE;
notify_player_ex(pgiver, NULL, E_TREATY_ALLIANCE,
_("You agree on an alliance with %s."),
pdest->name);
@@ -479,7 +479,7 @@
void establish_embassy(struct player *pplayer, struct player *aplayer)
{
/* Establish the embassy. */
- pplayer->embassy |= (1 << aplayer->player_no);
+ pplayer->embassy |= (1 << aplayer->index);
send_player_info(pplayer, pplayer);
send_player_info(pplayer, aplayer); /* update player dialog with embassy */
send_player_info(aplayer, pplayer); /* INFO_EMBASSY level info */
@@ -495,7 +495,7 @@
struct Treaty *ptreaty;
struct player *pgiver, *pother;
- if (!is_valid_player_id(counterpart) || pplayer->player_no == counterpart
+ if (!is_valid_player_id(counterpart) || pplayer->index == counterpart
|| !is_valid_player_id(giver)) {
return;
}
@@ -511,10 +511,10 @@
if (ptreaty && remove_clause(ptreaty, pgiver, type, value)) {
dlsend_packet_diplomacy_remove_clause(pplayer->connections,
- pother->player_no, giver, type,
+ pother->index, giver, type,
value);
dlsend_packet_diplomacy_remove_clause(pother->connections,
- pplayer->player_no, giver, type,
+ pplayer->index, giver, type,
value);
if (pplayer->ai.control) {
ai_treaty_evaluate(pplayer, pother, ptreaty);
@@ -535,7 +535,7 @@
struct Treaty *ptreaty;
struct player *pgiver, *pother;
- if (!is_valid_player_id(counterpart) || pplayer->player_no == counterpart
+ if (!is_valid_player_id(counterpart) || pplayer->index == counterpart
|| !is_valid_player_id(giver)) {
return;
}
@@ -566,10 +566,10 @@
}
dlsend_packet_diplomacy_create_clause(pplayer->connections,
- pother->player_no, giver, type,
+ pother->index, giver, type,
value);
dlsend_packet_diplomacy_create_clause(pother->connections,
- pplayer->player_no, giver, type,
+ pplayer->index, giver, type,
value);
if (pplayer->ai.control) {
ai_treaty_evaluate(pplayer, pother, ptreaty);
@@ -590,14 +590,14 @@
if (ptreaty) {
dlsend_packet_diplomacy_cancel_meeting(pother->connections,
- pplayer->player_no,
- pplayer->player_no);
+ pplayer->index,
+ pplayer->index);
notify_player(pother, _("%s canceled the meeting!"),
pplayer->name);
/* Need to send to pplayer too, for multi-connects: */
dlsend_packet_diplomacy_cancel_meeting(pplayer->connections,
- pother->player_no,
- pplayer->player_no);
+ pother->index,
+ pplayer->index);
notify_player(pplayer, _("Meeting with %s canceled."),
pother->name);
treaty_list_unlink(treaties, ptreaty);
@@ -612,7 +612,7 @@
void handle_diplomacy_cancel_meeting_req(struct player *pplayer,
int counterpart)
{
- if (!is_valid_player_id(counterpart) || pplayer->player_no == counterpart) {
+ if (!is_valid_player_id(counterpart) || pplayer->index == counterpart) {
return;
}
@@ -627,7 +627,7 @@
{
struct player *pother;
- if (!is_valid_player_id(counterpart) || pplayer->player_no == counterpart) {
+ if (!is_valid_player_id(counterpart) || pplayer->index == counterpart) {
return;
}
@@ -650,11 +650,11 @@
treaty_list_prepend(treaties, ptreaty);
dlsend_packet_diplomacy_init_meeting(pplayer->connections,
- pother->player_no,
- pplayer->player_no);
+ pother->index,
+ pplayer->index);
dlsend_packet_diplomacy_init_meeting(pother->connections,
- pplayer->player_no,
- pplayer->player_no);
+ pplayer->index,
+ pplayer->index);
}
}
@@ -673,13 +673,13 @@
struct Treaty *ptreaty = find_treaty(pplayer, other_player);
if (ptreaty) {
- dsend_packet_diplomacy_init_meeting(dest, pplayer->player_no,
- other_player->player_no);
+ dsend_packet_diplomacy_init_meeting(dest, pplayer->index,
+ other_player->index);
clause_list_iterate(ptreaty->clauses, pclause) {
- dsend_packet_diplomacy_create_clause(dest, pplayer->player_no,
- other_player->player_no,
+ dsend_packet_diplomacy_create_clause(dest, pplayer->index,
+ other_player->index,
pclause->type,
- pclause->from->player_no);
+ pclause->from->index);
} clause_list_iterate_end;
}
} players_iterate_end;
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.70
diff -u -r1.70 diplomats.c
--- server/diplomats.c 21 Mar 2005 12:21:28 -0000 1.70
+++ server/diplomats.c 28 Apr 2005 20:41:07 -0000
@@ -1381,7 +1381,7 @@
die("Illegal diplstate in maybe_cause_incident.");
}
offender->reputation = MAX(offender->reputation - punishment, 0);
- victim_player->diplstates[offender->player_no].has_reason_to_cancel = 2;
+ victim_player->diplstates[offender->index].has_reason_to_cancel = 2;
/* FIXME: Maybe we should try to cause a revolution is the offender's
government has a senate */
send_player_info(offender, NULL);
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.161
diff -u -r1.161 gamehand.c
--- server/gamehand.c 23 Apr 2005 17:40:29 -0000 1.161
+++ server/gamehand.c 28 Apr 2005 20:41:07 -0000
@@ -187,7 +187,7 @@
n, (n >= 0 ? get_nation_name(n) : ""));
}
players_iterate(pplayer) {
- start_pos[pplayer->player_no] = NO_START_POS;
+ start_pos[pplayer->index] = NO_START_POS;
} players_iterate_end;
/* Second, assign a nation to a start position for that nation. */
@@ -197,8 +197,8 @@
assert(pplayer->nation != NO_NATION_SELECTED);
if (pplayer->nation == map.start_positions[i].nation) {
freelog(LOG_VERBOSE, "Start_pos %d matches player %d (%s).",
- i, pplayer->player_no, get_nation_name(pplayer->nation));
- start_pos[pplayer->player_no] = i;
+ i, pplayer->index, get_nation_name(pplayer->nation));
+ start_pos[pplayer->index] = i;
pos_used[i] = TRUE;
num_used++;
}
@@ -208,7 +208,7 @@
/* Third, assign players randomly to the remaining start positions. */
freelog(LOG_VERBOSE, "Assigning random nations.");
players_iterate(pplayer) {
- if (start_pos[pplayer->player_no] == NO_START_POS) {
+ if (start_pos[pplayer->index] == NO_START_POS) {
int which = myrand(map.num_start_positions - num_used);
for (i = 0; i < map.num_start_positions; i++) {
@@ -216,8 +216,8 @@
if (which == 0) {
freelog(LOG_VERBOSE,
"Randomly assigning player %d (%s) to pos %d.",
- pplayer->player_no, get_nation_name(pplayer->nation), i);
- start_pos[pplayer->player_no] = i;
+ pplayer->index, get_nation_name(pplayer->nation), i);
+ start_pos[pplayer->index] = i;
pos_used[i] = TRUE;
num_used++;
break;
@@ -226,13 +226,13 @@
}
}
}
- assert(start_pos[pplayer->player_no] != NO_START_POS);
+ assert(start_pos[pplayer->index] != NO_START_POS);
} players_iterate_end;
/* Loop over all players, creating their initial units... */
players_iterate(pplayer) {
struct start_position pos
- = map.start_positions[start_pos[pplayer->player_no]];
+ = map.start_positions[start_pos[pplayer->index]];
/* don't give any units to observer */
if (pplayer->is_observer) {
@@ -249,7 +249,7 @@
struct tile *ptile;
struct nation_type *nation = get_nation_by_plr(pplayer);
struct start_position p
- = map.start_positions[start_pos[pplayer->player_no]];
+ = map.start_positions[start_pos[pplayer->index]];
/* don't give any units to observer */
if (pplayer->is_observer) {
@@ -381,7 +381,7 @@
conn_list_iterate(dest, pconn) {
/* ? fixme: check for non-players: */
- ginfo.player_idx = (pconn->player ? pconn->player->player_no : -1);
+ ginfo.player_idx = (pconn->player ? pconn->player->index : -1);
send_packet_game_info(pconn, &ginfo);
}
conn_list_iterate_end;
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.45
diff -u -r1.45 gamelog.c
--- server/gamelog.c 23 Apr 2005 17:40:29 -0000 1.45
+++ server/gamelog.c 28 Apr 2005 20:41:07 -0000
@@ -212,7 +212,7 @@
my_snprintf(buf, sizeof(buf),
"<n>%d</n><name>%s</name><m>%s form a %s</m>",
- pplayer->player_no, get_government_name(pplayer->government),
+ pplayer->index, get_government_name(pplayer->government),
get_nation_name_plural(pplayer->nation),
get_government_name(pplayer->government));
gamelog_put_prefix(buf, sizeof(buf), "gov");
@@ -221,7 +221,7 @@
pplayer = va_arg(args, struct player *);
my_snprintf(buf, sizeof(buf), "<n>%d</n><m>%s</m>",
- pplayer->player_no, get_nation_name_plural(pplayer->nation));
+ pplayer->index, get_nation_name_plural(pplayer->nation));
gamelog_put_prefix(buf, sizeof(buf), "rev");
break;
case GAMELOG_FOUNDCITY:
@@ -229,7 +229,7 @@
my_snprintf(buf, sizeof(buf), "<n>%d</n><name>%s</name>"
"<x>%d</x><y>%d</y><m>%s (%d,%d) founded by the %s</m>",
- city_owner(pcity)->player_no,
+ city_owner(pcity)->index,
pcity->name, pcity->tile->x, pcity->tile->y,
pcity->name, pcity->tile->x, pcity->tile->y,
get_nation_name_plural(city_owner(pcity)->nation));
@@ -244,7 +244,7 @@
my_snprintf(buf, sizeof(buf), "<n1>%d</n1><n2>%d</n2>"
"<name>%s</name><x>%d</x><y>%d</y>"
"<m>%s (%s) (%d,%d) %s by %s</m>",
- pplayer->player_no, pplayer2->player_no,
+ pplayer->index, pplayer2->index,
pcity->name, pcity->tile->x, pcity->tile->y,
pcity->name, get_nation_name_plural(pplayer->nation),
pcity->tile->x, pcity->tile->y, word,
@@ -256,7 +256,7 @@
my_snprintf(buf, sizeof(buf), "<n>%d</n><name>%s</name>"
"<x>%d</x><y>%d</y><m>%s (%d, %d) disbanded by the %s</m>",
- city_owner(pcity)->player_no,
+ city_owner(pcity)->index,
pcity->name, pcity->tile->x, pcity->tile->y,
pcity->name, pcity->tile->x, pcity->tile->y,
get_nation_name_plural(city_owner(pcity)->nation));
@@ -311,7 +311,7 @@
if (pcity) {
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><city>%s</city><type>%s</type>",
- pplayer->player_no, pplayer2->player_no, pcity->name,
+ pplayer->index, pplayer2->index, pcity->name,
treaty_clause_strings[num]);
cat_snprintf(buf, sizeof(buf), msg,
pcity->name, get_nation_name_plural(pplayer2->nation),
@@ -319,7 +319,7 @@
} else {
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><type>%s</type>",
- pplayer->player_no, pplayer2->player_no,
+ pplayer->index, pplayer2->index,
treaty_clause_strings[num]);
cat_snprintf(buf, sizeof(buf), msg,
get_nation_name_plural(pplayer->nation),
@@ -334,7 +334,7 @@
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><type>%s</type>",
- pplayer->player_no, pplayer2->player_no, diplstate_text(num));
+ pplayer->index, pplayer2->index, diplstate_text(num));
cat_snprintf(buf, sizeof(buf),
"<m>The diplomatic state between the %s and the %s is %s</m>",
get_nation_name_plural(pplayer->nation),
@@ -352,7 +352,7 @@
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><name>%s</name>"
"<m>%s %s %s from the %s</m>",
- pplayer->player_no, pplayer2->player_no,
+ pplayer->index, pplayer2->index,
get_tech_name(pplayer, (Tech_Type_id) num),
get_nation_name_plural(pplayer->nation), word,
get_tech_name(pplayer, (Tech_Type_id) num),
@@ -361,7 +361,7 @@
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><name>%s</name>"
"<m>%s discover %s</m>",
- pplayer->player_no,
+ pplayer->index,
get_tech_name(pplayer, (Tech_Type_id) num),
get_nation_name_plural(pplayer->nation),
get_tech_name(pplayer, (Tech_Type_id) num));
@@ -376,7 +376,7 @@
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><name>%s</name>"
"<m>%s lose %s to the %s</m>",
- unit_owner(punit)->player_no, pplayer->player_no,
+ unit_owner(punit)->index, pplayer->index,
unit_name(punit->type),
get_nation_name_plural(unit_owner(punit)->nation),
unit_name(punit->type),
@@ -385,7 +385,7 @@
word = va_arg(args, char *);
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><name>%s</name><m>%s lose %s (%s)</m>",
- unit_owner(punit)->player_no, unit_name(punit->type),
+ unit_owner(punit)->index, unit_name(punit->type),
get_nation_name_plural(unit_owner(punit)->nation),
unit_name(punit->type), word);
}
@@ -397,7 +397,7 @@
my_snprintf(buf, sizeof(buf),
"<n>%d</n><name>%s</name>"
"<m>%s lost a game loss unit and died</m>",
- unit_owner(punit)->player_no, unit_name(punit->type),
+ unit_owner(punit)->index, unit_name(punit->type),
get_nation_name_plural(unit_owner(punit)->nation));
gamelog_put_prefix(buf, sizeof(buf), "gamel");
break;
@@ -408,7 +408,7 @@
my_snprintf(buf, sizeof(buf),
"<n1>%d</n1><n2>%d</n2><name>%s</name><x>%d</x><y>%d</y>"
"<m>%s establish an embassy in %s (%s) (%d,%d)</m>",
- pplayer->player_no, city_owner(pcity)->player_no,
+ pplayer->index, city_owner(pcity)->index,
pcity->name, pcity->tile->x, pcity->tile->y,
get_nation_name_plural(pplayer->nation),
pcity->name,
@@ -423,7 +423,7 @@
my_snprintf(buf, sizeof(buf),
"<n>%d</n><city>%s</city><u>%d</u>"
"<w>%d</w><name>%s</name><m>%s build %s in %s</m>",
- city_owner(pcity)->player_no, pcity->name,
+ city_owner(pcity)->index, pcity->name,
pcity->is_building_unit ? 1 : 0,
(!pcity->is_building_unit
&& is_wonder(pcity->currently_building)) ? 1 : 0,
@@ -442,7 +442,7 @@
my_snprintf(buf, sizeof(buf),
"<n>%d</n><b>%d</b><m>%s civilization destroyed</m>",
- pplayer->player_no, is_barbarian(pplayer) ? 1 : 0,
+ pplayer->index, is_barbarian(pplayer) ? 1 : 0,
is_barbarian(pplayer) ? get_nation_name(pplayer->nation)
: pplayer->name);
gamelog_put_prefix(buf, sizeof(buf), "geno");
@@ -452,7 +452,7 @@
my_snprintf(buf, sizeof(buf),
"<n>%d</n><tax>%d</tax><lux>%d</lux><sci>%d</sci>",
- pplayer->player_no, pplayer->economic.tax,
+ pplayer->index, pplayer->economic.tax,
pplayer->economic.luxury, pplayer->economic.science);
gamelog_put_prefix(buf, sizeof(buf), "rates");
break;
@@ -475,7 +475,7 @@
my_snprintf(buf, sizeof(buf), "<n>%d</n><cities>%d</cities>"
"<pop>%d</pop><food>%d</food><prod>%d</prod>"
"<trade>%d</trade><settlers>%d</settlers><units>%d</units>",
- pplayer->player_no, city_list_size(pplayer->cities),
+ pplayer->index, city_list_size(pplayer->cities),
total_player_citizens(pplayer), food, shields, trade,
settlers, unit_list_size(pplayer->units));
}
@@ -486,7 +486,7 @@
my_snprintf(buf, sizeof(buf), "<n>%d</n><u>%s</u><c>%d</c>"
"<ai>%s</ai><nat>%s</nat><l>%s</l>",
- pplayer->player_no, pplayer->username,
+ pplayer->index, pplayer->username,
pplayer->is_connected ? 1 : 0,
pplayer->ai.control ?
name_of_skill_level(pplayer->ai.skill_level) : "",
@@ -500,7 +500,7 @@
pteam->id, pteam->name);
players_iterate(aplayer) {
if (aplayer->team == pteam->id) {
- cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->player_no);
+ cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->index);
}
} players_iterate_end;
gamelog_put_prefix(buf, sizeof(buf), "team");
@@ -526,7 +526,7 @@
pplayer = va_arg(args, struct player *);
my_snprintf(buf, sizeof(buf), "<type>%s</type><n>%d</n>",
- endgame_strings[num], pplayer->player_no);
+ endgame_strings[num], pplayer->index);
my_snprintf(msg, sizeof(msg),
(pplayer->spaceship.state == SSHIP_ARRIVED)
? "The %s spaceship has arrived at Alpha Centauri."
@@ -537,7 +537,7 @@
my_snprintf(buf, sizeof(buf), "<type>%s</type>", endgame_strings[num]);
players_iterate(aplayer) {
if (aplayer->is_alive) {
- cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->player_no);
+ cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->index);
}
} players_iterate_end;
my_snprintf(msg, sizeof(msg), "Game ended in allied victory");
@@ -547,7 +547,7 @@
my_snprintf(buf, sizeof(buf), "<type>%s</type>", endgame_strings[num]);
players_iterate(aplayer) {
if (aplayer->team == pteam->id) {
- cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->player_no);
+ cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->index);
}
} players_iterate_end;
my_snprintf(msg, sizeof(msg), "Team victory to %s", pteam->name);
@@ -621,9 +621,9 @@
players_iterate(pplayer) {
if (!is_barbarian(pplayer)) {
rank[count].value = get_civ_score(pplayer);
- rank[count].idx = pplayer->player_no;
+ rank[count].idx = pplayer->index;
size[count].value = total_player_citizens(pplayer);
- size[count].idx = pplayer->player_no;
+ size[count].idx = pplayer->index;
if (rank[count].value > highest) {
highest = rank[count].value;
highest_plr = pplayer;
@@ -637,7 +637,7 @@
players_iterate(pplayer) {
if (!is_barbarian(pplayer)) {
if ((BV_ISSET_ANY(srvarg.draw)
- && BV_ISSET(srvarg.draw, pplayer->player_no))
+ && BV_ISSET(srvarg.draw, pplayer->index))
|| players_on_same_team(pplayer, highest_plr)) {
/* We win a shared victory, so equal the score. */
rank[count].value = highest;
@@ -651,7 +651,7 @@
for (i = 0; i < count; i++) {
cat_snprintf(buffer, len, "<plr><no>%d</no><r>%d</r><s>%d</s></plr>",
- game.players[rank[i].idx].player_no,
+ game.players[rank[i].idx].index,
rank[i].value, size[rank[i].idx].value);
}
}
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.160
diff -u -r1.160 maphand.c
--- server/maphand.c 23 Apr 2005 17:40:29 -0000 1.160
+++ server/maphand.c 28 Apr 2005 20:41:07 -0000
@@ -325,7 +325,7 @@
**************************************************************************/
static bool really_gives_vision(struct player *me, struct player *them)
{
- return TEST_BIT(me->really_gives_vision, them->player_no);
+ return TEST_BIT(me->really_gives_vision, them->index);
}
/**************************************************************************
@@ -456,7 +456,7 @@
info.x = ptile->x;
info.y = ptile->y;
- info.owner = ptile->owner ? ptile->owner->player_no : MAP_TILE_OWNER_NULL;
+ info.owner = ptile->owner ? ptile->owner->index : MAP_TILE_OWNER_NULL;
if (ptile->spec_sprite) {
sz_strlcpy(info.spec_sprite, ptile->spec_sprite);
} else {
@@ -505,7 +505,7 @@
info.x = ptile->x;
info.y = ptile->y;
- info.owner = ptile->owner ? ptile->owner->player_no : MAP_TILE_OWNER_NULL;
+ info.owner = ptile->owner ? ptile->owner->index : MAP_TILE_OWNER_NULL;
if (ptile->spec_sprite) {
sz_strlcpy(info.spec_sprite, ptile->spec_sprite);
} else {
@@ -942,7 +942,7 @@
****************************************************************************/
bool map_is_known(const struct tile *ptile, const struct player *pplayer)
{
- return TEST_BIT(ptile->known, pplayer->player_no);
+ return TEST_BIT(ptile->known, pplayer->index);
}
/***************************************************************
@@ -950,7 +950,7 @@
***************************************************************/
bool map_is_known_and_seen(const struct tile *ptile, struct player *pplayer)
{
- return TEST_BIT(ptile->known, pplayer->player_no)
+ return TEST_BIT(ptile->known, pplayer->index)
&& ((pplayer->private_map + ptile->index)->seen != 0);
}
@@ -974,7 +974,7 @@
{
map_get_player_tile(ptile, pplayer)->seen += change;
freelog(LOG_DEBUG, "%d,%d, p: %d, change %d, result %d\n", TILE_XY(ptile),
- pplayer->player_no, change, map_get_player_tile(ptile,
+ pplayer->index, change, map_get_player_tile(ptile,
pplayer)->seen);
}
@@ -1004,7 +1004,7 @@
***************************************************************/
void map_set_known(struct tile *ptile, struct player *pplayer)
{
- ptile->known |= (1u<<pplayer->player_no);
+ ptile->known |= (1u<<pplayer->index);
}
/***************************************************************
@@ -1012,7 +1012,7 @@
***************************************************************/
void map_clear_known(struct tile *ptile, struct player *pplayer)
{
- ptile->known &= ~(1u<<pplayer->player_no);
+ ptile->known &= ~(1u<<pplayer->index);
}
/***************************************************************
@@ -1280,7 +1280,7 @@
if (really_gives_vision(pplayer2, pplayer3)
&& !really_gives_vision(pplayer, pplayer3)
&& pplayer != pplayer3) {
- pplayer->really_gives_vision |= (1<<pplayer3->player_no);
+ pplayer->really_gives_vision |= (1<<pplayer3->index);
added++;
}
} players_iterate_end;
@@ -1305,10 +1305,10 @@
}
players_iterate(pplayer) {
- save_vision[pplayer->player_no] = pplayer->really_gives_vision;
+ save_vision[pplayer->index] = pplayer->really_gives_vision;
} players_iterate_end;
- pfrom->gives_shared_vision |= 1<<pto->player_no;
+ pfrom->gives_shared_vision |= 1<<pto->index;
create_vision_dependencies();
freelog(LOG_DEBUG, "giving shared vision from %s to %s\n",
pfrom->name, pto->name);
@@ -1317,7 +1317,7 @@
buffer_shared_vision(pplayer);
players_iterate(pplayer2) {
if (really_gives_vision(pplayer, pplayer2)
- && !TEST_BIT(save_vision[pplayer->player_no], pplayer2->player_no)) {
+ && !TEST_BIT(save_vision[pplayer->index], pplayer2->index)) {
freelog(LOG_DEBUG, "really giving shared vision from %s to %s\n",
pplayer->name, pplayer2->name);
whole_map_iterate(ptile) {
@@ -1358,20 +1358,20 @@
}
players_iterate(pplayer) {
- save_vision[pplayer->player_no] = pplayer->really_gives_vision;
+ save_vision[pplayer->index] = pplayer->really_gives_vision;
} players_iterate_end;
freelog(LOG_DEBUG, "removing shared vision from %s to %s\n",
pfrom->name, pto->name);
- pfrom->gives_shared_vision &= ~(1<<pto->player_no);
+ pfrom->gives_shared_vision &= ~(1<<pto->index);
create_vision_dependencies();
players_iterate(pplayer) {
buffer_shared_vision(pplayer);
players_iterate(pplayer2) {
if (!really_gives_vision(pplayer, pplayer2)
- && TEST_BIT(save_vision[pplayer->player_no], pplayer2->player_no)) {
+ && TEST_BIT(save_vision[pplayer->index], pplayer2->index)) {
freelog(LOG_DEBUG, "really removing shared vision from %s to %s\n",
pplayer->name, pplayer2->name);
whole_map_iterate(ptile) {
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.366
diff -u -r1.366 plrhand.c
--- server/plrhand.c 15 Apr 2005 05:22:52 -0000 1.366
+++ server/plrhand.c 28 Apr 2005 20:41:08 -0000
@@ -233,7 +233,7 @@
palace = game.savepalace;
game.savepalace = FALSE; /* moving it around is dumb */
city_list_iterate(pplayer->cities, pcity) {
- if ((pcity->original != pplayer->player_no)
+ if ((pcity->original != pplayer->index)
&& (get_player(pcity->original)->is_alive)) {
/* Transfer city to original owner, kill all its units outside of
a radius of 3, give verbose messages of every unit transferred,
@@ -277,7 +277,7 @@
bool can_switch[game.government_count];
players_iterate(aplr) {
- had_embassy[aplr->player_no]
+ had_embassy[aplr->index]
= (get_player_bonus(aplr, EFT_HAVE_EMBASSIES) > 0);
} players_iterate_end;
@@ -449,7 +449,7 @@
* Wonder if this wonder has become obsolete.
*/
players_iterate(owner) {
- if (had_embassy[owner->player_no]
+ if (had_embassy[owner->index]
&& get_player_bonus(owner, EFT_HAVE_EMBASSIES) == 0) {
players_iterate(other_player) {
send_player_info(owner, other_player);
@@ -464,7 +464,7 @@
}
players_iterate(aplayer) {
if (plr != aplayer
- && plr->diplstates[aplayer->player_no].type == DS_TEAM
+ && plr->diplstates[aplayer->index].type == DS_TEAM
&& aplayer->is_alive
&& get_invention(aplayer, tech_found) != TECH_KNOWN) {
if (tech_exists(plr->research->researching)) {
@@ -810,7 +810,7 @@
*/
players_iterate(aplayer) {
if (pplayer != aplayer
- && pplayer->diplstates[aplayer->player_no].type == DS_TEAM
+ && pplayer->diplstates[aplayer->index].type == DS_TEAM
&& aplayer->is_alive) {
send_player_info(aplayer, aplayer);
}
@@ -828,7 +828,7 @@
/* Notify Team members */
players_iterate(aplayer) {
if (pplayer != aplayer
- && pplayer->diplstates[aplayer->player_no].type == DS_TEAM
+ && pplayer->diplstates[aplayer->index].type == DS_TEAM
&& aplayer->is_alive
&& aplayer->research->tech_goal != tech) {
handle_player_tech_goal(aplayer, tech);
@@ -1138,11 +1138,11 @@
}
/* do the change */
- pplayer->diplstates[pplayer2->player_no].type =
- pplayer2->diplstates[pplayer->player_no].type =
+ pplayer->diplstates[pplayer2->index].type =
+ pplayer2->diplstates[pplayer->index].type =
new_type;
- pplayer->diplstates[pplayer2->player_no].turns_left =
- pplayer2->diplstates[pplayer->player_no].turns_left =
+ pplayer->diplstates[pplayer2->index].turns_left =
+ pplayer2->diplstates[pplayer->index].turns_left =
16;
gamelog(GAMELOG_DIPLSTATE, pplayer, pplayer2, new_type);
@@ -1168,8 +1168,8 @@
}
/* if there's a reason to cancel the pact, do it without penalty */
- if (pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel > 0) {
- pplayer->diplstates[pplayer2->player_no].has_reason_to_cancel = 0;
+ if (pplayer->diplstates[pplayer2->index].has_reason_to_cancel > 0) {
+ pplayer->diplstates[pplayer2->index].has_reason_to_cancel = 0;
if (has_senate && !repeat) {
notify_player_ex(pplayer, NULL, E_TREATY_BROKEN,
_("The senate passes your bill because of the "
@@ -1246,8 +1246,8 @@
_("%s has attacked your ally %s! "
"You cancel your alliance to the aggressor."),
pplayer->name, pplayer2->name);
- other->diplstates[pplayer->player_no].has_reason_to_cancel = 1;
- handle_diplomacy_cancel_pact(pplayer, other->player_no,
+ other->diplstates[pplayer->index].has_reason_to_cancel = 1;
+ handle_diplomacy_cancel_pact(pplayer, other->index,
CLAUSE_ALLIANCE);
} else {
/* We are in the same team as the agressor; we cannot break
@@ -1259,7 +1259,7 @@
pplayer->name,
get_nation_name_plural(pplayer2->nation),
pplayer2->name);
- handle_diplomacy_cancel_pact(other, pplayer2->player_no,
CLAUSE_ALLIANCE);
+ handle_diplomacy_cancel_pact(other, pplayer2->index, CLAUSE_ALLIANCE);
}
}
} players_iterate_end;
@@ -1446,7 +1446,7 @@
{
int i;
- packet->playerno=plr->player_no;
+ packet->index=plr->index;
sz_strlcpy(packet->name, plr->name);
sz_strlcpy(packet->username, plr->username);
packet->nation=plr->nation;
@@ -1501,7 +1501,7 @@
/* Send diplomatic status of the player to everyone they are in
* contact with. */
if (info_level >= INFO_EMBASSY
- || receiver->diplstates[plr->player_no].contact_turns_left > 0) {
+ || receiver->diplstates[plr->index].contact_turns_left > 0) {
packet->target_government = plr->target_government;
packet->embassy = plr->embassy;
packet->gives_shared_vision = plr->gives_shared_vision;
@@ -1517,12 +1517,12 @@
if (!receiver || !player_has_embassy(plr, receiver)) {
packet->embassy = 0;
} else {
- packet->embassy = 1 << receiver->player_no;
+ packet->embassy = 1 << receiver->index;
}
if (!receiver || !gives_shared_vision(plr, receiver)) {
packet->gives_shared_vision = 0;
} else {
- packet->gives_shared_vision = 1 << receiver->player_no;
+ packet->gives_shared_vision = 1 << receiver->index;
}
for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) {
@@ -1533,7 +1533,7 @@
}
/* We always know the player's relation to us */
if (receiver) {
- int p_no = receiver->player_no;
+ int p_no = receiver->index;
packet->diplstates[p_no].type = plr->diplstates[p_no].type;
packet->diplstates[p_no].turns_left = plr->diplstates[p_no].turns_left;
@@ -1587,7 +1587,7 @@
packet->inventions[A_NONE] = plr->research->inventions[A_NONE].state + '0';
if (info_level >= INFO_FULL
- || plr->diplstates[receiver->player_no].type == DS_TEAM) {
+ || plr->diplstates[receiver->index].type == DS_TEAM) {
packet->tech_goal = plr->research->tech_goal;
} else {
packet->tech_goal = A_UNSET;
@@ -1644,7 +1644,7 @@
if (initmap) {
player_map_allocate(pplayer);
}
- pplayer->player_no = pplayer-game.players;
+ pplayer->index = pplayer-game.players;
ai_data_init(pplayer);
}
@@ -1666,7 +1666,7 @@
notify_conn(game.est_connections,
_("%s has been removed from the game."), pplayer->name);
- dlsend_packet_player_remove(game.game_connections, pplayer->player_no);
+ dlsend_packet_player_remove(game.game_connections, pplayer->index);
/* Note it is ok to remove the _current_ item in a list_iterate. */
conn_list_iterate(pplayer->connections, pconn) {
@@ -1676,7 +1676,7 @@
} conn_list_iterate_end;
game_remove_player(pplayer);
- game_renumber_players(pplayer->player_no);
+ game_renumber_players(pplayer->index);
}
/**************************************************************************
@@ -1685,7 +1685,7 @@
void make_contact(struct player *pplayer1, struct player *pplayer2,
struct tile *ptile)
{
- int player1 = pplayer1->player_no, player2 = pplayer2->player_no;
+ int player1 = pplayer1->index, player2 = pplayer2->index;
if (pplayer1 == pplayer2
|| !pplayer1->is_alive || !pplayer2->is_alive
@@ -1781,7 +1781,7 @@
#ifdef DEBUG
for (i = 0; i < game.nplayers; i++) {
freelog(LOG_DEBUG, "Shuffling player %d as %d.",
- i, shuffled_plr[i]->player_no);
+ i, shuffled_plr[i]->index);
}
#endif
@@ -1800,7 +1800,7 @@
shuffled_plr[i] = get_player(shuffled_players[i]);
freelog(LOG_DEBUG, "Set shuffled player %d as %d.",
- i, shuffled_plr[i]->player_no);
+ i, shuffled_plr[i]->index);
}
shuffled_nplayers = game.nplayers;
@@ -1923,19 +1923,19 @@
players_iterate(other_player) {
/* Barbarians are at war with everybody */
if (is_barbarian(other_player)) {
- cplayer->diplstates[other_player->player_no].type = DS_WAR;
- other_player->diplstates[cplayer->player_no].type = DS_WAR;
+ cplayer->diplstates[other_player->index].type = DS_WAR;
+ other_player->diplstates[cplayer->index].type = DS_WAR;
} else {
- cplayer->diplstates[other_player->player_no].type = DS_NO_CONTACT;
- other_player->diplstates[cplayer->player_no].type = DS_NO_CONTACT;
+ cplayer->diplstates[other_player->index].type = DS_NO_CONTACT;
+ other_player->diplstates[cplayer->index].type = DS_NO_CONTACT;
}
- cplayer->diplstates[other_player->player_no].has_reason_to_cancel = 0;
- cplayer->diplstates[other_player->player_no].turns_left = 0;
- cplayer->diplstates[other_player->player_no].contact_turns_left = 0;
- other_player->diplstates[cplayer->player_no].has_reason_to_cancel = 0;
- other_player->diplstates[cplayer->player_no].turns_left = 0;
- other_player->diplstates[cplayer->player_no].contact_turns_left = 0;
+ cplayer->diplstates[other_player->index].has_reason_to_cancel = 0;
+ cplayer->diplstates[other_player->index].turns_left = 0;
+ cplayer->diplstates[other_player->index].contact_turns_left = 0;
+ other_player->diplstates[cplayer->index].has_reason_to_cancel = 0;
+ other_player->diplstates[cplayer->index].turns_left = 0;
+ other_player->diplstates[cplayer->index].contact_turns_left = 0;
/* Send so that other_player sees updated diplomatic info;
* pplayer will be sent later anyway
Index: server/report.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/report.c,v
retrieving revision 1.62
diff -u -r1.62 report.c
--- server/report.c 14 Feb 2005 18:09:33 -0000 1.62
+++ server/report.c 28 Apr 2005 20:41:08 -0000
@@ -749,7 +749,7 @@
/**************************************************************************
Reads the whole file denoted by fp. Sets last_turn and id to the
values contained in the file. Returns the player_names indexed by
- player_no at the end of the log file.
+ index at the end of the log file.
Returns TRUE iff the file had read successfully.
**************************************************************************/
@@ -986,21 +986,21 @@
players_iterate(pplayer) {
if (GOOD_PLAYER(pplayer)
- && strlen(player_names[pplayer->player_no]) == 0) {
- fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->player_no,
+ && strlen(player_names[pplayer->index]) == 0) {
+ fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->index,
pplayer->name);
- mystrlcpy(player_name_ptrs[pplayer->player_no], pplayer->name,
+ mystrlcpy(player_name_ptrs[pplayer->index], pplayer->name,
MAX_LEN_NAME);
}
} players_iterate_end;
players_iterate(pplayer) {
if (GOOD_PLAYER(pplayer)
- && strcmp(player_names[pplayer->player_no], pplayer->name) != 0) {
- fprintf(fp, "delplayer %d %d\n", game.turn - 1, pplayer->player_no);
- fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->player_no,
+ && strcmp(player_names[pplayer->index], pplayer->name) != 0) {
+ fprintf(fp, "delplayer %d %d\n", game.turn - 1, pplayer->index);
+ fprintf(fp, "addplayer %d %d %s\n", game.turn, pplayer->index,
pplayer->name);
- mystrlcpy(player_names[pplayer->player_no], pplayer->name,
+ mystrlcpy(player_names[pplayer->index], pplayer->name,
MAX_LEN_NAME);
}
} players_iterate_end;
@@ -1011,7 +1011,7 @@
continue;
}
- fprintf(fp, "data %d %d %d %d\n", game.turn, i, pplayer->player_no,
+ fprintf(fp, "data %d %d %d %d\n", game.turn, i, pplayer->index,
score_tags[i].get_value(pplayer));
} players_iterate_end;
}
@@ -1117,7 +1117,7 @@
packet.nscores = j;
for (i = 0; i < j; i++) {
- packet.id[i] = size[i].player->player_no;
+ packet.id[i] = size[i].player->index;
packet.score[i] = size[i].value;
packet.pop[i] = get_pop(size[i].player) * 1000;
packet.bnp[i] = get_economics(size[i].player);
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.61
diff -u -r1.61 sanitycheck.c
--- server/sanitycheck.c 23 Apr 2005 17:40:29 -0000 1.61
+++ server/sanitycheck.c 28 Apr 2005 20:41:08 -0000
@@ -203,7 +203,7 @@
pcity->name, TILE_XY(ptile));
}
if (game.borders > 0
- && owner && owner->player_no != pcity->owner) {
+ && owner && owner->index != pcity->owner) {
freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
"empty but in enemy territory!",
pcity->name, TILE_XY(ptile));
@@ -227,7 +227,7 @@
pcity->name, TILE_XY(ptile));
}
if (game.borders > 0
- && owner && owner->player_no != pcity->owner) {
+ && owner && owner->index != pcity->owner) {
freelog(LOG_ERROR, "Tile at %s->%d,%d marked as "
"worked but in enemy territory!",
pcity->name, TILE_XY(ptile));
@@ -392,7 +392,7 @@
**************************************************************************/
static void check_players(void)
{
- int player_no;
+ int index;
players_iterate(pplayer) {
int found_palace = 0;
@@ -405,11 +405,11 @@
} city_list_iterate_end;
players_iterate(pplayer2) {
- SANITY_CHECK(pplayer->diplstates[pplayer2->player_no].type
- == pplayer2->diplstates[pplayer->player_no].type);
- if (pplayer->diplstates[pplayer2->player_no].type == DS_CEASEFIRE) {
- SANITY_CHECK(pplayer->diplstates[pplayer2->player_no].turns_left
- == pplayer2->diplstates[pplayer->player_no].turns_left);
+ SANITY_CHECK(pplayer->diplstates[pplayer2->index].type
+ == pplayer2->diplstates[pplayer->index].type);
+ if (pplayer->diplstates[pplayer2->index].type == DS_CEASEFIRE) {
+ SANITY_CHECK(pplayer->diplstates[pplayer2->index].turns_left
+ == pplayer2->diplstates[pplayer->index].turns_left);
}
if (pplayers_allied(pplayer, pplayer2)
&& pplayer->is_alive
@@ -433,8 +433,8 @@
} players_iterate_end;
/* Sanity checks on living and dead players. */
- for (player_no = 0; player_no < ARRAY_SIZE(game.players); player_no++) {
- struct player *pplayer = &game.players[player_no];
+ for (index = 0; index < ARRAY_SIZE(game.players); index++) {
+ struct player *pplayer = &game.players[index];
if (!pplayer->is_alive) {
/* Dead players' units and cities are disbanded in kill_player(). */
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.235
diff -u -r1.235 savegame.c
--- server/savegame.c 28 Apr 2005 04:15:42 -0000 1.235
+++ server/savegame.c 28 Apr 2005 20:41:09 -0000
@@ -1926,8 +1926,8 @@
freelog(LOG_ERROR, _("Illegal alliance structure detected: "
"%s's alliance to %s reduced to peace treaty."),
plr->name, aplayer->name);
- plr->diplstates[aplayer->player_no].type = DS_PEACE;
- aplayer->diplstates[plr->player_no].type = DS_PEACE;
+ plr->diplstates[aplayer->index].type = DS_PEACE;
+ aplayer->diplstates[plr->index].type = DS_PEACE;
}
} players_iterate_end;
@@ -2508,7 +2508,7 @@
}
secfile_insert_int(file,
ai->diplomacy.target == NULL ?
- -1 : ai->diplomacy.target->player_no,
+ -1 : ai->diplomacy.target->index,
"player%d.ai.target", plrno);
save_technology(file, "player%d.ai.tech_goal",
plrno, plr->research->tech_goal);
@@ -3555,14 +3555,14 @@
} players_iterate_end;
players_iterate(pplayer) {
char *vision;
- int plrno = pplayer->player_no;
+ int plrno = pplayer->index;
vision = secfile_lookup_str_default(file, NULL,
"player%d.gives_shared_vision",
plrno);
if (vision) {
players_iterate(pplayer2) {
- if (vision[pplayer2->player_no] == '1') {
+ if (vision[pplayer2->index] == '1') {
give_shared_vision(pplayer, pplayer2);
}
} players_iterate_end;
@@ -3886,11 +3886,11 @@
calc_unit_ordering();
players_iterate(pplayer) {
- player_save(pplayer, pplayer->player_no, file);
+ player_save(pplayer, pplayer->index, file);
} players_iterate_end;
for (i = 0; i < game.nplayers; i++) {
- secfile_insert_int(file, shuffled_player(i)->player_no,
+ secfile_insert_int(file, shuffled_player(i)->index,
"game.shuffled_player_%d", i);
}
}
Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.17
diff -u -r1.17 score.c
--- server/score.c 3 Feb 2005 09:51:51 -0000 1.17
+++ server/score.c 28 Apr 2005 20:41:09 -0000
@@ -342,14 +342,14 @@
#endif
if (return_landarea && pcmap->player_landarea) {
*return_landarea =
- USER_AREA_MULT * pcmap->player_landarea[pplayer->player_no];
+ USER_AREA_MULT * pcmap->player_landarea[pplayer->index];
#if LAND_AREA_DEBUG >= 1
printf(" l=%d", *return_landarea / USER_AREA_MULT);
#endif
}
if (return_settledarea && pcmap->player_owndarea) {
*return_settledarea =
- USER_AREA_MULT * pcmap->player_owndarea[pplayer->player_no];
+ USER_AREA_MULT * pcmap->player_owndarea[pplayer->index];
#if LAND_AREA_DEBUG >= 1
printf(" s=%d", *return_settledarea / USER_AREA_MULT);
#endif
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.230
diff -u -r1.230 settlers.c
--- server/settlers.c 26 Apr 2005 05:23:59 -0000 1.230
+++ server/settlers.c 28 Apr 2005 20:41:09 -0000
@@ -153,7 +153,7 @@
unit_list_iterate_end;
return FALSE;
}
- return TEST_BIT(ptile->assigned, pplayer->player_no);
+ return TEST_BIT(ptile->assigned, pplayer->index);
}
/**************************************************************************
@@ -856,7 +856,7 @@
bool can_rr = player_knows_techs_with_flag(pplayer, TF_RAILROAD);
int best_newv = 0;
- enemy_mask my_enemies = enemies[pplayer->player_no]; /* optimalization */
+ enemy_mask my_enemies = enemies[pplayer->index]; /* optimalization */
generate_warmap(mycity, punit);
@@ -1064,7 +1064,7 @@
if (punit->ai.ai_role == AIUNIT_AUTO_SETTLER) {
/* Mark the square as taken. */
if (best_tile) {
- best_tile->assigned = best_tile->assigned | 1 << pplayer->player_no;
+ best_tile->assigned = best_tile->assigned | 1 << pplayer->index;
} else {
UNIT_LOG(LOG_DEBUG, punit, "giving up trying to improve terrain");
return; /* We cannot do anything */
@@ -1233,7 +1233,7 @@
**************************************************************************/
static void assign_settlers_player(struct player *pplayer)
{
- int i = 1<<pplayer->player_no;
+ int i = 1<<pplayer->index;
struct tile *ptile;
unit_list_iterate(pplayer->units, punit)
if (unit_flag(punit, F_SETTLERS)
@@ -1271,12 +1271,12 @@
Assign a region of the map as belonging to a certain player for keeping
autosettlers out of enemy territory.
**************************************************************************/
-static void assign_region(struct tile *ptile, int player_no,
+static void assign_region(struct tile *ptile, int index,
int distance, int s)
{
square_iterate(ptile, distance, tile1) {
if (s == 0 || is_ocean_near_tile(tile1)) {
- BV_SET(TERRITORY(tile1), player_no);
+ BV_SET(TERRITORY(tile1), index);
}
} square_iterate_end;
}
@@ -1295,7 +1295,7 @@
**************************************************************************/
static void assign_territory_player(struct player *pplayer)
{
- int n = pplayer->player_no;
+ int n = pplayer->index;
unit_list_iterate(pplayer->units, punit)
if (unit_type(punit)->attack_strength != 0) {
/* I could argue that phalanxes aren't really a threat, but ... */
@@ -1341,10 +1341,10 @@
static void recount_enemy_masks(void)
{
players_iterate(player1) {
- BV_CLR_ALL(enemies[player1->player_no]);
+ BV_CLR_ALL(enemies[player1->index]);
players_iterate(player2) {
if (!pplayers_allied(player1, player2))
- BV_SET(enemies[player1->player_no], player2->player_no);
+ BV_SET(enemies[player1->index], player2->index);
} players_iterate_end;
} players_iterate_end;
}
Index: server/spacerace.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/spacerace.c,v
retrieving revision 1.40
diff -u -r1.40 spacerace.c
--- server/spacerace.c 14 Feb 2005 22:52:41 -0000 1.40
+++ server/spacerace.c 28 Apr 2005 20:41:09 -0000
@@ -125,7 +125,7 @@
struct packet_spaceship_info info;
struct player_spaceship *ship = &pplayer->spaceship;
- info.player_num = pplayer->player_no;
+ info.player_num = pplayer->index;
info.sship_state = ship->state;
info.structurals = ship->structurals;
info.components = ship->components;
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.247
diff -u -r1.247 srv_main.c
--- server/srv_main.c 27 Apr 2005 16:31:46 -0000 1.247
+++ server/srv_main.c 28 Apr 2005 20:41:10 -0000
@@ -405,7 +405,7 @@
players_iterate(player1) {
players_iterate(player2) {
struct player_diplstate *pdiplstate =
- &player1->diplstates[player2->player_no];
+ &player1->diplstates[player2->index];
pdiplstate->has_reason_to_cancel =
MAX(pdiplstate->has_reason_to_cancel - 1, 0);
@@ -536,7 +536,7 @@
phase_players_iterate(pplayer) {
freelog(LOG_DEBUG, "beginning player turn for #%d (%s)",
- pplayer->player_no, pplayer->name);
+ pplayer->index, pplayer->name);
/* human players also need this for building advice */
ai_data_phase_init(pplayer, is_new_phase);
if (!pplayer->ai.control) {
@@ -1121,7 +1121,7 @@
* times (for server commands etc), including during nation
* allocation phase.
*/
- if (other_player->player_no != pplayer->player_no
+ if (other_player->index != pplayer->index
&& mystrcasecmp(other_player->name, name) == 0) {
if (error_buf) {
my_snprintf(error_buf, bufsz,
@@ -1878,10 +1878,10 @@
players_iterate(pplayer) {
players_iterate(pdest) {
if (players_on_same_team(pplayer, pdest)
- && pplayer->player_no != pdest->player_no) {
- pplayer->diplstates[pdest->player_no].type = DS_TEAM;
+ && pplayer->index != pdest->index) {
+ pplayer->diplstates[pdest->index].type = DS_TEAM;
give_shared_vision(pplayer, pdest);
- pplayer->embassy |= (1 << pdest->player_no);
+ pplayer->embassy |= (1 << pdest->index);
}
} players_iterate_end;
} players_iterate_end;
@@ -1890,7 +1890,7 @@
players_iterate(pplayer) {
players_iterate(pdest) {
if (players_on_same_team(pplayer, pdest)
- && pplayer->player_no != pdest->player_no) {
+ && pplayer->index != pdest->index) {
merge_players_research(pplayer, pdest);
}
} players_iterate_end;
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.399
diff -u -r1.399 stdinhand.c
--- server/stdinhand.c 27 Apr 2005 16:31:47 -0000 1.399
+++ server/stdinhand.c 28 Apr 2005 20:41:10 -0000
@@ -2153,7 +2153,7 @@
} if (check) {
return FALSE; /* cannot vote over having vote! */
}
- idx = caller->player->player_no;
+ idx = caller->player->index;
sz_strlcpy(buf, str);
ntokens = get_tokens(buf, arg, 2, TOKEN_DELIMITERS);
@@ -2190,11 +2190,11 @@
if (strcmp(arg[0], "yes") == 0) {
cmd_reply(CMD_VOTE, caller, C_COMMENT, _("You voted for \"%s\""),
vote->command);
- vote->votes_cast[caller->player->player_no] = VOTE_YES;
+ vote->votes_cast[caller->player->index] = VOTE_YES;
} else if (strcmp(arg[0], "no") == 0) {
cmd_reply(CMD_VOTE, caller, C_COMMENT, _("You voted against \"%s\""),
vote->command);
- vote->votes_cast[caller->player->player_no] = VOTE_NO;
+ vote->votes_cast[caller->player->index] = VOTE_NO;
}
check_vote(vote);
} else {
@@ -3100,7 +3100,7 @@
/* actually do the removal */
game_remove_player(pplayer);
- game_renumber_players(pplayer->player_no);
+ game_renumber_players(pplayer->index);
player_init(&game.players[game.nplayers]);
}
@@ -3393,7 +3393,7 @@
&& !caller->player->is_observer
&& caller->access_level == ALLOW_INFO
&& commands[cmd].level == ALLOW_CTRL) {
- int idx = caller->player->player_no;
+ int idx = caller->player->index;
/* If we already have a vote going, cancel it in favour of the new
* vote command. You can only have one vote at a time. */
@@ -3598,7 +3598,7 @@
/* Mark players for victory. */
for (i = 0; i < ntokens; i++) {
BV_SET(srvarg.draw,
- find_player_by_name_prefix(arg[i], &plr_result)->player_no);
+ find_player_by_name_prefix(arg[i], &plr_result)->index);
}
}
server_state = GAME_OVER_STATE;
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.330
diff -u -r1.330 unithand.c
--- server/unithand.c 28 Apr 2005 04:15:42 -0000 1.330
+++ server/unithand.c 28 Apr 2005 20:41:11 -0000
@@ -606,13 +606,13 @@
if (map_is_known_and_seen(pattacker->tile, other_player)
|| map_is_known_and_seen(pdefender->tile, other_player)) {
if (!can_player_see_unit(other_player, pattacker)) {
- assert(other_player->player_no != pattacker->owner);
+ assert(other_player->index != pattacker->owner);
lsend_packet_unit_short_info(other_player->connections,
&unit_att_short_packet);
}
if (!can_player_see_unit(other_player, pdefender)) {
- assert(other_player->player_no != pdefender->owner);
+ assert(other_player->index != pdefender->owner);
lsend_packet_unit_short_info(other_player->connections,
&unit_def_short_packet);
}
@@ -1543,8 +1543,8 @@
/* You are allowed to unload a unit if it is yours or if the transporter
* is yours. */
- if (pcargo->owner != pplayer->player_no
- && ptrans->owner != pplayer->player_no) {
+ if (pcargo->owner != pplayer->index
+ && ptrans->owner != pplayer->index) {
return;
}
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.341
diff -u -r1.341 unittools.c
--- server/unittools.c 28 Apr 2005 04:15:42 -0000 1.341
+++ server/unittools.c 28 Apr 2005 20:41:11 -0000
@@ -1991,7 +1991,7 @@
struct player *pplayer = pconn->player;
if ((!pplayer && pconn->observer)
- || pplayer->player_no == punit->owner) {
+ || pplayer->index == punit->owner) {
send_packet_unit_info(pconn, &info);
} else {
if (can_player_see_unit_at(pplayer, punit, punit->tile)
|
|