[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
URL: http://gna.org/bugs/?18086 Summary: comparison is always false due to limited range of data type Project: Freeciv Submitted by: akfaew Submitted on: Sat 30 Apr 2011 08:30:27 AM GMT Category: None Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: Discussion Lock: Any Operating System: None Planned Release: ___ Details: typedef.*citizens found in ../common/fc_types.h: 107: typedef unsigned char citizens; cityturn.c:696: warning: comparison is always false due to limited range of data type cityturn.c:699: warning: comparison is always false due to limited range of data type cityturn.c:829: warning: comparison is always true due to limited range of data type cityturn.c:829: warning: comparison is always true due to limited range of data type Indeed: 692 void city_repair_size(struct city *pcity, citizens change) 693 { 694 if (change 0) { 695 pcity-specialists[DEFAULT_SPECIALIST] += change; 696 } else if (change 0) { ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
Follow-up Comment #1, bug #18086 (project freeciv): This is a bug! I'm woundering why you get an error message and I never did see it? Do you use special compiler options or the default ones for debug? Which gcc / distribution do you use? Some background: I had citizens equal to short int but changed it to unsigned char to save RAM. This should be no problem as the number of citizens can't be negative. For a change in the number, the corresponding argument is positive or negative. Thus it must be another data type. Could you check the handling in the function to change the city size? I think, there I do such an cast. Similar code would be needed here. ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18081] warning: null format string
Follow-up Comment #1, bug #18081 (project freeciv): Could you check how many of such calls exists (with NULL for message). I think it would be best, if these calls are corrected. You never know if similar checks will not be included in gcc for linux ... ___ Reply to this item at: http://gna.org/bugs/?18081 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18081] warning: null format string
Follow-up Comment #2, bug #18081 (project freeciv): How many such calls? Hundereds. Maybe the __printf__ assertion can be moved to a lower level and the fc_assert defines should include a test: fmt == NULL ? : fmt or something instead. ___ Reply to this item at: http://gna.org/bugs/?18081 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
Follow-up Comment #2, bug #18086 (project freeciv): Standard compile with --disable-nls. I don't use debug since warnings are treated as errors and I get hundereds of warnings from those NULLS in printfs. [12:11:pts/10][dude@hopek:~:74] gcc --version gcc (GCC) 4.2.1 20070719 [FreeBSD] Copyright (C) 2007 Free Software Foundation, Inc. [12:11:pts/10][dude@hopek:~:75] uname -a FreeBSD hopek.jasminek.net 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 r...@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18081] warning: null format string
Follow-up Comment #3, bug #18081 (project freeciv): This is just terrible, if I change NULL to I get: warning: zero-length printf format string I propose, in fc_assert_fail and similar change if (NULL != message) { into if (NOMSG != message) { where NOMSG is some define, like (void*)0x1. After that all calls with NULL will be change to NOMSG or EMPTYSTR or whatever. ___ Reply to this item at: http://gna.org/bugs/?18081 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
Follow-up Comment #3, bug #18086 (project freeciv): 692 void city_repair_size(struct city *pcity, citizens change) I think error is in that change is of type citizens in the first place. I would try to change it to int. ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18081] warning: null format string
Follow-up Comment #4, bug #18081 (project freeciv): Check out attached patch (file #12929) ___ Additional Item Attachment: File name: noprintfassertfail.diffSize:1 KB ___ Reply to this item at: http://gna.org/bugs/?18081 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
Follow-up Comment #4, bug #18086 (project freeciv): 692 void city_repair_size(struct city *pcity, citizens change) I think error is in that change is of type citizens in the first place. I would try to change it to int. Yes; I think this is that I have done for the function citizens_add() and city_size_add() (I'm not sure about the names). ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Nachricht geschickt von/durch Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #3, bug #18085 (project freeciv): Maybe enable construction bridge over the lake terrain is solution, but only one tile over the lake. Nothing two tiles or crosswise / diagonally. Example: ''p+p'' = plain - lake - plain ''rbr'' = road - bridge - road Enable = north/south - east/west Not Enable = northwest/southeast - northeast/southwest ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Messaggio inviato con/da Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #4, bug #18085 (project freeciv): Specials are buffalo, coal, fish, etc. No, those are resources stored to map.res??? in recent versions (in older versions there could be only two types of resources for each terrain type and those were stored as resource1 and resource2 in specials). Specials in current versions are roads, railroads, irrigation, mines, pollution, fallout and rivers. I'll investigate the source code today to figure out how to modify savegame in text editor to place (or remove) rivers. But shouldn't you be doing it in freeciv map editor anyway? ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18086] comparison is always false due to limited range of data type
Follow-up Comment #5, bug #18086 (project freeciv): Also here: vision_site_size_set found in ./common/vision.c: 134: void vision_site_size_set(struct vision_site *psite, citizens size) 135: { 136: fc_assert_ret(psite != NULL); 137: fc_assert_ret(size = MAX_CITY_SIZE); 138: 139: psite-size = size; 140: } ___ Reply to this item at: http://gna.org/bugs/?18086 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18081] warning: null format string
Follow-up Comment #5, bug #18081 (project freeciv): Missed one call (file #12930) ___ Additional Item Attachment: File name: sanitycheck.c Size:0 KB ___ Reply to this item at: http://gna.org/bugs/?18081 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #5, bug #18085 (project freeciv): But shouldn't you be doing it in freeciv map editor anyway? What should I do in freeciv map editor anyway? Place and remove rivers? ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Messaggio inviato con/da Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #6, bug #18085 (project freeciv): This is a bit complicated and I'm not explaining all the alternatives now. I'll just explain the most probable way the river information is stored in your scenarios. Test this, and if it doesn't work we'll check other alternatives. River information is topmost bit in spe01_ maps. So, any tile with value higher than or equal to 8 has river in it (possible hex values being 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f). If value is less than 8, just add 8 to get same specials as before + river. ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #7, bug #18085 (project freeciv): River information is topmost bit in spe01_ maps. So, any tile with value higher than or equal to 8 has river in it (possible hex values being 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f). If value is less than 8, just add 8 to get same specials as before + river. I don't know how to explain this, but I know how to create the rivers in the map. Value 2 has river in the nXXX layer. The attach file is check. First question: Is it possible to associate river with letter or symbol in the tXXX layer? No? No problem. Second question: Is it possible to enable construction road over the lake terrain? (file #12932) ___ Additional Item Attachment: File name: test.sav.gzSize:7 KB ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Messaggio inviato con/da Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18087] server segfault on a map with 1.3M tiles
Follow-up Comment #1, bug #18087 (project freeciv): Oh there is so much stack abuse in freeciv. Is it OK if I post patch to each file as a separate diff and message? (file #12933) ___ Additional Item Attachment: File name: startpos.c.diffSize:0 KB ___ Reply to this item at: http://gna.org/bugs/?18087 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18087] server segfault on a map with 1.3M tiles
Follow-up Comment #2, bug #18087 (project freeciv): The problem with my previous patch is that it will take up that space forever, which is also wrong. I think this needs to be done with malloc and free. I won't continue with this today and will wait for some feedback. Disregard startpos.c.diff please. [MAP_INDEX_SIZE] found in ./server/score.c: 162: bv_player claims[MAP_INDEX_SIZE]; [MAP_INDEX_SIZE] found in ./server/savegame2.c: 2763: int known[lines][MAP_INDEX_SIZE], j, p, l; 2815: int known[lines][MAP_INDEX_SIZE], j, l, p; [MAP_INDEX_SIZE] found in ./server/savegame.c: 1296: int known[MAP_INDEX_SIZE]; 1536: int known[MAP_INDEX_SIZE]; [MAP_INDEX_SIZE] found in ./server/generator/startpos.c: 206: int tile_value_aux[MAP_INDEX_SIZE]; 207: int tile_value[MAP_INDEX_SIZE]; [MAP_INDEX_SIZE] found in ./server/generator/utilities.c: 193: int alt_int_map[MAP_INDEX_SIZE]; [MAP_INDEX_SIZE] found in ./server/advisors/autosettlers.c: 622: struct settlermap state[MAP_INDEX_SIZE]; [MAP_INDEX_SIZE] found in ./common/map.c: 1081: int count = 0, positions[MAP_INDEX_SIZE]; ___ Reply to this item at: http://gna.org/bugs/?18087 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18088] Chat tab has white background when using a dark GTK theme
URL: http://gna.org/bugs/?18088 Summary: Chat tab has white background when using a dark GTK theme Project: Freeciv Submitted by: None Submitted on: Sat 30 Apr 2011 02:27:47 PM UTC Category: client-gtk-2.0 Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: n...@email.net Open/Closed: Open Release: 2.2.5 Discussion Lock: Any Operating System: GNU/Linux Planned Release: ___ Details: I am using vanilla freeciv-2.2.5 compiled on 32-bit Slackware Linux 13.37. I'm using a custom dark GTK theme (Cillop-Midnite) that's being set by GTK2_RC_FILES env variable. When freeciv-gtk starts, it honors the theme, but there are a few places that keep a white background: 1. Start freeciv-gtk - Load saved game - choose a game, press OK - the log window has a white background 2. In-game, the Chat tab has a white background as well. I suspect this happens because freeciv might be using hardcoded background values in these places (I don't have skills to inspect the source code myself). Also, in-game going to Game-Options-Local Client and explicitly changing the theme to Cillop-Midnite still heeps that Chat background white. It stays white even after I save options and restart the game. Note: the email is fake (I'm not using email at all). ___ Reply to this item at: http://gna.org/bugs/?18088 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18089] Want Left and middle click support to scroll minimap
URL: http://gna.org/bugs/?18089 Summary: Want Left and middle click support to scroll minimap Project: Freeciv Submitted by: None Submitted on: Sat 30 Apr 2011 02:41:36 PM UTC Category: client Severity: 2 - Minor Priority: 5 - Normal Status: None Assigned to: None Originator Email: sft...@yahoo.com Open/Closed: Open Release: 2.2.5 Discussion Lock: Any Operating System: Any Planned Release: ___ Details: Want Left and middle click support to scroll minimap. Only right click is accepted to scroll in minimap. I want Left and/or middle click to work too. Because some players are used to Left click on minimap to see that location (from other RTS games) Tuhin. ___ Reply to this item at: http://gna.org/bugs/?18089 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18091] Entry missing in effects.ruleset
URL: http://gna.org/bugs/?18091 Summary: Entry missing in effects.ruleset Project: Freeciv Submitted by: None Submitted on: Sat 30 Apr 2011 02:56:21 PM UTC Category: rulesets Severity: 4 - Important Priority: 5 - Normal Status: None Assigned to: None Originator Email: sft...@yahoo.com Open/Closed: Open Release: 2.2.5 Discussion Lock: Any Operating System: Any Planned Release: ___ Details: In effects.ruleset , entry for communism is missing in effect_empire_size_step. Following is the part copied over from effects.ruleset. Communism should be in [effect_empire_size_step_3] and the total step should be 5 after adding communism. [effect_empire_size_step_1] name= Empire_Size_Step value = 10 reqs= { type, name, range Gov, Despotism, Player } [effect_empire_size_step_2] name= Empire_Size_Step value = 12 reqs= { type, name, range Gov, Monarchy, Player } [effect_empire_size_step_3] name= Empire_Size_Step value = 14 reqs= { type, name, range Gov, Republic, Player } [effect_empire_size_step_4] name= Empire_Size_Step value = 16 reqs= { type, name, range Gov, Democracy, Player } ___ Reply to this item at: http://gna.org/bugs/?18091 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18087] server segfault on a map with 1.3M tiles
Follow-up Comment #3, bug #18087 (project freeciv): The attached patch manages to get me thru the segfaults. (It's a cat of small diffs, gna only allows max 4 uploads) Now there are problems with assertions: 1: in dbv_init() [bitvector.c::57]: assertion 'bits 0 bits 512 * 1024' failed. 1: Please report this message at http://gna.org/projects/freeciv/ /* Maximal size of a dynamic bitvector; for the map known bitvector it must be larger than the biggest possible map size (approx. MAP_MAX_SIZE * 1000) Use a large value to be on the save side (512kbits = 64kb). */ #define MAX_DBV_LENGTH 512 * 1024 So why isn't it defined to be MAP_MAX_SIZE * 1000? And is this define really necessary? These are the only occurrences: ./utility/bitvector.c:#define MAX_DBV_LENGTH 512 * 1024 ./utility/bitvector.c: than 0 and lower than the maximal size given by MAX_DBV_LENGTH. The ./utility/bitvector.c: fc_assert_ret(bits 0 bits MAX_DBV_LENGTH); ./utility/bitvector.c: fc_assert_ret(bits 0 bits MAX_DBV_LENGTH); I bumped it (and fixed a potential bug): -#define MAX_DBV_LENGTH 512 * 1024 +#define MAX_DBV_LENGTH (2048 * 1024) I call this win, because now my server is killed by the OS because of lack of memory :) The server allocated 400MB and client 200MB before being killed. (file #12935) ___ Additional Item Attachment: File name: diff Size:9 KB ___ Reply to this item at: http://gna.org/bugs/?18087 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18092] Fix some defines
URL: http://gna.org/bugs/?18092 Summary: Fix some defines Project: Freeciv Submitted by: akfaew Submitted on: Sat 30 Apr 2011 03:43:37 PM GMT Category: None Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: Discussion Lock: Any Operating System: None Planned Release: ___ Details: These defines have the potential for a bug or at least a misleading error message. ___ File Attachments: --- Date: Sat 30 Apr 2011 03:43:37 PM GMT Name: aiferry.c Size: 898B By: akfaew http://gna.org/bugs/download.php?file_id=12936 --- Date: Sat 30 Apr 2011 03:43:37 PM GMT Name: bitvector.c Size: 641B By: akfaew http://gna.org/bugs/download.php?file_id=12937 --- Date: Sat 30 Apr 2011 03:43:37 PM GMT Name: improvement.h Size: 677B By: akfaew http://gna.org/bugs/download.php?file_id=12938 --- Date: Sat 30 Apr 2011 03:43:37 PM GMT Name: stdinhand.c Size: 686B By: akfaew http://gna.org/bugs/download.php?file_id=12939 ___ Reply to this item at: http://gna.org/bugs/?18092 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #8, bug #18085 (project freeciv): Is it possible to associate river with letter or symbol in the tXXX layer? t)errain layer contains base terrain. Rivers are specials that can appear on top of such base terrains. So no, you cannot define rivers in terrain layer (though civ1 used to have rivers as separate terrain type, not as modification to existing terrains) Is it possible to enable construction road over the lake terrain? No, you can't have roads on oceanic terrains. btw Are you limiting yourself to creating maps usable with default ruleset, or are you prepared to create custom rulesets to support them? ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18089] Want Left and middle click support to scroll minimap
Follow-up Comment #1, bug #18089 (project freeciv): Actually, left click on on the minimap currently performs a goto for the active unit(s). It's kind of annoying, actually, since you can't really be sure where you are clicking at that resolution. But you'd have to convince the community to give up on that use of the left click before you can reassign scrolling to it - i expect that won't be easy to do. Let me humbly offer another suggestion, though i'm not entirely sure it is feasible - particularly across multiple GUIs. How about if the cursor is over the minimap then the keyboard arrows could be used to scroll the minimap? I'm not sure, however, if GTK et al will allow us to steal the focus in this fashion. ___ Reply to this item at: http://gna.org/bugs/?18089 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18085] River and Map Format
Follow-up Comment #9, bug #18085 (project freeciv): Thanks for reply. Are you limiting yourself to creating maps usable with default ruleset, or are you prepared to create custom rulesets to support them? Default and custom rulesets. ___ Reply to this item at: http://gna.org/bugs/?18085 ___ Messaggio inviato con/da Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev