Mercurial > hg > openttd
annotate src/base_media_base.h @ 17564:d5ff867052a5 draft
(svn r22328) -Add: a flag to GroundVehicles to disable insertion and removal of automatic orders until the next real order is reached.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 16 Apr 2011 16:45:35 +0000 |
parents | b6e74a185e03 |
children | dd146c861a88 |
rev | line source |
---|---|
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12771
diff
changeset
|
9 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 /** @file base_media_base.h Generic functions for replacing base data (graphics, sounds). */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #ifndef BASE_MEDIA_BASE_H |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #define BASE_MEDIA_BASE_H |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
14 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 #include "fileio_func.h" |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
16 #include "core/smallmap_type.hpp" |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
17 #include "gfx_type.h" |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
18 |
12680
a16076901c37
(svn r17135) -Fix (r17133): some (older) GCCs failed to compile
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
19 /* Forward declare these; can't do 'struct X' in functions as older GCCs barf on that */ |
a16076901c37
(svn r17135) -Fix (r17133): some (older) GCCs failed to compile
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
20 struct IniFile; |
a16076901c37
(svn r17135) -Fix (r17133): some (older) GCCs failed to compile
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
21 struct ContentInfo; |
a16076901c37
(svn r17135) -Fix (r17133): some (older) GCCs failed to compile
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
22 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 /** Structure holding filename and MD5 information about a single file */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 struct MD5File { |
12771
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
25 /** The result of a checksum check */ |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
26 enum ChecksumResult { |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
27 CR_MATCH, ///< The file did exist and the md5 checksum did match |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
28 CR_MISMATCH, ///< The file did exist, just the md5 checksum did not match |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
29 CR_NO_FILE, ///< The file did not exist |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
30 }; |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
31 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 const char *filename; ///< filename |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 uint8 hash[16]; ///< md5 sum of the file |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 const char *missing_warning; ///< warning when this file is missing |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
36 ChecksumResult CheckMD5(Subdirectory subdir) const; |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
37 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
38 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 * Information about a single base set. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 * @tparam T the real class we're going to be |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
42 * @tparam Tnum_files the number of files in the set |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
43 * @tparam Tsubdir the subdirectory where to find the files |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
44 */ |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
45 template <class T, size_t Tnum_files, Subdirectory Tsubdir> |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
46 struct BaseSet { |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
47 typedef SmallMap<const char *, const char *> TranslatedStrings; |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
48 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
49 /** Number of files in this set */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
50 static const size_t NUM_FILES = Tnum_files; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
51 |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
52 /** The sub directory to search for the files */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
53 static const Subdirectory SUBDIR = Tsubdir; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
54 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
55 /** Internal names of the files in this set. */ |
13096
e3e4c1648e0c
(svn r17596) -Codechange: constify some tables
smatz <smatz@openttd.org>
parents:
12778
diff
changeset
|
56 static const char * const *file_names; |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
58 const char *name; ///< The name of the base set |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
59 TranslatedStrings description; ///< Description of the base set |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
60 uint32 shortname; ///< Four letter short variant of the name |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
61 uint32 version; ///< The version of this base set |
14629
b314a1ba4eab
(svn r19206) -Add: concept of fallback base sets, i.e. do not automatically load the NoMusic/NoSound sets when there is another set
rubidium <rubidium@openttd.org>
parents:
14065
diff
changeset
|
62 bool fallback; ///< This set is a fallback set, i.e. it should be used only as last resort |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
63 |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
64 MD5File files[NUM_FILES]; ///< All files part of this set |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
65 uint found_files; ///< Number of the files that could be found |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
66 uint valid_files; ///< Number of the files that could be found and are valid |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
67 |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
68 T *next; ///< The next base set in this list |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
70 /** Free everything we allocated */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
71 ~BaseSet() |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
72 { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
73 free((void*)this->name); |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
74 |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
75 for (TranslatedStrings::iterator iter = this->description.Begin(); iter != this->description.End(); iter++) { |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
76 free((void*)iter->first); |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
77 free((void*)iter->second); |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
78 } |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
79 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
80 for (uint i = 0; i < NUM_FILES; i++) { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
81 free((void*)this->files[i].filename); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
82 free((void*)this->files[i].missing_warning); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
83 } |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
84 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
85 delete this->next; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
86 } |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
87 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
88 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
89 * Get the number of missing files. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
90 * @return the number |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
91 */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
92 int GetNumMissing() const |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
93 { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
94 return Tnum_files - this->found_files; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
95 } |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
96 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
97 /** |
12771
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
98 * Get the number of invalid files. |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
99 * @note a missing file is invalid too! |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
100 * @return the number |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
101 */ |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
102 int GetNumInvalid() const |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
103 { |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
104 return Tnum_files - this->valid_files; |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
105 } |
7a25de72eb71
(svn r17241) -Change: make a distinction between missing and corrupted data files. If (at least) one data file is missing do not consider the set to be useable. Do also no autodetect sets with missing files.
rubidium <rubidium@openttd.org>
parents:
12686
diff
changeset
|
106 |
15054
e4700adec3ee
(svn r19674) -Fix [FS#3774]: crash when the music/graphics metadata files were unreadable
rubidium <rubidium@openttd.org>
parents:
14681
diff
changeset
|
107 bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true); |
13281
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
108 |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
109 /** |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
110 * Get the description for the given ISO code. |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
111 * It falls back to the first two characters of the ISO code in case |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
112 * no match could be made with the full ISO code. If even then the |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
113 * matching fails the default is returned. |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
114 * @param isocode the isocode to search for |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
115 * @return the description |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
116 */ |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
117 const char *GetDescription(const char *isocode = NULL) const |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
118 { |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
119 if (isocode != NULL) { |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
120 /* First the full ISO code */ |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
121 for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) { |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
122 if (strcmp(iter->first, isocode) == 0) return iter->second; |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
123 } |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
124 /* Then the first two characters */ |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
125 for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) { |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
126 if (strncmp(iter->first, isocode, 2) == 0) return iter->second; |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
127 } |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
128 } |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
129 /* Then fall back */ |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
130 return this->description.Begin()->second; |
e241d1485669
(svn r17790) -Feature: translatable base sound/graphics set descriptions
rubidium <rubidium@openttd.org>
parents:
13096
diff
changeset
|
131 } |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
132 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
133 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
134 /** |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
135 * Base for all base media (graphics, sounds) |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
136 * @tparam Tbase_set the real set we're going to be |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
137 */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
138 template <class Tbase_set> |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
139 class BaseMedia : FileScanner { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
140 protected: |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
141 static Tbase_set *available_sets; ///< All available sets |
15923
fb2cc4b4fa4a
(svn r20607) -Fix: retain information about all base sets that are found and not only the latest version. This to stop confusing people that use newer versions of the base sets than those available via BaNaNaS.
rubidium <rubidium@openttd.org>
parents:
15054
diff
changeset
|
142 static Tbase_set *duplicate_sets; ///< All sets that aren't available, but needed for not downloading base sets when a newer version than the one on BaNaNaS is loaded. |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
143 static const Tbase_set *used_set; ///< The currently used set |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
144 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
145 /* virtual */ bool AddFile(const char *filename, size_t basepath_length); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
146 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
147 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
148 * Get the extension that is used to identify this set. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
149 * @return the extension |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
150 */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
151 static const char *GetExtension(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
152 public: |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
153 /** The set as saved in the config file. */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
154 static const char *ini_set; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
155 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
156 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
157 * Determine the graphics pack that has to be used. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
158 * The one with the most correct files wins. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
159 * @return true if a best set has been found. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
160 */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
161 static bool DetermineBestSet(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
162 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
163 /** Do the scan for files. */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
164 static uint FindSets() |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 BaseMedia<Tbase_set> fs; |
14681
86939658ba6b
(svn r19262) -Feature: finalise BaNaNaS support for music sets
rubidium <rubidium@openttd.org>
parents:
14635
diff
changeset
|
167 /* GM_DIR == music set. Music sets don't support tars, |
86939658ba6b
(svn r19262) -Feature: finalise BaNaNaS support for music sets
rubidium <rubidium@openttd.org>
parents:
14635
diff
changeset
|
168 * so there is no need to search for tars in that case. */ |
86939658ba6b
(svn r19262) -Feature: finalise BaNaNaS support for music sets
rubidium <rubidium@openttd.org>
parents:
14635
diff
changeset
|
169 return fs.Scan(GetExtension(), Tbase_set::SUBDIR, Tbase_set::SUBDIR != GM_DIR); |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 } |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 static bool SetSet(const char *name); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
173 static char *GetSetsList(char *p, const char *last); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 static int GetNumSets(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
175 static int GetIndexOfUsedSet(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
176 static const Tbase_set *GetSet(int index); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
177 static const Tbase_set *GetUsedSet(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
178 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
179 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
180 * Check whether we have an set with the exact characteristics as ci. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
181 * @param ci the characteristics to search on (shortname and md5sum) |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
182 * @param md5sum whether to check the MD5 checksum |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 * @return true iff we have an set matching. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
184 */ |
12680
a16076901c37
(svn r17135) -Fix (r17133): some (older) GCCs failed to compile
rubidium <rubidium@openttd.org>
parents:
12678
diff
changeset
|
185 static bool HasSet(const ContentInfo *ci, bool md5sum); |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
186 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
188 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
189 /** Types of graphics in the base graphics set */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 enum GraphicsFileType { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 GFT_BASE, ///< Base sprites for all climates |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 GFT_LOGOS, ///< Logos, landscape icons and original terrain generator sprites |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
193 GFT_ARCTIC, ///< Landscape replacement sprites for arctic |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 GFT_TROPICAL, ///< Landscape replacement sprites for tropical |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
195 GFT_TOYLAND, ///< Landscape replacement sprites for toyland |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
196 GFT_EXTRA, ///< Extra sprites that were not part of the original sprites |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 MAX_GFT ///< We are looking for this amount of GRFs |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
199 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
200 /** All data of a graphics set. */ |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
201 struct GraphicsSet : BaseSet<GraphicsSet, MAX_GFT, DATA_DIR> { |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 PaletteType palette; ///< Palette of this graphics set |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 |
15054
e4700adec3ee
(svn r19674) -Fix [FS#3774]: crash when the music/graphics metadata files were unreadable
rubidium <rubidium@openttd.org>
parents:
14681
diff
changeset
|
204 bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename); |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
205 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
206 |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
207 /** All data/functions related with replacing the base graphics. */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
208 class BaseGraphics : public BaseMedia<GraphicsSet> { |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 public: |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
210 /** |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
211 * Determine the palette of the current graphics set. |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
212 */ |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
213 static void DeterminePalette(); |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
214 }; |
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
215 |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
216 /** All data of a sounds set. */ |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
217 struct SoundsSet : BaseSet<SoundsSet, 1, DATA_DIR> { |
12684
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
218 }; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
219 |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
220 /** All data/functions related with replacing the base sounds */ |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
221 class BaseSounds : public BaseMedia<SoundsSet> { |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
222 public: |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
223 }; |
b056ac99f230
(svn r17139) -Change: add the concept of sound sets
rubidium <rubidium@openttd.org>
parents:
12680
diff
changeset
|
224 |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
225 /** Maximum number of songs in the 'class' playlists. */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
226 static const uint NUM_SONGS_CLASS = 10; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
227 /** Number of classes for songs */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
228 static const uint NUM_SONG_CLASSES = 3; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
229 /** Maximum number of songs in the full playlist; theme song + the classes */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
230 static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
231 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
232 /** Maximum number of songs in the (custom) playlist */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
233 static const uint NUM_SONGS_PLAYLIST = 32; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
234 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
235 /** All data of a music set. */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
236 struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, GM_DIR> { |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
237 /** The name of the different songs. */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
238 char song_name[NUM_SONGS_AVAILABLE][32]; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
239 byte track_nr[NUM_SONGS_AVAILABLE]; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
240 byte num_available; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
241 |
15054
e4700adec3ee
(svn r19674) -Fix [FS#3774]: crash when the music/graphics metadata files were unreadable
rubidium <rubidium@openttd.org>
parents:
14681
diff
changeset
|
242 bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename); |
14065
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
243 }; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
244 |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
245 /** All data/functions related with replacing the base music */ |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
246 class BaseMusic : public BaseMedia<MusicSet> { |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
247 public: |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
248 }; |
a5fb37f9f59d
(svn r18608) -Change: add the concept of music sets
rubidium <rubidium@openttd.org>
parents:
13281
diff
changeset
|
249 |
12678
ea203bb44a25
(svn r17133) -Codechange: generalise the code that searches for base graphics
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
250 #endif /* BASE_MEDIA_BASE_H */ |