[Freeciv-commits] r28836 - in /trunk/common: dataio.h dataio_json.c dataio_json.h generate_packets.py packets_json.h
Author: sveinung Date: Tue Apr 21 16:56:24 2015 New Revision: 28836 URL: http://svn.gna.org/viewcvs/freeciv?rev=28836view=rev Log: JSON protocol: location in packet as parameter to the dio_* functions. Take the address of the exact location in the packet to write to / read from as a parameter in the dio_* functions for the JSON protocol. This is required so an element of a field array can be placed inside the array and not after it. This is only the API change, isolated so it won't be bug hiding noise. See patch #6017 Modified: trunk/common/dataio.h trunk/common/dataio_json.c trunk/common/dataio_json.h trunk/common/generate_packets.py trunk/common/packets_json.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/common/dataio.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio.h?rev=28836r1=28835r2=28836view=diff Modified: trunk/common/dataio_json.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio_json.c?rev=28836r1=28835r2=28836view=diff Modified: trunk/common/dataio_json.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/dataio_json.h?rev=28836r1=28835r2=28836view=diff Modified: trunk/common/generate_packets.py URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/generate_packets.py?rev=28836r1=28835r2=28836view=diff Modified: trunk/common/packets_json.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/packets_json.h?rev=28836r1=28835r2=28836view=diff ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r28833 - /trunk/client/plrdlg_common.c
Author: sveinung Date: Tue Apr 21 15:45:05 2015 New Revision: 28833 URL: http://svn.gna.org/viewcvs/freeciv?rev=28833view=rev Log: Sort by state kind when sorting the nations tab by diplomatic state. Where in the alphabet the name of a diplomatic state appears doesn't say all that much about it. Sort by how close a state is in stead. Reported anonymously Patch by Hauke Henningsen addaleax See bug #23420 Modified: trunk/client/plrdlg_common.c Modified: trunk/client/plrdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/plrdlg_common.c?rev=28833r1=28832r2=28833view=diff == --- trunk/client/plrdlg_common.c(original) +++ trunk/client/plrdlg_common.cTue Apr 21 15:45:05 2015 @@ -118,6 +118,54 @@ return diplstate_type_translated_name(pds-type); } } +} + +/** + Return a numerical value suitable for ordering players by + their diplomatic status in the players dialog + + A lower value stands for more friendly diplomatic status. +***/ +static int diplstate_value(const struct player *plr) +{ + /* these values are scaled so that adding/subtracting + the number of turns left makes sense */ + static const int diplstate_cmp_lookup[DS_LAST] = { +[DS_TEAM] = 1 16, +[DS_ALLIANCE] = 2 16, +[DS_PEACE] = 3 16, +[DS_ARMISTICE] = 4 16, +[DS_CEASEFIRE] = 5 16, +[DS_WAR] = 6 16, +[DS_NO_CONTACT] = 7 16 + }; + + const struct player_diplstate *pds; + int ds_value; + + if (NULL == client.conn.playing || plr == client.conn.playing) { +/* current global player is as close as players get + - return value smaller than for DS_TEAM */ +return 0; + } + + pds = player_diplstate_get(client.conn.playing, plr); + ds_value = diplstate_cmp_lookup[pds-type]; + + if (pds-type == DS_ARMISTICE || pds-type == DS_CEASEFIRE) { +ds_value += pds-turns_left; + } + + return ds_value; +} + +/** + Compares diplomatic status of two players in players dialog +***/ +static int cmp_diplstate(const struct player *player1, + const struct player *player2) +{ + return diplstate_value(player1) - diplstate_value(player2); } /** @@ -264,7 +312,8 @@ {TRUE, COL_BOOLEAN, N_(AI), NULL, col_ai, NULL, ai}, {TRUE, COL_TEXT, N_(Attitude), col_love, NULL, cmp_love, attitude}, {TRUE, COL_TEXT, N_(Embassy), col_embassy, NULL, NULL, embassy}, - {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, NULL, diplstate}, + {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, cmp_diplstate, +diplstate}, {TRUE, COL_TEXT, N_(Vision), col_vision, NULL, NULL, vision}, {TRUE, COL_TEXT, N_(State), plrdlg_col_state, NULL, NULL, state}, {FALSE, COL_TEXT, N_(?Player_dlg:Host), col_host, NULL, NULL, host}, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r28834 - /branches/S2_6/client/plrdlg_common.c
Author: sveinung Date: Tue Apr 21 16:35:45 2015 New Revision: 28834 URL: http://svn.gna.org/viewcvs/freeciv?rev=28834view=rev Log: Sort by state kind when sorting the nations tab by diplomatic state. Where in the alphabet the name of a diplomatic state appears doesn't say all that much about it. Sort by how close a state is in stead. Reported anonymously Patch by Hauke Henningsen addaleax See bug #23420 Modified: branches/S2_6/client/plrdlg_common.c Modified: branches/S2_6/client/plrdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/plrdlg_common.c?rev=28834r1=28833r2=28834view=diff == --- branches/S2_6/client/plrdlg_common.c(original) +++ branches/S2_6/client/plrdlg_common.cTue Apr 21 16:35:45 2015 @@ -118,6 +118,54 @@ return diplstate_type_translated_name(pds-type); } } +} + +/** + Return a numerical value suitable for ordering players by + their diplomatic status in the players dialog + + A lower value stands for more friendly diplomatic status. +***/ +static int diplstate_value(const struct player *plr) +{ + /* these values are scaled so that adding/subtracting + the number of turns left makes sense */ + static const int diplstate_cmp_lookup[DS_LAST] = { +[DS_TEAM] = 1 16, +[DS_ALLIANCE] = 2 16, +[DS_PEACE] = 3 16, +[DS_ARMISTICE] = 4 16, +[DS_CEASEFIRE] = 5 16, +[DS_WAR] = 6 16, +[DS_NO_CONTACT] = 7 16 + }; + + const struct player_diplstate *pds; + int ds_value; + + if (NULL == client.conn.playing || plr == client.conn.playing) { +/* current global player is as close as players get + - return value smaller than for DS_TEAM */ +return 0; + } + + pds = player_diplstate_get(client.conn.playing, plr); + ds_value = diplstate_cmp_lookup[pds-type]; + + if (pds-type == DS_ARMISTICE || pds-type == DS_CEASEFIRE) { +ds_value += pds-turns_left; + } + + return ds_value; +} + +/** + Compares diplomatic status of two players in players dialog +***/ +static int cmp_diplstate(const struct player *player1, + const struct player *player2) +{ + return diplstate_value(player1) - diplstate_value(player2); } /** @@ -264,7 +312,8 @@ {TRUE, COL_BOOLEAN, N_(AI), NULL, col_ai, NULL, ai}, {TRUE, COL_TEXT, N_(Attitude), col_love, NULL, cmp_love, attitude}, {TRUE, COL_TEXT, N_(Embassy), col_embassy, NULL, NULL, embassy}, - {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, NULL, diplstate}, + {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, cmp_diplstate, +diplstate}, {TRUE, COL_TEXT, N_(Vision), col_vision, NULL, NULL, vision}, {TRUE, COL_TEXT, N_(State), plrdlg_col_state, NULL, NULL, state}, {FALSE, COL_TEXT, N_(?Player_dlg:Host), col_host, NULL, NULL, host}, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r28835 - /branches/S2_5/client/plrdlg_common.c
Author: sveinung Date: Tue Apr 21 16:36:52 2015 New Revision: 28835 URL: http://svn.gna.org/viewcvs/freeciv?rev=28835view=rev Log: Sort by state kind when sorting the nations tab by diplomatic state. Where in the alphabet the name of a diplomatic state appears doesn't say all that much about it. Sort by how close a state is in stead. Reported anonymously Patch by Hauke Henningsen addaleax See bug #23420 Modified: branches/S2_5/client/plrdlg_common.c Modified: branches/S2_5/client/plrdlg_common.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/plrdlg_common.c?rev=28835r1=28834r2=28835view=diff == --- branches/S2_5/client/plrdlg_common.c(original) +++ branches/S2_5/client/plrdlg_common.cTue Apr 21 16:36:52 2015 @@ -117,6 +117,54 @@ return diplstate_text(pds-type); } } +} + +/** + Return a numerical value suitable for ordering players by + their diplomatic status in the players dialog + + A lower value stands for more friendly diplomatic status. +***/ +static int diplstate_value(const struct player *plr) +{ + /* these values are scaled so that adding/subtracting + the number of turns left makes sense */ + static const int diplstate_cmp_lookup[DS_LAST] = { +[DS_TEAM] = 1 16, +[DS_ALLIANCE] = 2 16, +[DS_PEACE] = 3 16, +[DS_ARMISTICE] = 4 16, +[DS_CEASEFIRE] = 5 16, +[DS_WAR] = 6 16, +[DS_NO_CONTACT] = 7 16 + }; + + const struct player_diplstate *pds; + int ds_value; + + if (NULL == client.conn.playing || plr == client.conn.playing) { +/* current global player is as close as players get + - return value smaller than for DS_TEAM */ +return 0; + } + + pds = player_diplstate_get(client.conn.playing, plr); + ds_value = diplstate_cmp_lookup[pds-type]; + + if (pds-type == DS_ARMISTICE || pds-type == DS_CEASEFIRE) { +ds_value += pds-turns_left; + } + + return ds_value; +} + +/** + Compares diplomatic status of two players in players dialog +***/ +static int cmp_diplstate(const struct player *player1, + const struct player *player2) +{ + return diplstate_value(player1) - diplstate_value(player2); } /** @@ -263,7 +311,8 @@ {TRUE, COL_BOOLEAN, N_(AI), NULL, col_ai, NULL, ai}, {TRUE, COL_TEXT, N_(Attitude), col_love, NULL, cmp_love, attitude}, {TRUE, COL_TEXT, N_(Embassy), col_embassy, NULL, NULL, embassy}, - {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, NULL, diplstate}, + {TRUE, COL_TEXT, N_(Dipl.State), col_diplstate, NULL, cmp_diplstate, +diplstate}, {TRUE, COL_TEXT, N_(Vision), col_vision, NULL, NULL, vision}, {TRUE, COL_TEXT, N_(State), plrdlg_col_state, NULL, NULL, state}, {FALSE, COL_TEXT, N_(?Player_dlg:Host), col_host, NULL, NULL, host}, ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r28837 - in /trunk: configure.ac doc/README.packaging
Author: cazfi Date: Tue Apr 21 18:04:00 2015 New Revision: 28837 URL: http://svn.gna.org/viewcvs/freeciv?rev=28837view=rev Log: Configure check for libicu, link against it. See patch #3838 Modified: trunk/configure.ac trunk/doc/README.packaging Modified: trunk/configure.ac URL: http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=28837r1=28836r2=28837view=diff == --- trunk/configure.ac (original) +++ trunk/configure.ac Tue Apr 21 18:04:00 2015 @@ -564,6 +564,11 @@ UTILITY_LIBS=${UTILITY_LIBS} ${LIBXML2_LIBS} AC_DEFINE([HAVE_XML_REGISTRY], [1], [Build xml-backend for registry]) fi + +PKG_CHECK_MODULES([ICU], [icu-uc],, +[AC_MSG_ERROR([icu development files required])]) +UTILITY_CFLAGS=${UTILITY_CFLAGS} ${ICU_CFLAGS} +UTILITY_LIBS=${UTILITY_LIBS} ${ICU_LIBS} dnl Set debug flags supported by compiler EXTRA_DEBUG_CFLAGS= Modified: trunk/doc/README.packaging URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.packaging?rev=28837r1=28836r2=28837view=diff == --- trunk/doc/README.packaging (original) +++ trunk/doc/README.packaging Tue Apr 21 18:04:00 2015 @@ -20,6 +20,7 @@ * Minimum autoconf version is now 2.62, automake 1.11 * Tinycthreads can be used as threading implementation. Copy of tinycthreads can be compiled in to freeciv by configuring with --with-tinycthread. +* libicu is a new hard requirement -- Compatibility of modified versions ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits