[Freeciv-commits] r26259 - in /branches/S2_4: common/unit.h server/savegame.c server/savegame2.c server/unithand.c server/unittools.c
Author: pepeto Date: Sun Sep 7 09:54:57 2014 New Revision: 26259 URL: http://svn.gna.org/viewcvs/freeciv?rev=26259view=rev Log: Made the server able to identify if the unit orders sent by the client would be end by an action such as attack, establishing trade route etc. If not, check last move to ensure the unit will not attack undesired tiles. Reported anonymously See gna bug #20618 Modified: branches/S2_4/common/unit.h branches/S2_4/server/savegame.c branches/S2_4/server/savegame2.c branches/S2_4/server/unithand.c branches/S2_4/server/unittools.c Modified: branches/S2_4/common/unit.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/unit.h?rev=26259r1=26258r2=26259view=diff == --- branches/S2_4/common/unit.h (original) +++ branches/S2_4/common/unit.h Sun Sep 7 09:54:57 2014 @@ -222,6 +222,8 @@ struct vision *vision; time_t action_timestamp; int action_turn; + + bool last_order_move_is_safe; } server; }; }; Modified: branches/S2_4/server/savegame.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/savegame.c?rev=26259r1=26258r2=26259view=diff == --- branches/S2_4/server/savegame.c (original) +++ branches/S2_4/server/savegame.c Sun Sep 7 09:54:57 2014 @@ -2198,6 +2198,7 @@ player%d.u%d.orders_repeat, plrno, i); punit-orders.vigilant = secfile_lookup_bool_default(file, FALSE, player%d.u%d.orders_vigilant, plrno, i); +punit-server.last_order_move_is_safe = FALSE; orders_buf = secfile_lookup_str_default(file, , player%d.u%d.orders_list, plrno, i); Modified: branches/S2_4/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/savegame2.c?rev=26259r1=26258r2=26259view=diff == --- branches/S2_4/server/savegame2.c(original) +++ branches/S2_4/server/savegame2.cSun Sep 7 09:54:57 2014 @@ -4690,6 +4690,9 @@ punit-orders.vigilant = secfile_lookup_bool_default(loading-file, FALSE, %s.orders_vigilant, unitstr); + punit-server.last_order_move_is_safe += secfile_lookup_bool_default(loading-file, FALSE, + %s.orders_last_move_safe, unitstr); orders_unitstr = secfile_lookup_str_default(loading-file, , @@ -4899,6 +4902,9 @@ %s.orders_repeat, buf); secfile_insert_bool(saving-file, punit-orders.vigilant, %s.orders_vigilant, buf); + secfile_insert_bool(saving-file, + punit-server.last_order_move_is_safe, + %s.orders_last_move_safe, buf); for (j = 0; j len; j++) { orders_buf[j] = order2char(punit-orders.list[j].order); @@ -4939,6 +4945,8 @@ secfile_insert_int(saving-file, 0, %s.orders_index, buf); secfile_insert_bool(saving-file, FALSE, %s.orders_repeat, buf); secfile_insert_bool(saving-file, FALSE, %s.orders_vigilant, buf); + secfile_insert_bool(saving-file, FALSE, + %s.orders_last_move_safe, buf); secfile_insert_str(saving-file, -, %s.orders_list, buf); secfile_insert_str(saving-file, -, %s.dir_list, buf); secfile_insert_str(saving-file, -, %s.activity_list, buf); Modified: branches/S2_4/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/unithand.c?rev=26259r1=26258r2=26259view=diff == --- branches/S2_4/server/unithand.c (original) +++ branches/S2_4/server/unithand.c Sun Sep 7 09:54:57 2014 @@ -2243,6 +2243,8 @@ int length = packet-length, i; struct unit *punit = player_unit_by_number(pplayer, packet-unit_id); struct tile *src_tile = index_to_tile(packet-src_tile); + struct tile *dest_tile = index_to_tile(packet-dest_tile); + const struct vision_site *psite; if (NULL == punit) { /* Probably died or bribed. */ @@ -2359,8 +2361,31 @@ punit-orders.list[i].base = packet-base[i]; } + /* Determine if the last move is safe or not. */ + punit-server.last_order_move_is_safe = TRUE; + if (dest_tile != NULL) { +/* Is a city visible for player? */ +psite = map_get_player_city(dest_tile, pplayer); +if (psite != NULL + psite-identity IDENTITY_NUMBER_ZERO + psite-owner != NULL + !pplayers_allied(pplayer, psite-owner)) { + punit-server.last_order_move_is_safe = FALSE; +} + +if (punit-server.last_order_move_is_safe) { + unit_list_iterate(dest_tile-units, aunit) { +if (!pplayers_allied(pplayer, unit_owner(aunit)) + can_player_see_unit(pplayer, aunit))
[Freeciv-commits] r26258 - in /branches/S2_5: common/unit.h server/savegame.c server/savegame2.c server/unithand.c server/unittools.c
Author: pepeto Date: Sun Sep 7 09:54:52 2014 New Revision: 26258 URL: http://svn.gna.org/viewcvs/freeciv?rev=26258view=rev Log: Made the server able to identify if the unit orders sent by the client would be end by an action such as attack, establishing trade route etc. If not, check last move to ensure the unit will not attack undesired tiles. Reported anonymously See gna bug #20618 Modified: branches/S2_5/common/unit.h branches/S2_5/server/savegame.c branches/S2_5/server/savegame2.c branches/S2_5/server/unithand.c branches/S2_5/server/unittools.c Modified: branches/S2_5/common/unit.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.h?rev=26258r1=26257r2=26258view=diff == --- branches/S2_5/common/unit.h (original) +++ branches/S2_5/common/unit.h Sun Sep 7 09:54:52 2014 @@ -216,6 +216,8 @@ struct vision *vision; time_t action_timestamp; int action_turn; + + bool last_order_move_is_safe; } server; }; }; Modified: branches/S2_5/server/savegame.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame.c?rev=26258r1=26257r2=26258view=diff == --- branches/S2_5/server/savegame.c (original) +++ branches/S2_5/server/savegame.c Sun Sep 7 09:54:52 2014 @@ -1736,6 +1736,7 @@ player%d.u%d.orders_repeat, plrno, i); punit-orders.vigilant = secfile_lookup_bool_default(file, FALSE, player%d.u%d.orders_vigilant, plrno, i); +punit-server.last_order_move_is_safe = FALSE; orders_buf = secfile_lookup_str_default(file, , player%d.u%d.orders_list, plrno, i); Modified: branches/S2_5/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame2.c?rev=26258r1=26257r2=26258view=diff == --- branches/S2_5/server/savegame2.c(original) +++ branches/S2_5/server/savegame2.cSun Sep 7 09:54:52 2014 @@ -5138,6 +5138,9 @@ punit-orders.vigilant = secfile_lookup_bool_default(loading-file, FALSE, %s.orders_vigilant, unitstr); + punit-server.last_order_move_is_safe += secfile_lookup_bool_default(loading-file, FALSE, + %s.orders_last_move_safe, unitstr); orders_unitstr = secfile_lookup_str_default(loading-file, , @@ -5410,6 +5413,9 @@ %s.orders_repeat, buf); secfile_insert_bool(saving-file, punit-orders.vigilant, %s.orders_vigilant, buf); + secfile_insert_bool(saving-file, + punit-server.last_order_move_is_safe, + %s.orders_last_move_safe, buf); for (j = 0; j len; j++) { orders_buf[j] = order2char(punit-orders.list[j].order); @@ -5455,6 +5461,8 @@ secfile_insert_int(saving-file, 0, %s.orders_index, buf); secfile_insert_bool(saving-file, FALSE, %s.orders_repeat, buf); secfile_insert_bool(saving-file, FALSE, %s.orders_vigilant, buf); + secfile_insert_bool(saving-file, FALSE, + %s.orders_last_move_safe, buf); secfile_insert_str(saving-file, -, %s.orders_list, buf); secfile_insert_str(saving-file, -, %s.dir_list, buf); secfile_insert_str(saving-file, -, %s.activity_list, buf); Modified: branches/S2_5/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/unithand.c?rev=26258r1=26257r2=26258view=diff == --- branches/S2_5/server/unithand.c (original) +++ branches/S2_5/server/unithand.c Sun Sep 7 09:54:52 2014 @@ -2278,6 +2278,8 @@ int length = packet-length, i; struct unit *punit = player_unit_by_number(pplayer, packet-unit_id); struct tile *src_tile = index_to_tile(packet-src_tile); + struct tile *dest_tile = index_to_tile(packet-dest_tile); + const struct vision_site *psite; if (NULL == punit) { /* Probably died or bribed. */ @@ -2399,8 +2401,31 @@ punit-orders.list[i].road = packet-road[i]; } + /* Determine if the last move is safe or not. */ + punit-server.last_order_move_is_safe = TRUE; + if (dest_tile != NULL) { +/* Is a city visible for player? */ +psite = map_get_player_city(dest_tile, pplayer); +if (psite != NULL + psite-identity IDENTITY_NUMBER_ZERO + psite-owner != NULL + !pplayers_allied(pplayer, psite-owner)) { + punit-server.last_order_move_is_safe = FALSE; +} + +if (punit-server.last_order_move_is_safe) { + unit_list_iterate(dest_tile-units, aunit) { +if (!pplayers_allied(pplayer, unit_owner(aunit)) + can_player_see_unit(pplayer, aunit))
[Freeciv-commits] r26260 - /trunk/client/goto.c
Author: pepeto Date: Sun Sep 7 10:01:35 2014 New Revision: 26260 URL: http://svn.gna.org/viewcvs/freeciv?rev=26260view=rev Log: Fix the turns number for client goto when the move rate of the unit is nil, but it still has moves left (due to tech loss, wonder loss etc.). This will causing erroneous message about long path length (=-1). Originally reported by Jacob Nevins jtn See gna bug #22571 Modified: trunk/client/goto.c Modified: trunk/client/goto.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=26260r1=26259r2=26260view=diff == --- trunk/client/goto.c (original) +++ trunk/client/goto.c Sun Sep 7 10:01:35 2014 @@ -912,14 +912,16 @@ mp = MAX(0, mp); -if (goto_map-template.move_rate == 0) { +if (goto_map-template.move_rate 0) { + /* Round down -- if we can get there this turn with MP left, report 0, + * if we get there with 0 MP, report 1 */ + turns = mp / goto_map-template.move_rate; +} else if (goto_map-template.moves_left_initially 0) { + turns = (mp == goto_map-template.moves_left_initially); +} else { /* Immobile unit can never reach destination. */ - return FALSE; -} - -/* Round down -- if we can get there this turn with MP left, report 0, - * if we get there with 0 MP, report 1 */ -turns = mp / goto_map-template.move_rate; + continue; +} if (min) { *min = MIN(*min, turns); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26262 - /branches/S2_4/client/goto.c
Author: pepeto Date: Sun Sep 7 10:01:48 2014 New Revision: 26262 URL: http://svn.gna.org/viewcvs/freeciv?rev=26262view=rev Log: Fix the turns number for client goto when the move rate of the unit is nil, but it still has moves left (due to tech loss, wonder loss etc.). This will causing erroneous message about long path length (=-1). Originally reported by Jacob Nevins jtn See gna bug #22571 Modified: branches/S2_4/client/goto.c Modified: branches/S2_4/client/goto.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/client/goto.c?rev=26262r1=26261r2=26262view=diff == --- branches/S2_4/client/goto.c (original) +++ branches/S2_4/client/goto.c Sun Sep 7 10:01:48 2014 @@ -908,14 +908,16 @@ mp = MAX(0, mp); -if (goto_map-template.move_rate == 0) { +if (goto_map-template.move_rate 0) { + /* Round down -- if we can get there this turn with MP left, report 0, + * if we get there with 0 MP, report 1 */ + turns = mp / goto_map-template.move_rate; +} else if (goto_map-template.moves_left_initially 0) { + turns = (mp == goto_map-template.moves_left_initially); +} else { /* Immobile unit can never reach destination. */ - return FALSE; -} - -/* Round down -- if we can get there this turn with MP left, report 0, - * if we get there with 0 MP, report 1 */ -turns = mp / goto_map-template.move_rate; + continue; +} if (min) { *min = MIN(*min, turns); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26265 - /branches/S2_4/server/connecthand.c
Author: pepeto Date: Sun Sep 7 10:27:32 2014 New Revision: 26265 URL: http://svn.gna.org/viewcvs/freeciv?rev=26265view=rev Log: Do not send the vote updates to the connecting user before he has received the vote info itself. It happened in server initial state when a user joined when they were running votes. Reported by mir3x See gna bug #22566 Modified: branches/S2_4/server/connecthand.c Modified: branches/S2_4/server/connecthand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/connecthand.c?rev=26265r1=26264r2=26265view=diff == --- branches/S2_4/server/connecthand.c (original) +++ branches/S2_4/server/connecthand.c Sun Sep 7 10:27:32 2014 @@ -223,7 +223,10 @@ } } else { if (!game_was_started()) { -if (!connection_attach(pconn, NULL, FALSE)) { +if (connection_attach_real(pconn, NULL, FALSE, TRUE)) { + pplayer = conn_get_player(pconn); + fc_assert(pplayer != NULL); +} else { notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(Couldn't attach your connection to new player.)); log_verbose(%s is not attached to a player, pconn-username); @@ -235,25 +238,16 @@ send_conn_info(game.est_connections, dest); - send_pending_events(pconn, TRUE); - send_running_votes(pconn, FALSE); - if (NULL == pplayer) { -/* Else this has already been done in connection_attach(). */ +/* Else this has already been done in connection_attach_real(). */ +send_pending_events(pconn, TRUE); +send_running_votes(pconn, FALSE); restore_access_level(pconn); send_conn_info(dest, game.est_connections); - } - - /* remind the connection who he is */ - if (NULL == pconn-playing) { + notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(You are logged in as '%s' connected to no player.), pconn-username); - } else if (strcmp(player_name(pconn-playing), ANON_PLAYER_NAME) == 0) { -notify_conn(dest, NULL, E_CONNECTION, ftc_server, - _(You are logged in as '%s' connected to an - anonymous player.), - pconn-username); } else { notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(You are logged in as '%s' connected to %s.), @@ -628,6 +622,8 @@ * connecthand.c::establish_new_connection(). */ switch (server_state()) { case S_S_INITIAL: +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); break; case S_S_RUNNING: @@ -641,11 +637,8 @@ dsend_packet_start_phase(pconn, game.info.phase); /* Must be after C_S_RUNNING client state to be effective. */ send_diplomatic_meetings(pconn); -if (!connecting) { - /* Those will be sent later in establish_new_connection(). */ - send_pending_events(pconn, FALSE); - send_running_votes(pconn, TRUE); -} +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); break; case S_S_OVER: @@ -656,10 +649,9 @@ } conn_compression_thaw(pconn); report_final_scores(pconn-self); +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); if (!connecting) { - /* Those will be sent later in establish_new_connection(). */ - send_pending_events(pconn, FALSE); - send_running_votes(pconn, TRUE); /* Send information about delegation(s). */ send_delegation_info(pconn); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26264 - /branches/S2_5/server/connecthand.c
Author: pepeto Date: Sun Sep 7 10:27:28 2014 New Revision: 26264 URL: http://svn.gna.org/viewcvs/freeciv?rev=26264view=rev Log: Do not send the vote updates to the connecting user before he has received the vote info itself. It happened in server initial state when a user joined when they were running votes. Reported by mir3x See gna bug #22566 Modified: branches/S2_5/server/connecthand.c Modified: branches/S2_5/server/connecthand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/connecthand.c?rev=26264r1=26263r2=26264view=diff == --- branches/S2_5/server/connecthand.c (original) +++ branches/S2_5/server/connecthand.c Sun Sep 7 10:27:28 2014 @@ -223,7 +223,10 @@ } } else { if (!game_was_started()) { -if (!connection_attach(pconn, NULL, FALSE)) { +if (connection_attach_real(pconn, NULL, FALSE, TRUE)) { + pplayer = conn_get_player(pconn); + fc_assert(pplayer != NULL); +} else { notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(Couldn't attach your connection to new player.)); log_verbose(%s is not attached to a player, pconn-username); @@ -235,25 +238,16 @@ send_conn_info(game.est_connections, dest); - send_pending_events(pconn, TRUE); - send_running_votes(pconn, FALSE); - if (NULL == pplayer) { -/* Else this has already been done in connection_attach(). */ +/* Else this has already been done in connection_attach_real(). */ +send_pending_events(pconn, TRUE); +send_running_votes(pconn, FALSE); restore_access_level(pconn); send_conn_info(dest, game.est_connections); - } - - /* remind the connection who he is */ - if (NULL == pconn-playing) { + notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(You are logged in as '%s' connected to no player.), pconn-username); - } else if (strcmp(player_name(pconn-playing), ANON_PLAYER_NAME) == 0) { -notify_conn(dest, NULL, E_CONNECTION, ftc_server, - _(You are logged in as '%s' connected to an - anonymous player.), - pconn-username); } else { notify_conn(dest, NULL, E_CONNECTION, ftc_server, _(You are logged in as '%s' connected to %s.), @@ -646,6 +640,8 @@ * connecthand.c::establish_new_connection(). */ switch (server_state()) { case S_S_INITIAL: +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); break; case S_S_RUNNING: @@ -659,11 +655,8 @@ dsend_packet_start_phase(pconn, game.info.phase); /* Must be after C_S_RUNNING client state to be effective. */ send_diplomatic_meetings(pconn); -if (!connecting) { - /* Those will be sent later in establish_new_connection(). */ - send_pending_events(pconn, FALSE); - send_running_votes(pconn, TRUE); -} +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); break; case S_S_OVER: @@ -674,10 +667,9 @@ } conn_compression_thaw(pconn); report_final_scores(pconn-self); +send_pending_events(pconn, connecting); +send_running_votes(pconn, !connecting); if (!connecting) { - /* Those will be sent later in establish_new_connection(). */ - send_pending_events(pconn, FALSE); - send_running_votes(pconn, TRUE); /* Send information about delegation(s). */ send_delegation_info(pconn); } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26267 - /branches/S2_5/server/generator/mapgen.c
Author: pepeto Date: Sun Sep 7 10:31:35 2014 New Revision: 26267 URL: http://svn.gna.org/viewcvs/freeciv?rev=26267view=rev Log: Fix compilation warning about use of uninitialized variable 'l'. Reported by Christian Knoke chrisk See gna bug #22572 Modified: branches/S2_5/server/generator/mapgen.c Modified: branches/S2_5/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/generator/mapgen.c?rev=26267r1=26266r2=26267view=diff == --- branches/S2_5/server/generator/mapgen.c (original) +++ branches/S2_5/server/generator/mapgen.c Sun Sep 7 10:31:35 2014 @@ -3224,7 +3224,7 @@ struct fair_tile *pend; int n = ((river_pct * size * map.num_cardinal_dirs * map.num_cardinal_dirs) / 200); -int length_max = 3, l; +int length_max = 3, length, l; enum direction8 dir; int road_idx; int dirs_num; @@ -3281,6 +3281,7 @@ /* Check a river in one direction. */ pend = NULL; + length = -1; dir = -1; dirs_num = 0; for (j = 0; j map.num_valid_dirs; j++) { @@ -3332,6 +,7 @@ if (finished fc_rand(++dirs_num) == 0) { dir = map.valid_dirs[j]; pend = pftile2; + length = l; } } if (pend == NULL) { @@ -3344,10 +3346,12 @@ index_to_map_pos_x(pend - pisland), index_to_map_pos_y(pend - pisland), direction8_name(dir), - l); +length); for (;;) { BV_SET(pftile-roads, road_idx); +length--; if (pftile == pend) { + fc_assert(length == 0); break; } pftile = fair_map_tile_step(pisland, pftile, dir); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26266 - /trunk/server/generator/mapgen.c
Author: pepeto Date: Sun Sep 7 10:31:30 2014 New Revision: 26266 URL: http://svn.gna.org/viewcvs/freeciv?rev=26266view=rev Log: Fix compilation warning about use of uninitialized variable 'l'. Reported by Christian Knoke chrisk See gna bug #22572 Modified: trunk/server/generator/mapgen.c Modified: trunk/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/mapgen.c?rev=26266r1=26265r2=26266view=diff == --- trunk/server/generator/mapgen.c (original) +++ trunk/server/generator/mapgen.c Sun Sep 7 10:31:30 2014 @@ -3222,7 +3222,7 @@ struct fair_tile *pend; int n = ((river_pct * size * map.num_cardinal_dirs * map.num_cardinal_dirs) / 200); -int length_max = 3, l; +int length_max = 3, length, l; enum direction8 dir; int extra_idx; int dirs_num; @@ -3279,6 +3279,7 @@ /* Check a river in one direction. */ pend = NULL; + length = -1; dir = -1; dirs_num = 0; for (j = 0; j map.num_valid_dirs; j++) { @@ -3330,6 +3331,7 @@ if (finished fc_rand(++dirs_num) == 0) { dir = map.valid_dirs[j]; pend = pftile2; + length = l; } } if (pend == NULL) { @@ -3342,10 +3344,12 @@ index_to_map_pos_x(pend - pisland), index_to_map_pos_y(pend - pisland), direction8_name(dir), - l); +length); for (;;) { BV_SET(pftile-extras, extra_idx); +length--; if (pftile == pend) { + fc_assert(length == 0); break; } pftile = fair_map_tile_step(pisland, pftile, dir); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26268 - in /trunk/server: generator/mapgen.c srv_main.c
Author: pepeto Date: Sun Sep 7 10:51:10 2014 New Revision: 26268 URL: http://svn.gna.org/viewcvs/freeciv?rev=26268view=rev Log: When generating the map, reset settings 'generator', 'startpos' and 'teamplacement' at every step of the loop. Show to the user what of these setting has been modified after success. See gna patch #5180 Modified: trunk/server/generator/mapgen.c trunk/server/srv_main.c Modified: trunk/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/mapgen.c?rev=26268r1=26267r2=26268view=diff == --- trunk/server/generator/mapgen.c (original) +++ trunk/server/generator/mapgen.c Sun Sep 7 10:51:10 2014 @@ -1531,6 +1531,7 @@ success = create_start_positions(mode, initial_unit); if (success) { +map.server.startpos = mode; break; } @@ -3435,6 +3436,11 @@ fc_assert(team_players_num + single_players_num == player_count()); /* Take in account the 'startpos' setting. */ + if (map.server.startpos == MAPSTARTPOS_DEFAULT + map.server.team_placement == TEAM_PLACEMENT_CONTINENT) { +map.server.startpos = MAPSTARTPOS_ALL; + } + switch (map.server.startpos) { case MAPSTARTPOS_2or3: { @@ -3473,6 +3479,7 @@ /* Every team doesn't have the same number of players. Cannot * consider this option. */ players_per_island = 1; +map.server.team_placement = TEAM_PLACEMENT_CLOSEST; break; } } @@ -3483,6 +3490,9 @@ case MAPSTARTPOS_SINGLE: case MAPSTARTPOS_VARIABLE: break; + } + if (players_per_island == 1) { +map.server.startpos = MAPSTARTPOS_SINGLE; } whole_map_iterate(ptile) { Modified: trunk/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=26268r1=26267r2=26268view=diff == --- trunk/server/srv_main.c (original) +++ trunk/server/srv_main.c Sun Sep 7 10:51:10 2014 @@ -2688,6 +2688,15 @@ if (map_is_empty() || (MAPGEN_SCENARIO == map.server.generator game.info.is_new_game)) { +struct { + const char *name; + char value[MAX_LEN_NAME * 2]; + char pretty[MAX_LEN_NAME * 2]; +} mapgen_settings[] = { + { generator, }, + { startpos, }, + { teamplacement, } +}; int i; bool retry_ok = (map.server.seed == 0 map.server.generator != MAPGEN_SCENARIO); int max = retry_ok ? 3 : 1; @@ -2698,8 +2707,20 @@ for (i = 0; utype == NULL i sucount; i++) { utype = crole_to_unit_type(game.server.start_units[i], NULL); } - fc_assert(utype != NULL); + +/* Register map generator setting main values. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + const struct setting *pset = setting_by_name(mapgen_settings[i].name); + + fc_assert_action(pset != NULL, continue); + (void) setting_value_name(pset, FALSE, +mapgen_settings[i].value, +sizeof(mapgen_settings[i].value)); + (void) setting_value_name(pset, TRUE, +mapgen_settings[i].pretty, +sizeof(mapgen_settings[i].pretty)); +} for (i = 0; !created i max ; i++) { created = map_fractal_generate(TRUE, utype); @@ -2723,6 +2744,24 @@ /* Remove old information already present in tiles */ map_free(); +/* Restore the settings. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + struct setting *pset = setting_by_name(mapgen_settings[i].name); +#ifdef NDEBUG + setting_enum_set(pset, mapgen_settings[i].value, NULL, NULL, 0); +#else + char error[128]; + bool success; + + fc_assert_action(pset != NULL, continue); + success = setting_enum_set(pset, mapgen_settings[i].value, + NULL, error, sizeof(error)); + fc_assert_msg(success == TRUE, +Failed to restore '%s': %s, +mapgen_settings[i].name, +error); +#endif +} map_allocate(); /* NOT map_init() as that would overwrite settings */ } } @@ -2738,6 +2777,28 @@ } game_map_init(); + +/* Test if main map generator settings have changed. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + const struct setting *pset = setting_by_name(mapgen_settings[i].name); + char pretty[sizeof(mapgen_settings[i].pretty)]; + + fc_assert_action(pset != NULL, continue); + if (0 == strcmp(setting_value_name(pset, TRUE, pretty, + sizeof(pretty)), + mapgen_settings[i].pretty)) { +continue; /* Setting didn't change. */ + } +
[Freeciv-commits] r26269 - in /branches/S2_5/server: generator/mapgen.c srv_main.c
Author: pepeto Date: Sun Sep 7 10:51:19 2014 New Revision: 26269 URL: http://svn.gna.org/viewcvs/freeciv?rev=26269view=rev Log: When generating the map, reset settings 'generator', 'startpos' and 'teamplacement' at every step of the loop. Show to the user what of these setting has been modified after success. See gna patch #5180 Modified: branches/S2_5/server/generator/mapgen.c branches/S2_5/server/srv_main.c Modified: branches/S2_5/server/generator/mapgen.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/generator/mapgen.c?rev=26269r1=26268r2=26269view=diff == --- branches/S2_5/server/generator/mapgen.c (original) +++ branches/S2_5/server/generator/mapgen.c Sun Sep 7 10:51:19 2014 @@ -1531,6 +1531,7 @@ success = create_start_positions(mode, initial_unit); if (success) { +map.server.startpos = mode; break; } @@ -3422,6 +3423,11 @@ fc_assert(team_players_num + single_players_num == player_count()); /* Take in account the 'startpos' setting. */ + if (map.server.startpos == MAPSTARTPOS_DEFAULT + map.server.team_placement == TEAM_PLACEMENT_CONTINENT) { +map.server.startpos = MAPSTARTPOS_ALL; + } + switch (map.server.startpos) { case MAPSTARTPOS_2or3: { @@ -3460,6 +3466,7 @@ /* Every team doesn't have the same number of players. Cannot * consider this option. */ players_per_island = 1; +map.server.team_placement = TEAM_PLACEMENT_CLOSEST; break; } } @@ -3470,6 +3477,9 @@ case MAPSTARTPOS_SINGLE: case MAPSTARTPOS_VARIABLE: break; + } + if (players_per_island == 1) { +map.server.startpos = MAPSTARTPOS_SINGLE; } whole_map_iterate(ptile) { Modified: branches/S2_5/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/srv_main.c?rev=26269r1=26268r2=26269view=diff == --- branches/S2_5/server/srv_main.c (original) +++ branches/S2_5/server/srv_main.c Sun Sep 7 10:51:19 2014 @@ -2550,6 +2550,15 @@ if (map_is_empty() || (MAPGEN_SCENARIO == map.server.generator game.info.is_new_game)) { +struct { + const char *name; + char value[MAX_LEN_NAME * 2]; + char pretty[MAX_LEN_NAME * 2]; +} mapgen_settings[] = { + { generator, }, + { startpos, }, + { teamplacement, } +}; int i; bool retry_ok = (map.server.seed == 0 map.server.generator != MAPGEN_SCENARIO); int max = retry_ok ? 2 : 1; @@ -2560,8 +2569,20 @@ for (i = 0; utype == NULL i sucount; i++) { utype = crole_to_unit_type(game.server.start_units[i], NULL); } - fc_assert(utype != NULL); + +/* Register map generator setting main values. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + const struct setting *pset = setting_by_name(mapgen_settings[i].name); + + fc_assert_action(pset != NULL, continue); + (void) setting_value_name(pset, FALSE, +mapgen_settings[i].value, +sizeof(mapgen_settings[i].value)); + (void) setting_value_name(pset, TRUE, +mapgen_settings[i].pretty, +sizeof(mapgen_settings[i].pretty)); +} for (i = 0; !created i max ; i++) { created = map_fractal_generate(TRUE, utype); @@ -2579,6 +2600,24 @@ /* Remove old information already present in tiles */ map_free(); +/* Restore the settings. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + struct setting *pset = setting_by_name(mapgen_settings[i].name); +#ifdef NDEBUG + setting_enum_set(pset, mapgen_settings[i].value, NULL, NULL, 0); +#else + char error[128]; + bool success; + + fc_assert_action(pset != NULL, continue); + success = setting_enum_set(pset, mapgen_settings[i].value, + NULL, error, sizeof(error)); + fc_assert_msg(success == TRUE, +Failed to restore '%s': %s, +mapgen_settings[i].name, +error); +#endif +} map_allocate(); /* NOT map_init() as that would overwrite settings */ } } @@ -2593,6 +2632,28 @@ script_server_signal_emit(map_generated, 0); } game_map_init(); + +/* Test if main map generator settings have changed. */ +for (i = 0; i ARRAY_SIZE(mapgen_settings); i++) { + const struct setting *pset = setting_by_name(mapgen_settings[i].name); + char pretty[sizeof(mapgen_settings[i].pretty)]; + + fc_assert_action(pset != NULL, continue); + if (0 == strcmp(setting_value_name(pset, TRUE, pretty, +
[Freeciv-commits] r26271 - in /branches/S2_4/server: stdinhand.c voting.c voting.h
Author: pepeto Date: Sun Sep 7 10:59:35 2014 New Revision: 26271 URL: http://svn.gna.org/viewcvs/freeciv?rev=26271view=rev Log: Do not make vote if the caller has basic access level and use a ctrl access level command if the vote would pass immediatly anyway. See gna patch #5181 Modified: branches/S2_4/server/stdinhand.c branches/S2_4/server/voting.c branches/S2_4/server/voting.h Modified: branches/S2_4/server/stdinhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/stdinhand.c?rev=26271r1=26270r2=26271view=diff == --- branches/S2_4/server/stdinhand.c(original) +++ branches/S2_4/server/stdinhand.cSun Sep 7 10:59:35 2014 @@ -4182,7 +4182,8 @@ level = command_level(command_by_number(cmd)); if (conn_can_vote(caller, NULL) level == ALLOW_CTRL - conn_get_access(caller) == ALLOW_BASIC !check) { + conn_get_access(caller) == ALLOW_BASIC !check + !vote_would_pass_immediately(caller, cmd)) { struct vote *vote; bool caller_had_vote = (NULL != get_vote_by_caller(caller)); @@ -4235,8 +4236,10 @@ } } - if (caller !(check conn_get_access(caller) = ALLOW_BASIC - level == ALLOW_CTRL) + if (caller + !((check || vote_would_pass_immediately(caller, cmd)) +conn_get_access(caller) = ALLOW_BASIC +level == ALLOW_CTRL) conn_get_access(caller) level) { cmd_reply(cmd, caller, C_FAIL, _(You are not allowed to use this command.)); Modified: branches/S2_4/server/voting.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/voting.c?rev=26271r1=26270r2=26271view=diff == --- branches/S2_4/server/voting.c (original) +++ branches/S2_4/server/voting.c Sun Sep 7 10:59:35 2014 @@ -382,6 +382,34 @@ lsend_vote_new(NULL, pvote); return pvote; +} + +/ + Return whether the vote would pass immediately when the caller will vote + for. +/ +bool vote_would_pass_immediately(const struct connection *caller, + int command_id) +{ + struct vote virtual_vote; + const struct command *pcmd; + + if (!conn_can_vote(caller, NULL)) { +return FALSE; + } + + pcmd = command_by_number(command_id); + fc_assert(pcmd != NULL); + memset(virtual_vote, 0, sizeof(virtual_vote)); + virtual_vote.flags = command_vote_flags(pcmd); + + if (virtual_vote.flags VCF_NOPASSALONE) { +return FALSE; + } + + virtual_vote.caller_id = caller-id; + return (((double) (command_vote_percent(pcmd) + * count_voters(virtual_vote)) / 100.0) 1.0); } /** Modified: branches/S2_4/server/voting.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/voting.h?rev=26271r1=26270r2=26271view=diff == --- branches/S2_4/server/voting.h (original) +++ branches/S2_4/server/voting.h Sun Sep 7 10:59:35 2014 @@ -87,6 +87,8 @@ struct vote *vote_new(struct connection *caller, const char *allargs, int command_id); +bool vote_would_pass_immediately(const struct connection *caller, + int command_id); const struct connection *vote_get_caller(const struct vote *pvote); bool vote_is_team_only(const struct vote *pvote); int describe_vote(struct vote *pvote, char *buf, int buflen); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26272 - in /branches/S2_5/server: stdinhand.c voting.c voting.h
Author: pepeto Date: Sun Sep 7 10:59:35 2014 New Revision: 26272 URL: http://svn.gna.org/viewcvs/freeciv?rev=26272view=rev Log: Do not make vote if the caller has basic access level and use a ctrl access level command if the vote would pass immediatly anyway. See gna patch #5181 Modified: branches/S2_5/server/stdinhand.c branches/S2_5/server/voting.c branches/S2_5/server/voting.h Modified: branches/S2_5/server/stdinhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/stdinhand.c?rev=26272r1=26271r2=26272view=diff == --- branches/S2_5/server/stdinhand.c(original) +++ branches/S2_5/server/stdinhand.cSun Sep 7 10:59:35 2014 @@ -4194,7 +4194,8 @@ level = command_level(command_by_number(cmd)); if (conn_can_vote(caller, NULL) level == ALLOW_CTRL - conn_get_access(caller) == ALLOW_BASIC !check) { + conn_get_access(caller) == ALLOW_BASIC !check + !vote_would_pass_immediately(caller, cmd)) { struct vote *vote; bool caller_had_vote = (NULL != get_vote_by_caller(caller)); @@ -4247,8 +4248,10 @@ } } - if (caller !(check conn_get_access(caller) = ALLOW_BASIC - level == ALLOW_CTRL) + if (caller + !((check || vote_would_pass_immediately(caller, cmd)) +conn_get_access(caller) = ALLOW_BASIC +level == ALLOW_CTRL) conn_get_access(caller) level) { cmd_reply(cmd, caller, C_FAIL, _(You are not allowed to use this command.)); Modified: branches/S2_5/server/voting.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/voting.c?rev=26272r1=26271r2=26272view=diff == --- branches/S2_5/server/voting.c (original) +++ branches/S2_5/server/voting.c Sun Sep 7 10:59:35 2014 @@ -382,6 +382,34 @@ lsend_vote_new(NULL, pvote); return pvote; +} + +/ + Return whether the vote would pass immediately when the caller will vote + for. +/ +bool vote_would_pass_immediately(const struct connection *caller, + int command_id) +{ + struct vote virtual_vote; + const struct command *pcmd; + + if (!conn_can_vote(caller, NULL)) { +return FALSE; + } + + pcmd = command_by_number(command_id); + fc_assert(pcmd != NULL); + memset(virtual_vote, 0, sizeof(virtual_vote)); + virtual_vote.flags = command_vote_flags(pcmd); + + if (virtual_vote.flags VCF_NOPASSALONE) { +return FALSE; + } + + virtual_vote.caller_id = caller-id; + return (((double) (command_vote_percent(pcmd) + * count_voters(virtual_vote)) / 100.0) 1.0); } /** Modified: branches/S2_5/server/voting.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/voting.h?rev=26272r1=26271r2=26272view=diff == --- branches/S2_5/server/voting.h (original) +++ branches/S2_5/server/voting.h Sun Sep 7 10:59:35 2014 @@ -87,6 +87,8 @@ struct vote *vote_new(struct connection *caller, const char *allargs, int command_id); +bool vote_would_pass_immediately(const struct connection *caller, + int command_id); const struct connection *vote_get_caller(const struct vote *pvote); bool vote_is_team_only(const struct vote *pvote); int describe_vote(struct vote *pvote, char *buf, int buflen); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26270 - in /trunk/server: stdinhand.c voting.c voting.h
Author: pepeto Date: Sun Sep 7 10:59:26 2014 New Revision: 26270 URL: http://svn.gna.org/viewcvs/freeciv?rev=26270view=rev Log: Do not make vote if the caller has basic access level and use a ctrl access level command if the vote would pass immediatly anyway. See gna patch #5181 Modified: trunk/server/stdinhand.c trunk/server/voting.c trunk/server/voting.h Modified: trunk/server/stdinhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/stdinhand.c?rev=26270r1=26269r2=26270view=diff == --- trunk/server/stdinhand.c(original) +++ trunk/server/stdinhand.cSun Sep 7 10:59:26 2014 @@ -4108,7 +4108,8 @@ level = command_level(command_by_number(cmd)); if (conn_can_vote(caller, NULL) level == ALLOW_CTRL - conn_get_access(caller) == ALLOW_BASIC !check) { + conn_get_access(caller) == ALLOW_BASIC !check + !vote_would_pass_immediately(caller, cmd)) { struct vote *vote; bool caller_had_vote = (NULL != get_vote_by_caller(caller)); @@ -4161,8 +4162,10 @@ } } - if (caller !(check conn_get_access(caller) = ALLOW_BASIC - level == ALLOW_CTRL) + if (caller + !((check || vote_would_pass_immediately(caller, cmd)) +conn_get_access(caller) = ALLOW_BASIC +level == ALLOW_CTRL) conn_get_access(caller) level) { cmd_reply(cmd, caller, C_FAIL, _(You are not allowed to use this command.)); Modified: trunk/server/voting.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/voting.c?rev=26270r1=26269r2=26270view=diff == --- trunk/server/voting.c (original) +++ trunk/server/voting.c Sun Sep 7 10:59:26 2014 @@ -382,6 +382,34 @@ lsend_vote_new(NULL, pvote); return pvote; +} + +/ + Return whether the vote would pass immediately when the caller will vote + for. +/ +bool vote_would_pass_immediately(const struct connection *caller, + int command_id) +{ + struct vote virtual_vote; + const struct command *pcmd; + + if (!conn_can_vote(caller, NULL)) { +return FALSE; + } + + pcmd = command_by_number(command_id); + fc_assert(pcmd != NULL); + memset(virtual_vote, 0, sizeof(virtual_vote)); + virtual_vote.flags = command_vote_flags(pcmd); + + if (virtual_vote.flags VCF_NOPASSALONE) { +return FALSE; + } + + virtual_vote.caller_id = caller-id; + return (((double) (command_vote_percent(pcmd) + * count_voters(virtual_vote)) / 100.0) 1.0); } /** Modified: trunk/server/voting.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/voting.h?rev=26270r1=26269r2=26270view=diff == --- trunk/server/voting.h (original) +++ trunk/server/voting.h Sun Sep 7 10:59:26 2014 @@ -87,6 +87,8 @@ struct vote *vote_new(struct connection *caller, const char *allargs, int command_id); +bool vote_would_pass_immediately(const struct connection *caller, + int command_id); const struct connection *vote_get_caller(const struct vote *pvote); bool vote_is_team_only(const struct vote *pvote); int describe_vote(struct vote *pvote, char *buf, int buflen); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26275 - /branches/S2_4/server/voting.h
Author: pepeto Date: Sun Sep 7 11:03:09 2014 New Revision: 26275 URL: http://svn.gna.org/viewcvs/freeciv?rev=26275view=rev Log: Remove function prototype for undefined 'send_running_team_votes()'. See gna patch #5182 Modified: branches/S2_4/server/voting.h Modified: branches/S2_4/server/voting.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/voting.h?rev=26275r1=26274r2=26275view=diff == --- branches/S2_4/server/voting.h (original) +++ branches/S2_4/server/voting.h Sun Sep 7 11:03:09 2014 @@ -93,7 +93,6 @@ bool vote_is_team_only(const struct vote *pvote); int describe_vote(struct vote *pvote, char *buf, int buflen); void send_running_votes(struct connection *pconn, bool only_team_votes); -void send_running_team_votes(struct connection *pconn); void send_remove_team_votes(struct connection *pconn); void send_updated_vote_totals(struct conn_list *dest); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26277 - /branches/S2_4/common/tech.c
Author: pepeto Date: Sun Sep 7 11:05:53 2014 New Revision: 26277 URL: http://svn.gna.org/viewcvs/freeciv?rev=26277view=rev Log: Remove error messages when connecting a server without tech_cost network capability. See gna patch #5185 Modified: branches/S2_4/common/tech.c Modified: branches/S2_4/common/tech.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_4/common/tech.c?rev=26277r1=26276r2=26277view=diff == --- branches/S2_4/common/tech.c (original) +++ branches/S2_4/common/tech.c Sun Sep 7 11:05:53 2014 @@ -668,7 +668,8 @@ int members; double base_cost, total_cost; - if (A_UNSET == tech) { + if (A_UNSET == tech + || A_UNKNOWN == tech) { return 0; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26276 - /branches/S2_5/common/tech.c
Author: pepeto Date: Sun Sep 7 11:05:49 2014 New Revision: 26276 URL: http://svn.gna.org/viewcvs/freeciv?rev=26276view=rev Log: Remove error messages when connecting a server without tech_cost network capability. See gna patch #5185 Modified: branches/S2_5/common/tech.c Modified: branches/S2_5/common/tech.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/tech.c?rev=26276r1=26275r2=26276view=diff == --- branches/S2_5/common/tech.c (original) +++ branches/S2_5/common/tech.c Sun Sep 7 11:05:49 2014 @@ -683,7 +683,8 @@ int members; double base_cost, total_cost; - if (A_UNSET == tech) { + if (A_UNSET == tech + || A_UNKNOWN == tech) { return 0; } ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26278 - in /trunk/client/gui-qt: fc_client.cpp fc_client.h mapctrl.cpp mapview.cpp mapview.h
Author: mir3x Date: Sun Sep 7 15:18:11 2014 New Revision: 26278 URL: http://svn.gna.org/viewcvs/freeciv?rev=26278view=rev Log: Added animated curosrs See patch #5169 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapctrl.cpp trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:18:11 2014 @@ -32,6 +32,7 @@ // gui-qt #include fc_client.h #include optiondlg.h +#include sprite.h extern QApplication *qapp; @@ -112,7 +113,7 @@ status_bar_label-setAlignment(Qt::AlignCenter); status_bar-addWidget(status_bar_label, 1); set_status_bar(_(Welcome to Freeciv)); - + create_cursors(); switch_page_mapper = new QSignalMapper; // PAGE_MAIN pages[PAGE_MAIN] = new QWidget(central_wdg); @@ -528,6 +529,26 @@ option_dialog_popup(_(Set server options), server_optset); } +void fc_client::create_cursors(void) +{ + enum cursor_type curs; + int cursor; + QPixmap *pix; + int hot_x, hot_y; + struct sprite *sprite; + int frame; + QCursor *c; + for (cursor = 0; cursor CURSOR_LAST; cursor++) { +for (frame = 0; frame NUM_CURSOR_FRAMES; frame++) { + curs = static_castcursor_type(cursor); + sprite = get_cursor_sprite(tileset, curs, hot_x, hot_y, frame); + pix = sprite-pm; + c = new QCursor(*pix, hot_x, hot_y); + fc_cursors[cursor][frame] = c; +} + } +} + / Returns desired font / Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sun Sep 7 15:18:11 2014 @@ -182,6 +182,7 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); void remove_repo_dlg(QString str); @@ -236,6 +237,7 @@ const struct server_list *); bool check_server_scan (server_scan*); void update_load_page(void); + void create_cursors(void); void update_scenarios_page(void); void set_connection_state(enum connection_state state); void handle_authentication_req( Modified: trunk/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/mapctrl.cpp (original) +++ trunk/client/gui-qt/mapctrl.cpp Sun Sep 7 15:18:11 2014 @@ -94,7 +94,7 @@ **/ void update_rect_at_mouse_pos(void) { - /* PORTME */ + /* PLS DONT PORT IT */ } /** @@ -196,6 +196,9 @@ if (event-button() == Qt::MiddleButton) { gui()-popdown_tile_info(); } + if (event-button() == Qt::LeftButton) { +release_goto_button(event-x(), event-y()); + } } /** @@ -204,6 +207,8 @@ void map_view::mouseMoveEvent(QMouseEvent *event) { update_line(event-pos().x(), event-pos().y()); + control_mouse_cursor(canvas_pos_to_tile(event-pos().x(), + event-pos().y())); } /** Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26278r1=26277r2=26278view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:18:11 2014 @@ -97,7 +97,67 @@ **/ map_view::map_view() : QWidget() { + cursor = -1; + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_event())); + timer-start(200); setMouseTracking(true); +} + +/** + Updates cursor +**/ +void map_view::update_cursor(enum cursor_type ct) +{ + int i; + + if (ct == CURSOR_DEFAULT) { +
[Freeciv-commits] r26279 - in /branches/S2_5/client/gui-qt: fc_client.cpp fc_client.h mapctrl.cpp mapview.cpp mapview.h
Author: mir3x Date: Sun Sep 7 15:18:22 2014 New Revision: 26279 URL: http://svn.gna.org/viewcvs/freeciv?rev=26279view=rev Log: Added animated curosrs See patch #5169 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/mapctrl.cpp branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/mapview.h Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:18:22 2014 @@ -32,6 +32,7 @@ // gui-qt #include fc_client.h #include optiondlg.h +#include sprite.h extern QApplication *qapp; @@ -117,7 +118,7 @@ status_bar_label-setAlignment(Qt::AlignCenter); status_bar-addWidget(status_bar_label, 1); set_status_bar(_(Welcome to Freeciv)); - + create_cursors(); switch_page_mapper = new QSignalMapper; // PAGE_MAIN pages[PAGE_MAIN] = new QWidget(central_wdg); @@ -533,6 +534,26 @@ option_dialog_popup(_(Set server options), server_optset); } +void fc_client::create_cursors(void) +{ + enum cursor_type curs; + int cursor; + QPixmap *pix; + int hot_x, hot_y; + struct sprite *sprite; + int frame; + QCursor *c; + for (cursor = 0; cursor CURSOR_LAST; cursor++) { +for (frame = 0; frame NUM_CURSOR_FRAMES; frame++) { + curs = static_castcursor_type(cursor); + sprite = get_cursor_sprite(tileset, curs, hot_x, hot_y, frame); + pix = sprite-pm; + c = new QCursor(*pix, hot_x, hot_y); + fc_cursors[cursor][frame] = c; +} + } +} + / Returns desired font / Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sun Sep 7 15:18:22 2014 @@ -186,6 +186,7 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); void remove_repo_dlg(QString str); @@ -240,6 +241,7 @@ const struct server_list *); bool check_server_scan (server_scan*); void update_load_page(void); + void create_cursors(void); void update_scenarios_page(void); void set_connection_state(enum connection_state state); void handle_authentication_req( Modified: branches/S2_5/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapctrl.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/mapctrl.cpp (original) +++ branches/S2_5/client/gui-qt/mapctrl.cpp Sun Sep 7 15:18:22 2014 @@ -94,7 +94,7 @@ **/ void update_rect_at_mouse_pos(void) { - /* PORTME */ + /* PLS DONT PORT IT */ } /** @@ -196,6 +196,9 @@ if (event-button() == Qt::MiddleButton) { gui()-popdown_tile_info(); } + if (event-button() == Qt::LeftButton) { +release_goto_button(event-x(), event-y()); + } } /** @@ -204,6 +207,8 @@ void map_view::mouseMoveEvent(QMouseEvent *event) { update_line(event-pos().x(), event-pos().y()); + control_mouse_cursor(canvas_pos_to_tile(event-pos().x(), + event-pos().y())); } /** Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26279r1=26278r2=26279view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Sun Sep 7 15:18:22 2014 @@ -96,7 +96,67 @@ **/ map_view::map_view() : QWidget() { + cursor = -1; + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_event())); + timer-start(200); setMouseTracking(true); +} + +/** + Updates cursor
[Freeciv-commits] r26280 - /trunk/client/gui-qt/dialogs.cpp
Author: sveinung Date: Sun Sep 7 15:21:56 2014 New Revision: 26280 URL: http://svn.gna.org/viewcvs/freeciv?rev=26280view=rev Log: Qt client: Add information to the action selection dialog text. If there is a target city add its name. If there is a target city and the actor unit has a home city add the name of the home city too. The home city name will become quite useful when the action dialog takes over trade route establishing. See patch #5184 Modified: trunk/client/gui-qt/dialogs.cpp Modified: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=26280r1=26279r2=26280view=diff == --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Sun Sep 7 15:21:56 2014 @@ -1084,6 +1084,7 @@ int diplomat_id; QVariant qv1, qv2; pfcn_void func; + struct city *actor_homecity; /* Could be caused by the server failing to reply to a request for more * information or a bug in the client code. */ @@ -1093,13 +1094,30 @@ /* No extra input is required as no action has been chosen yet. */ is_more_user_input_needed = FALSE; + actor_homecity = game_city_by_number(punit-homecity); + astr_set(title, /* TRANS: %s is a unit name, e.g., Spy */ _(Choose Your %s's Strategy), unit_name_translation(punit)); - astr_set(text, - /* TRANS: %s is a unit name, e.g., Diplomat, Spy */ - _(Your %s is waiting for your command.), - unit_name_translation(punit)); + + if (pcity actor_homecity) { +astr_set(text, + _(Your %s from %s reaches the city of %s.\nWhat now?), + unit_name_translation(punit), + city_name(actor_homecity), + city_name(pcity)); + } else if (pcity) { +astr_set(text, + _(Your %s has arrived at %s.\nWhat is your command?), + unit_name_translation(punit), + city_name(pcity)); + } else { +astr_set(text, + /* TRANS: %s is a unit name, e.g., Diplomat, Spy */ + _(Your %s is waiting for your command.), + unit_name_translation(punit)); + } + choice_dialog *cd = new choice_dialog(astr_str(title), astr_str(text), gui()-game_tab_widget, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26281 - in /trunk/client/gui-qt: fc_client.cpp pages.cpp
Author: mir3x Date: Sun Sep 7 15:22:14 2014 New Revision: 26281 URL: http://svn.gna.org/viewcvs/freeciv?rev=26281view=rev Log: Removed margins around map view See patch #5170 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/pages.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26281r1=26280r2=26281view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:22:14 2014 @@ -102,6 +102,7 @@ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; + central_layout-setContentsMargins(2, 2, 2, 2); // General part not related to any single page fc_fonts.init_fonts(); Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26281r1=26280r2=26281view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sun Sep 7 15:22:14 2014 @@ -578,6 +578,8 @@ game_main_widget = new QWidget; game_layout = new QGridLayout; game_tab_widget = new fc_game_tab_widget; + game_layout-setContentsMargins(0, 0, 0, 0); + game_layout-setSpacing(0); game_tab_widget-setTabPosition(QTabWidget::South); game_tab_widget-setDocumentMode(false); mapview_wdg = new map_view(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26282 - in /branches/S2_5/client/gui-qt: fc_client.cpp pages.cpp
Author: mir3x Date: Sun Sep 7 15:22:25 2014 New Revision: 26282 URL: http://svn.gna.org/viewcvs/freeciv?rev=26282view=rev Log: Removed margins around map view See patch #5170 Modified: branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/pages.cpp Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26282r1=26281r2=26282view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:22:25 2014 @@ -107,6 +107,7 @@ main_window = new QMainWindow; central_wdg = new QWidget; central_layout = new QGridLayout; + central_layout-setContentsMargins(2, 2, 2, 2); // General part not related to any single page fc_fonts.init_fonts(); Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26282r1=26281r2=26282view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sun Sep 7 15:22:25 2014 @@ -578,6 +578,8 @@ game_main_widget = new QWidget; game_layout = new QGridLayout; game_tab_widget = new fc_game_tab_widget; + game_layout-setContentsMargins(0, 0, 0, 0); + game_layout-setSpacing(0); game_tab_widget-setTabPosition(QTabWidget::South); game_tab_widget-setDocumentMode(false); mapview_wdg = new map_view(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26283 - /trunk/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Sun Sep 7 15:25:02 2014 New Revision: 26283 URL: http://svn.gna.org/viewcvs/freeciv?rev=26283view=rev Log: Added future tech handling See patch #5171 Modified: trunk/client/gui-qt/repodlgs.cpp Modified: trunk/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=26283r1=26282r2=26283view=diff == --- trunk/client/gui-qt/repodlgs.cpp(original) +++ trunk/client/gui-qt/repodlgs.cppSun Sep 7 15:25:02 2014 @@ -307,9 +307,10 @@ /** set current tech and goal */ qres = research-researching; - - if (qres == A_UNSET) { -researching_combo-insertItem(0, _(None), A_UNSET); + if (qres == A_UNSET || is_future_tech(research-researching)) { +researching_combo-insertItem(0, research_advance_name_translation( + research, research-researching ), + A_UNSET); researching_combo-setCurrentIndex(0); } else { for (int i = 0; i researching_combo-count(); i++) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26284 - /branches/S2_5/client/gui-qt/repodlgs.cpp
Author: mir3x Date: Sun Sep 7 15:25:12 2014 New Revision: 26284 URL: http://svn.gna.org/viewcvs/freeciv?rev=26284view=rev Log: Added future tech handling See patch #5171 Modified: branches/S2_5/client/gui-qt/repodlgs.cpp Modified: branches/S2_5/client/gui-qt/repodlgs.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=26284r1=26283r2=26284view=diff == --- branches/S2_5/client/gui-qt/repodlgs.cpp(original) +++ branches/S2_5/client/gui-qt/repodlgs.cppSun Sep 7 15:25:12 2014 @@ -307,9 +307,10 @@ /** set current tech and goal */ qres = research-researching; - - if (qres == A_UNSET) { -researching_combo-insertItem(0, _(None), A_UNSET); + if (qres == A_UNSET || is_future_tech(research-researching)) { +researching_combo-insertItem(0, research_advance_name_translation( + research, research-researching ), + A_UNSET); researching_combo-setCurrentIndex(0); } else { for (int i = 0; i researching_combo-count(); i++) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r26285 - /branches/S2_5/client/gui-qt/
Author: mir3x Date: Sun Sep 7 15:41:48 2014 New Revision: 26285 URL: http://svn.gna.org/viewcvs/freeciv?rev=26285view=rev Log: added vote bar See patch #5163 Modified: branches/S2_5/client/gui-qt/Makefile.am branches/S2_5/client/gui-qt/fc_client.cpp branches/S2_5/client/gui-qt/fc_client.h branches/S2_5/client/gui-qt/mapview.cpp branches/S2_5/client/gui-qt/pages.cpp branches/S2_5/client/gui-qt/voteinfo_bar.cpp branches/S2_5/client/gui-qt/voteinfo_bar.h Modified: branches/S2_5/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/Makefile.am?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/Makefile.am (original) +++ branches/S2_5/client/gui-qt/Makefile.am Sun Sep 7 15:41:48 2014 @@ -28,7 +28,8 @@ meta_spaceshipdlg.cpp \ meta_messagewin.cpp \ meta_chatline.cpp \ - meta_messagedlg.cpp + meta_messagedlg.cpp \ + meta_voteinfo_bar.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: branches/S2_5/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/fc_client.cpp (original) +++ branches/S2_5/client/gui-qt/fc_client.cpp Sun Sep 7 15:41:48 2014 @@ -95,6 +95,8 @@ current_file = ; status_bar_queue.clear(); quitting = false; + pre_vote = NULL; + x_vote = NULL; for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; @@ -275,6 +277,8 @@ case PAGE_MAIN: break; case PAGE_START: +pre_vote-hide(); +voteinfo_gui_update(); break; case PAGE_LOAD: update_load_page(); @@ -289,6 +293,7 @@ main_window-menuBar()-setVisible(true); mapview_wdg-setFocus(); center_on_something(); +voteinfo_gui_update(); break; case PAGE_SCENARIO: update_scenarios_page(); Modified: branches/S2_5/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/fc_client.h (original) +++ branches/S2_5/client/gui-qt/fc_client.h Sun Sep 7 15:41:48 2014 @@ -54,6 +54,7 @@ #include menu.h #include pages.h #include ratesdlg.h +#include voteinfo_bar.h enum connection_state { LOGIN_TYPE, @@ -186,6 +187,8 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + pregamevote *pre_vote; + xvote *x_vote; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Sun Sep 7 15:41:48 2014 @@ -282,9 +282,10 @@ gui()-infotab-move(0 , size.height() - gui()-infotab-height()); gui()-unitinfo_wdg-move(width() - gui()-unitinfo_wdg-width(), 0); gui()-game_info_label-move(size.width() - -gui()-game_info_label-width(), + -gui()-game_info_label-width(), size.height() -gui()-game_info_label-height()); +gui()-x_vote-move(width() / 2 - gui()-x_vote-width() / 2, 0); } } Modified: branches/S2_5/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/pages.cpp?rev=26285r1=26284r2=26285view=diff == --- branches/S2_5/client/gui-qt/pages.cpp (original) +++ branches/S2_5/client/gui-qt/pages.cpp Sun Sep 7 15:41:48 2014 @@ -37,6 +37,7 @@ #include dialogs.h #include pages.h #include sprite.h +#include voteinfo_bar.h static struct server_scan *meta_scan, *lan_scan; static bool holding_srv_list_mutex = false; @@ -560,9 +561,11 @@ pages_layout[PAGE_START]-addWidget(but, 5, 7); QObject::connect(but, SIGNAL(clicked()), this, SLOT(slot_pregame_start())); - + pre_vote = new pregamevote; + + pages_layout[PAGE_START]-addWidget(pre_vote, 4, 0, 1, 4); pages_layout[PAGE_START]-addWidget(chat_line, 5, 0, 1, 3); - pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 2, 8); + pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 1, 8); connect(chat_line, SIGNAL(returnPressed()), this, SLOT(chat())); } @@ -592,6 +595,8 @@ game_info_label-show();
[Freeciv-commits] r26286 - in /trunk/client/gui-qt: Makefile.am fc_client.cpp fc_client.h mapview.cpp pages.cpp voteinfo_bar.cpp voteinfo_bar.h
Author: mir3x Date: Sun Sep 7 15:41:59 2014 New Revision: 26286 URL: http://svn.gna.org/viewcvs/freeciv?rev=26286view=rev Log: added vote bar See patch #5163 Modified: trunk/client/gui-qt/Makefile.am trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/pages.cpp trunk/client/gui-qt/voteinfo_bar.cpp trunk/client/gui-qt/voteinfo_bar.h Modified: trunk/client/gui-qt/Makefile.am URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/Makefile.am?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/Makefile.am (original) +++ trunk/client/gui-qt/Makefile.am Sun Sep 7 15:41:59 2014 @@ -28,7 +28,8 @@ meta_spaceshipdlg.cpp \ meta_messagewin.cpp \ meta_chatline.cpp \ - meta_messagedlg.cpp + meta_messagedlg.cpp \ + meta_voteinfo_bar.cpp libgui_qt_la_SOURCES = \ canvas.cpp \ Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Sun Sep 7 15:41:59 2014 @@ -90,6 +90,8 @@ current_file = ; status_bar_queue.clear(); quitting = false; + pre_vote = NULL; + x_vote = NULL; for (int i = 0; i = PAGE_GGZ; i++) { pages_layout[i] = NULL; pages[i] = NULL; @@ -270,6 +272,8 @@ case PAGE_MAIN: break; case PAGE_START: +pre_vote-hide(); +voteinfo_gui_update(); break; case PAGE_LOAD: update_load_page(); @@ -284,6 +288,7 @@ main_window-menuBar()-setVisible(true); mapview_wdg-setFocus(); center_on_something(); +voteinfo_gui_update(); break; case PAGE_SCENARIO: update_scenarios_page(); Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Sun Sep 7 15:41:59 2014 @@ -54,6 +54,7 @@ #include menu.h #include pages.h #include ratesdlg.h +#include voteinfo_bar.h enum connection_state { LOGIN_TYPE, @@ -182,6 +183,8 @@ fc_game_tab_widget *game_tab_widget; messagewdg *msgwdg; info_tab *infotab; + pregamevote *pre_vote; + xvote *x_vote; QCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]; void gimme_place(QWidget* widget, QString str); int gimme_index_of(QString str); Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:41:59 2014 @@ -283,9 +283,10 @@ gui()-infotab-move(0 , size.height() - gui()-infotab-height()); gui()-unitinfo_wdg-move(width() - gui()-unitinfo_wdg-width(), 0); gui()-game_info_label-move(size.width() - -gui()-game_info_label-width(), + -gui()-game_info_label-width(), size.height() -gui()-game_info_label-height()); +gui()-x_vote-move(width() / 2 - gui()-x_vote-width() / 2, 0); } } Modified: trunk/client/gui-qt/pages.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/pages.cpp?rev=26286r1=26285r2=26286view=diff == --- trunk/client/gui-qt/pages.cpp (original) +++ trunk/client/gui-qt/pages.cpp Sun Sep 7 15:41:59 2014 @@ -37,6 +37,7 @@ #include dialogs.h #include pages.h #include sprite.h +#include voteinfo_bar.h static struct server_scan *meta_scan, *lan_scan; static bool holding_srv_list_mutex = false; @@ -560,9 +561,11 @@ pages_layout[PAGE_START]-addWidget(but, 5, 7); QObject::connect(but, SIGNAL(clicked()), this, SLOT(slot_pregame_start())); - + pre_vote = new pregamevote; + + pages_layout[PAGE_START]-addWidget(pre_vote, 4, 0, 1, 4); pages_layout[PAGE_START]-addWidget(chat_line, 5, 0, 1, 3); - pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 2, 8); + pages_layout[PAGE_START]-addWidget(output_window, 3, 0, 1, 8); connect(chat_line, SIGNAL(returnPressed()), this, SLOT(chat())); } @@ -592,6 +595,8 @@ game_info_label-show(); infotab = new info_tab(mapview_wdg); infotab-show(); + x_vote = new xvote(mapview_wdg); + x_vote-hide(); game_layout-addWidget(mapview_wdg, 1, 0); game_main_widget-setLayout(game_layout); Modified:
[Freeciv-commits] r26287 - /trunk/client/gui-qt/mapview.cpp
Author: mir3x Date: Sun Sep 7 15:44:54 2014 New Revision: 26287 URL: http://svn.gna.org/viewcvs/freeciv?rev=26287view=rev Log: If gold income was negative it was shown as +-X, instead just -X. See patch #5172 Modified: trunk/client/gui-qt/mapview.cpp Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=26287r1=26286r2=26287view=diff == --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Sun Sep 7 15:44:54 2014 @@ -1180,15 +1180,21 @@ { QString eco_info; QString s = QString(_(%1 (Turn:%2))).arg(textyear(game.info.year), - QString::number(game.info.turn)); + QString::number(game.info.turn)); gui()-game_info_label-set_turn_info(s); set_indicator_icons(client_research_sprite(), client_warming_sprite(), client_cooling_sprite(), client_government_sprite()); if (client.conn.playing != NULL) { -eco_info = QString(_(Gold:%1 (+%2))) - .arg(QString::number(client.conn.playing-economic.gold), +if (player_get_expected_income(client.conn.playing) 0) { + eco_info = QString(_(Gold:%1 (+%2))) + .arg(QString::number(client.conn.playing-economic.gold), QString::number(player_get_expected_income(client.conn.playing))); +} else { + eco_info = QString(_(Gold:%1 (%2))) + .arg(QString::number(client.conn.playing-economic.gold), + QString::number(player_get_expected_income(client.conn.playing))); +} gui()-game_info_label-set_eco_info(eco_info); } gui()-game_info_label-set_rates_pixmap(); ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits