[Freeciv-Dev] (PR#12070) don't break because of missing flags
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12070 >
Currently the client breaks down if there's a flag graphic missing
(which happens with some of the new nations because they weren't given
suitable alternates). With this patch it tries to use f.unknown first.
-jason
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.225
diff -u -r1.225 tilespec.c
--- client/tilespec.c 29 Jan 2005 18:18:04 -0000 1.225
+++ client/tilespec.c 1 Feb 2005 08:42:49 -0000
@@ -1841,13 +1841,20 @@
***********************************************************************/
void tilespec_setup_nation_flag(int id)
{
- struct nation_type *this_nation = get_nation_by_idx(id);
-
- this_nation->flag_sprite =
lookup_sprite_tag_alt(this_nation->flag_graphic_str,
- this_nation->flag_graphic_alt,
- TRUE, "nation", this_nation->name);
+ struct nation_type *nation = get_nation_by_idx(id);
+ char *tags[] = {nation->flag_graphic_str,
+ nation->flag_graphic_alt,
+ "f.unknown", NULL};
+ int i;
- /* should probably do something if NULL, eg generic default? */
+ for (i = 0; tags[i] && !nation->flag_sprite; i++) {
+ nation->flag_sprite = load_sprite(tags[i]);
+ }
+ if (!nation->flag_sprite) {
+ /* Should never get here because of the f.unknown fallback. */
+ freelog(LOG_FATAL, "No national flag for %s.", nation->name);
+ exit(EXIT_FAILURE);
+ }
}
/**********************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12070) don't break because of missing flags,
Jason Short <=
|
|