Make it possible to add short descriptions to challenges.

This adds an optional "description" entry to the [challenge] section of a
challenge's ini file which is shown in the tooltip.

Original patch from #1805, slightly modified by me.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/branches/qt-trunk@10897 4a71c877-e1ca-e34f-864e-861f7616d084
master
Christian Ohm 2010-06-03 18:55:46 +00:00 committed by Git SVN Gateway
parent 732c0b70a1
commit 3d6fc334d4
1 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,7 @@
#define totalslots 36 // challenge slots
#define slotsInColumn 12 // # of slots in a column
#define totalslotspace 64 // guessing 64 max chars for filename.
#define totalslotspace 256 // max chars for slot strings.
#define CHALLENGE_X D_W + 16
#define CHALLENGE_Y D_H + 5
@ -237,9 +237,9 @@ bool addChallenges()
for (i = files; *i != NULL; ++i)
{
W_BUTTON *button;
char description[128];
char highscore[64];
const char *name, *difficulty, *map;
char description[totalslotspace];
char highscore[totalslotspace];
const char *name, *difficulty, *map, *givendescription;
dictionary *dict;
// See if this filename contains the extension we're looking for
@ -284,7 +284,8 @@ bool addChallenges()
name = iniparser_getstring(dict, "challenge:Name", "BAD NAME");
map = iniparser_getstring(dict, "challenge:Map", "BAD MAP");
difficulty = iniparser_getstring(dict, "challenge:difficulty", "BAD DIFFICULTY");
ssprintf(description, "%s - %s - %s", map, difficulty, highscore);
givendescription = iniparser_getstring(dict, "challenge:description", "");
ssprintf(description, "%s, %s, %s. %s", map, difficulty, highscore, givendescription);
button = (W_BUTTON*)widgGetFromID(psRequestScreen, CHALLENGE_ENTRY_START + slotCount);