96
100
SetWindowText(GetDlgItem(science_dlg, ID_SCIENCE_TOP), text);
97
101
ListBox_ResetContent(GetDlgItem(science_dlg, ID_SCIENCE_LIST));
99
tech_type_iterate(tech_id) {
100
if (get_invention(game.player_ptr, tech_id) == TECH_KNOWN
101
&& tech_id != A_NONE) {
103
advance_index_iterate(A_FIRST, tech_id) {
104
if (TECH_KNOWN == player_invention_state(client.conn.playing, tech_id)) {
102
105
id = ListBox_AddString(GetDlgItem(science_dlg, ID_SCIENCE_LIST),
103
advance_name_for_player(game.player_ptr, tech_id));
106
advance_name_for_player(client.conn.playing, tech_id));
104
107
ListBox_SetItemData(GetDlgItem(science_dlg,ID_SCIENCE_LIST), id,
107
} tech_type_iterate_end;
110
} advance_index_iterate_end;
109
112
ComboBox_ResetContent(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH));
111
if (get_player_research(game.player_ptr)->researching == A_UNSET) {
114
if (A_UNSET == get_player_research(client.conn.playing)->researching) {
112
115
id = ComboBox_AddString(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
113
advance_name_for_player(game.player_ptr, A_NONE));
116
advance_name_for_player(client.conn.playing, A_NONE));
114
117
ComboBox_SetItemData(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
116
119
ComboBox_SetCurSel(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
120
123
my_snprintf(text, sizeof(text), "%d/%d",
121
get_player_research(game.player_ptr)->bulbs_researched,
122
total_bulbs_required(game.player_ptr));
124
get_player_research(client.conn.playing)->bulbs_researched,
125
total_bulbs_required(client.conn.playing));
125
128
SetWindowText(GetDlgItem(science_dlg, ID_SCIENCE_PROG), text);
127
if (!is_future_tech(get_player_research(game.player_ptr)->researching)) {
128
tech_type_iterate(tech_id) {
129
if (get_invention(game.player_ptr, tech_id) != TECH_REACHABLE) {
130
if (!is_future_tech(get_player_research(client.conn.playing)->researching)) {
131
advance_index_iterate(A_FIRST, tech_id) {
132
if (TECH_PREREQS_KNOWN !=
133
player_invention_state(client.conn.playing, tech_id)) {
133
137
id = ComboBox_AddString(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
134
advance_name_for_player(game.player_ptr, tech_id));
138
advance_name_for_player(client.conn.playing, tech_id));
135
139
ComboBox_SetItemData(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
137
if (tech_id == get_player_research(game.player_ptr)->researching) {
141
if (tech_id == get_player_research(client.conn.playing)->researching) {
138
142
ComboBox_SetCurSel(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
141
} tech_type_iterate_end;
145
} advance_index_iterate_end;
143
tech_id = game.control.num_tech_types + 1
144
+ get_player_research(game.player_ptr)->future_tech;
147
tech_id = advance_count() + 1
148
+ get_player_research(client.conn.playing)->future_tech;
145
149
id = ComboBox_AddString(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
146
advance_name_for_player(game.player_ptr, tech_id));
150
advance_name_for_player(client.conn.playing, tech_id));
147
151
ComboBox_SetItemData(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
149
153
ComboBox_SetCurSel(GetDlgItem(science_dlg, ID_SCIENCE_RESEARCH),
152
156
ComboBox_ResetContent(GetDlgItem(science_dlg,ID_SCIENCE_GOAL));
154
tech_type_iterate(tech_id) {
155
if (tech_is_available(game.player_ptr, tech_id)
156
&& get_invention(game.player_ptr, tech_id) != TECH_KNOWN
157
&& advances[tech_id].req[0] != A_LAST
158
&& advances[tech_id].req[1] != A_LAST
159
&& (num_unknown_techs_for_goal(game.player_ptr, tech_id) < 11
160
|| tech_id == get_player_research(game.player_ptr)->tech_goal)) {
158
advance_index_iterate(A_FIRST, tech_id) {
159
if (player_invention_reachable(client.conn.playing, tech_id)
160
&& TECH_KNOWN != player_invention_state(client.conn.playing, tech_id)
161
&& (11 > num_unknown_techs_for_goal(client.conn.playing, tech_id)
162
|| tech_id == get_player_research(client.conn.playing)->tech_goal)) {
161
163
id = ComboBox_AddString(GetDlgItem(science_dlg,ID_SCIENCE_GOAL),
162
advance_name_for_player(game.player_ptr, tech_id));
164
advance_name_for_player(client.conn.playing, tech_id));
163
165
ComboBox_SetItemData(GetDlgItem(science_dlg,ID_SCIENCE_GOAL),
165
if (tech_id == get_player_research(game.player_ptr)->tech_goal)
167
if (tech_id == get_player_research(client.conn.playing)->tech_goal)
166
168
ComboBox_SetCurSel(GetDlgItem(science_dlg,ID_SCIENCE_GOAL),
170
} tech_type_iterate_end;
172
} advance_index_iterate_end;
172
if (get_player_research(game.player_ptr)->tech_goal == A_UNSET) {
174
if (A_UNSET == get_player_research(client.conn.playing)->tech_goal) {
173
175
id = ComboBox_AddString(GetDlgItem(science_dlg, ID_SCIENCE_GOAL),
174
advance_name_for_player(game.player_ptr, A_NONE));
176
advance_name_for_player(client.conn.playing, A_NONE));
175
177
ComboBox_SetItemData(GetDlgItem(science_dlg, ID_SCIENCE_GOAL),
177
179
ComboBox_SetCurSel(GetDlgItem(science_dlg, ID_SCIENCE_GOAL),
181
steps = num_unknown_techs_for_goal(game.player_ptr,
182
get_player_research(game.player_ptr)->tech_goal);
183
steps = num_unknown_techs_for_goal(client.conn.playing,
184
get_player_research(client.conn.playing)->tech_goal);
183
185
my_snprintf(text, sizeof(text),
184
186
PL_("(%d step)", "(%d steps)", steps), steps);
185
187
SetWindowText(GetDlgItem(science_dlg,ID_SCIENCE_STEPS),text);
232
235
to = ComboBox_GetItemData(GetDlgItem(hWnd, ID_SCIENCE_GOAL),
234
steps = num_unknown_techs_for_goal(game.player_ptr, to);
237
steps = num_unknown_techs_for_goal(client.conn.playing, to);
235
238
my_snprintf(text, sizeof(text),
236
239
PL_("(%d step)", "(%d steps)", steps),
238
241
SetWindowText(GetDlgItem(hWnd,ID_SCIENCE_STEPS), text);
239
dsend_packet_player_tech_goal(&aconnection, to);
242
dsend_packet_player_tech_goal(&client.conn, to);
564
567
ut1 = activeunits_type[sel];
565
568
CHECK_UNIT_TYPE(ut1);
566
ut2=can_upgrade_unittype(game.player_ptr,activeunits_type[sel]);
569
ut2 = can_upgrade_unittype(client.conn.playing, activeunits_type[sel]);
567
570
my_snprintf(buf, sizeof(buf),
568
571
_("Upgrade as many %s to %s as possible for %d gold each?\n"
569
572
"Treasury contains %d gold."),
570
573
utype_name_translation(ut1),
571
574
utype_name_translation(ut2),
572
unit_upgrade_price(game.player_ptr, ut1, ut2),
573
game.player_ptr->economic.gold);
575
unit_upgrade_price(client.conn.playing, ut1, ut2),
576
client.conn.playing->economic.gold);
575
578
popup_message_dialog(NULL,
576
579
/*"upgradedialog"*/
623
625
memset(unitarray, '\0', sizeof(unitarray));
624
unit_list_iterate(game.player_ptr->units, punit) {
625
(unitarray[unit_type(punit)->index].active_count)++;
626
if (punit->homecity) {
627
unitarray[unit_type(punit)->index].upkeep_shield += punit->upkeep[O_SHIELD];
628
unitarray[unit_type(punit)->index].upkeep_food += punit->upkeep[O_FOOD];
629
/* TODO: gold upkeep */
633
unit_list_iterate_end;
634
city_list_iterate(game.player_ptr->cities,pcity) {
635
if (pcity->production.is_unit) {
636
(unitarray[pcity->production.value].building_count)++;
627
city_list_iterate(client.conn.playing->cities, pcity) {
628
unit_list_iterate(client.conn.playing->units, punit) {
629
Unit_type_id uti = utype_index(unit_type(punit));
631
(unitarray[uti].active_count)++;
632
if (punit->homecity) {
633
output_type_iterate(o) {
634
unitarray[uti].upkeep[o] += punit->upkeep[o];
635
} output_type_iterate_end;
637
} unit_list_iterate_end;
638
} city_list_iterate_end;
640
city_list_iterate(client.conn.playing->cities, pcity) {
641
if (VUT_UTYPE == pcity->production.kind) {
642
struct unit_type *punittype = pcity->production.value.utype;
643
(unitarray[utype_index(punittype)].building_count)++;
639
646
city_list_iterate_end;
642
649
memset(&unittotals, '\0', sizeof(unittotals));
643
unit_type_iterate(i) {
644
if ((unitarray[i->index].active_count > 0)
645
|| (unitarray[i->index].building_count > 0)) {
646
can = (can_upgrade_unittype(game.player_ptr, i) != NULL);
647
my_snprintf(buf[0], sizeof(buf[0]), "%s", utype_name_translation(i));
650
unit_type_iterate(putype) {
651
int index = utype_index(putype);
652
if ((unitarray[index].active_count > 0)
653
|| (unitarray[index].building_count > 0)) {
654
can = (can_upgrade_unittype(client.conn.playing, putype) != NULL);
655
my_snprintf(buf[0], sizeof(buf[0]), "%s",
656
utype_name_translation(putype));
648
657
my_snprintf(buf[1], sizeof(buf[1]), "%c", can ? '*': '-');
649
658
my_snprintf(buf[2], sizeof(buf[2]), "%3d",
650
unitarray[i->index].building_count);
659
unitarray[index].building_count);
651
660
my_snprintf(buf[3], sizeof(buf[3]), "%3d",
652
unitarray[i->index].active_count);
661
unitarray[index].active_count);
653
662
my_snprintf(buf[4], sizeof(buf[4]), "%3d",
654
unitarray[i->index].upkeep_shield);
663
unitarray[index].upkeep[O_SHIELD]);
655
664
my_snprintf(buf[5], sizeof(buf[5]), "%3d",
656
unitarray[i->index].upkeep_food);
657
fcwin_listview_add_row(lv,k,AU_COL,row);
658
activeunits_type[k]=(unitarray[i->index].active_count > 0) ? i : NULL;
665
unitarray[index].upkeep[O_FOOD]);
666
/* TODO: add upkeep[O_GOLD] here */
667
fcwin_listview_add_row(lv,k,AU_COL,row);
668
activeunits_type[k]=(unitarray[index].active_count > 0) ? putype : NULL;
660
unittotals.active_count += unitarray[i->index].active_count;
661
unittotals.upkeep_shield += unitarray[i->index].upkeep_shield;
662
unittotals.upkeep_food += unitarray[i->index].upkeep_food;
663
unittotals.building_count += unitarray[i->index].building_count;
670
unittotals.active_count += unitarray[index].active_count;
671
output_type_iterate(o) {
672
unittotals.upkeep[0] = unitarray[index].upkeep[o];
673
} output_type_iterate_end;
674
unittotals.building_count += unitarray[index].building_count;
665
676
} unit_type_iterate_end;
669
680
my_snprintf(buf[2],sizeof(buf[2]),"%d",unittotals.building_count);
670
681
my_snprintf(buf[3],sizeof(buf[3]),"%d",unittotals.active_count);
671
my_snprintf(buf[4],sizeof(buf[4]),"%d",unittotals.upkeep_shield);
672
my_snprintf(buf[5],sizeof(buf[5]),"%d",unittotals.upkeep_food);
682
my_snprintf(buf[4],sizeof(buf[4]),"%d",unittotals.upkeep[O_SHIELD]);
683
my_snprintf(buf[5],sizeof(buf[5]),"%d",unittotals.upkeep[O_FOOD]);
684
/* TODO: add upkeep[O_GOLD] here */
673
685
fcwin_listview_add_row(lv,k,AU_COL,row);
674
686
EnableWindow(GetDlgItem(activeunits_dlg,ID_MILITARY_UPGRADE),FALSE);
675
687
ListView_SetColumnWidth(lv,0,LVSCW_AUTOSIZE);
830
839
if (val != o->val) {
831
char buffer[MAX_LEN_MSG];
832
my_snprintf(buffer, MAX_LEN_MSG, "/set %s %d",
840
send_chat_printf("/set %s %d", o->name, val);
837
843
char strval[512];
838
844
Edit_GetText(GetDlgItem(tab_wnds[tab], ID_OPTIONS_BASE + i),
840
846
if (strcmp(strval, o->strval) != 0) {
841
char buffer[MAX_LEN_MSG];
842
my_snprintf(buffer, MAX_LEN_MSG, "/set %s %s",
847
send_chat_printf("/set %s %s", o->name, strval);