diff options
author | belugas <belugas@openttd.org> | 2007-03-21 03:06:21 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-03-21 03:06:21 +0000 |
commit | 8952924c64f66340d49c13bf3f35f5891a457060 (patch) | |
tree | b96361ddddd1cec25475044a96a689ce7c9cd0d6 | |
parent | d99a2694930860cde281b425e735426acb52e3b3 (diff) | |
download | openttd-8952924c64f66340d49c13bf3f35f5891a457060.tar.xz |
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
-rw-r--r-- | src/namegen.cpp | 144 | ||||
-rw-r--r-- | src/namegen.h | 2 | ||||
-rw-r--r-- | src/newgrf.cpp | 414 | ||||
-rw-r--r-- | src/newgrf.h | 6 | ||||
-rw-r--r-- | src/newgrf_cargo.h | 2 | ||||
-rw-r--r-- | src/newgrf_config.cpp | 3 | ||||
-rw-r--r-- | src/newgrf_config.h | 4 | ||||
-rw-r--r-- | src/newgrf_engine.cpp | 70 | ||||
-rw-r--r-- | src/newgrf_engine.h | 11 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 22 | ||||
-rw-r--r-- | src/newgrf_sound.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_sound.h | 2 | ||||
-rw-r--r-- | src/newgrf_spritegroup.cpp | 2 | ||||
-rw-r--r-- | src/newgrf_spritegroup.h | 60 | ||||
-rw-r--r-- | src/newgrf_station.cpp | 30 | ||||
-rw-r--r-- | src/newgrf_text.cpp | 10 | ||||
-rw-r--r-- | src/newgrf_text.h | 2 | ||||
-rw-r--r-- | src/news.h | 2 | ||||
-rw-r--r-- | src/news_gui.cpp | 57 | ||||
-rw-r--r-- | src/npf.cpp | 34 | ||||
-rw-r--r-- | src/npf.h | 47 |
21 files changed, 480 insertions, 446 deletions
diff --git a/src/namegen.cpp b/src/namegen.cpp index c70cc2d35..4b0d0d48c 100644 --- a/src/namegen.cpp +++ b/src/namegen.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file namegen.cpp */ + #include "stdafx.h" #include "openttd.h" #include "debug.h" @@ -41,21 +43,21 @@ static byte MakeEnglishOriginalTownName(char *buf, uint32 seed, const char *last { int i; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChanceBias(0, lengthof(name_original_english_1), seed, 50); if (i >= 0) strecat(buf, name_original_english_1[i], last); - //mandatory middle segments + /* mandatory middle segments */ strecat(buf, name_original_english_2[SeedChance(4, lengthof(name_original_english_2), seed)], last); strecat(buf, name_original_english_3[SeedChance(7, lengthof(name_original_english_3), seed)], last); strecat(buf, name_original_english_4[SeedChance(10, lengthof(name_original_english_4), seed)], last); strecat(buf, name_original_english_5[SeedChance(13, lengthof(name_original_english_5), seed)], last); - //optional last segment + /* optional last segment */ i = SeedChanceBias(15, lengthof(name_original_english_6), seed, 60); if (i >= 0) strecat(buf, name_original_english_6[i], last); @@ -82,10 +84,10 @@ static byte MakeEnglishAdditionalTownName(char *buf, uint32 seed, const char *la { int i; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50); if (i >= 0) strecat(buf,name_additional_english_prefix[i], last); @@ -104,7 +106,7 @@ static byte MakeEnglishAdditionalTownName(char *buf, uint32 seed, const char *la strecat(buf, name_additional_english_2[SeedChance(14, lengthof(name_additional_english_2), seed)], last); - //optional last segment + /* optional last segment */ i = SeedChanceBias(15, lengthof(name_additional_english_3), seed, 60); if (i >= 0) strecat(buf, name_additional_english_3[i], last); @@ -128,32 +130,32 @@ static byte MakeAustrianTownName(char *buf, uint32 seed, const char *last) int i, j = 0; strecpy(buf, "", last); - // Bad, Maria, Gross, ... + /* Bad, Maria, Gross, ... */ i = SeedChanceBias(0, lengthof(name_austrian_a1), seed, 15); if (i >= 0) strecat(buf, name_austrian_a1[i], last); i = SeedChance(4, 6, seed); if (i >= 4) { - // Kaisers-kirchen + /* Kaisers-kirchen */ strecat(buf, name_austrian_a2[SeedChance( 7, lengthof(name_austrian_a2), seed)], last); strecat(buf, name_austrian_a3[SeedChance(13, lengthof(name_austrian_a3), seed)], last); } else if (i >= 2) { - // St. Johann + /* St. Johann */ strecat(buf, name_austrian_a5[SeedChance( 7, lengthof(name_austrian_a5), seed)], last); strecat(buf, name_austrian_a6[SeedChance( 9, lengthof(name_austrian_a6), seed)], last); j = 1; // More likely to have a " an der " or " am " } else { - // Zell + /* Zell */ strecat(buf, name_austrian_a4[SeedChance( 7, lengthof(name_austrian_a4), seed)], last); } i = SeedChance(1, 6, seed); if (i >= 4 - j) { - // an der Donau (rivers) + /* an der Donau (rivers) */ strecat(buf, name_austrian_f1[SeedChance(4, lengthof(name_austrian_f1), seed)], last); strecat(buf, name_austrian_f2[SeedChance(5, lengthof(name_austrian_f2), seed)], last); } else if (i >= 2 - j) { - // am Dachstein (mountains) + /* am Dachstein (mountains) */ strecat(buf, name_austrian_b1[SeedChance(4, lengthof(name_austrian_b1), seed)], last); strecat(buf, name_austrian_b2[SeedChance(5, lengthof(name_austrian_b2), seed)], last); } @@ -166,18 +168,18 @@ static byte MakeGermanTownName(char *buf, uint32 seed, const char *last) uint i; uint seed_derivative; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); seed_derivative = SeedChance(7, 28, seed); - //optional prefix + /* optional prefix */ if (seed_derivative == 12 || seed_derivative == 19) { i = SeedChance(2, lengthof(name_german_pre), seed); strecat(buf,name_german_pre[i], last); } - // mandatory middle segments including option of hardcoded name + /* mandatory middle segments including option of hardcoded name */ i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed); if (i < lengthof(name_german_real)) { strecat(buf,name_german_real[i], last); @@ -188,7 +190,7 @@ static byte MakeGermanTownName(char *buf, uint32 seed, const char *last) strecat(buf, name_german_2[i], last); } - // optional suffix + /* optional suffix */ if (seed_derivative == 24) { i = SeedChance(9, lengthof(name_german_4_an_der) + lengthof(name_german_4_am), seed); @@ -226,15 +228,15 @@ static byte MakeSwedishTownName(char *buf, uint32 seed, const char *last) { int i; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChanceBias(0, lengthof(name_swedish_1), seed, 50); if (i >= 0) strecat(buf, name_swedish_1[i], last); - // mandatory middle segments including option of hardcoded name + /* mandatory middle segments including option of hardcoded name */ if (SeedChance(4, 5, seed) >= 3) { strecat(buf, name_swedish_2[SeedChance( 7, lengthof(name_swedish_2), seed)], last); } else { @@ -252,15 +254,15 @@ static byte MakeDutchTownName(char *buf, uint32 seed, const char *last) { int i; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChanceBias(0, lengthof(name_dutch_1), seed, 50); if (i >= 0) strecat(buf, name_dutch_1[i], last); - // mandatory middle segments including option of hardcoded name + /* mandatory middle segments including option of hardcoded name */ if (SeedChance(6, 9, seed) > 4) { strecat(buf, name_dutch_2[SeedChance( 9, lengthof(name_dutch_2), seed)], last); } else { @@ -274,16 +276,16 @@ static byte MakeDutchTownName(char *buf, uint32 seed, const char *last) static byte MakeFinnishTownName(char *buf, uint32 seed, const char *last) { - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // Select randomly if town name should consists of one or two parts. + /* Select randomly if town name should consists of one or two parts. */ if (SeedChance(0, 15, seed) >= 10) { strecat(buf, name_finnish_real[SeedChance(2, lengthof(name_finnish_real), seed)], last); } else if (SeedChance(0, 15, seed) >= 5) { - // A two-part name by combining one of name_finnish_1 + "la"/"lä" - // The reason for not having the contents of name_finnish_{1,2} in the same table is - // that the ones in name_finnish_2 are not good for this purpose. + /* A two-part name by combining one of name_finnish_1 + "la"/"lä" + * The reason for not having the contents of name_finnish_{1,2} in the same table is + * that the ones in name_finnish_2 are not good for this purpose. */ uint sel = SeedChance( 0, lengthof(name_finnish_1), seed); char *end; strecat(buf, name_finnish_1[sel], last); @@ -298,8 +300,8 @@ static byte MakeFinnishTownName(char *buf, uint32 seed, const char *last) strecat(buf, "lä", last); } } else { - // A two-part name by combining one of name_finnish_{1,2} + name_finnish_3. - // Why aren't name_finnish_{1,2} just one table? See above. + /* A two-part name by combining one of name_finnish_{1,2} + name_finnish_3. + * Why aren't name_finnish_{1,2} just one table? See above. */ uint sel = SeedChance(2, lengthof(name_finnish_1) + lengthof(name_finnish_2), seed); if (sel >= lengthof(name_finnish_1)) { @@ -318,10 +320,10 @@ static byte MakePolishTownName(char *buf, uint32 seed, const char *last) uint i; uint j; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChance(0, lengthof(name_polish_2_o) + lengthof(name_polish_2_m) + lengthof(name_polish_2_f) + lengthof(name_polish_2_n), @@ -374,13 +376,13 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) CzechChoose choose; CzechAllow allow; - // 1:3 chance to use a real name. + /* 1:3 chance to use a real name. */ if (SeedModChance(0, 4, seed) == 0) { strecpy(buf, name_czech_real[SeedModChance(4, lengthof(name_czech_real), seed)], last); return 0; } - // NUL terminates the string for strcat() + /* NUL terminates the string for strcat() */ strecpy(buf, "", last); prob_tails = SeedModChance(2, 32, seed); @@ -389,12 +391,12 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) if (do_prefix) prefix = SeedModChance(5, lengthof(name_czech_adj) * 12, seed) / 12; if (do_suffix) suffix = SeedModChance(7, lengthof(name_czech_suffix), seed); - // 3:1 chance 3:1 to use dynamic substantive + /* 3:1 chance 3:1 to use dynamic substantive */ stem = SeedModChance(9, lengthof(name_czech_subst_full) + 3 * lengthof(name_czech_subst_stem), seed); if (stem < lengthof(name_czech_subst_full)) { - // That was easy! + /* That was easy! */ dynamic_subst = false; gender = name_czech_subst_full[stem].gender; choose = name_czech_subst_full[stem].choose; @@ -404,7 +406,7 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) int ending_start = -1, ending_stop = -1; int i; - // Load the substantive + /* Load the substantive */ dynamic_subst = true; stem -= lengthof(name_czech_subst_full); stem %= lengthof(name_czech_subst_stem); @@ -412,15 +414,15 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) choose = name_czech_subst_stem[stem].choose; allow = name_czech_subst_stem[stem].allow; - // Load the postfix (1:1 chance that a postfix will be inserted) + /* Load the postfix (1:1 chance that a postfix will be inserted) */ postfix = SeedModChance(14, lengthof(name_czech_subst_postfix) * 2, seed); if (choose & CZC_POSTFIX) { - // Always get a real postfix. + /* Always get a real postfix. */ postfix %= lengthof(name_czech_subst_postfix); } if (choose & CZC_NOPOSTFIX) { - // Always drop a postfix. + /* Always drop a postfix. */ postfix += lengthof(name_czech_subst_postfix); } if (postfix < lengthof(name_czech_subst_postfix)) { @@ -429,7 +431,7 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) choose |= CZC_NOPOSTFIX; } - // Localize the array segment containing a good gender + /* Localize the array segment containing a good gender */ for (ending = 0; ending < (int) lengthof(name_czech_subst_ending); ending++) { const CzechNameSubst *e = &name_czech_subst_ending[ending]; @@ -445,11 +447,11 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) } } if (ending_stop < 0) { - // Whoa. All the endings matched. + /* Whoa. All the endings matched. */ ending_stop = ending - 1; } - // Make a sequential map of the items with good mask + /* Make a sequential map of the items with good mask */ i = 0; for (ending = ending_start; ending <= ending_stop; ending++) { const CzechNameSubst *e = &name_czech_subst_ending[ending]; @@ -459,20 +461,20 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) } assert(i > 0); - // Load the ending + /* Load the ending */ ending = map[SeedModChance(16, i, seed)]; - // Override possible CZG_*FREE; this must be a real gender, - // otherwise we get overflow when modifying the adjectivum. + /* Override possible CZG_*FREE; this must be a real gender, + * otherwise we get overflow when modifying the adjectivum. */ gender = name_czech_subst_ending[ending].gender; assert(gender != CZG_FREE && gender != CZG_NFREE); } if (do_prefix && (name_czech_adj[prefix].choose & choose) != choose) { - // Throw away non-matching prefix. + /* Throw away non-matching prefix. */ do_prefix = false; } - // Now finally construct the name + /* Now finally construct the name */ if (do_prefix) { CzechPattern pattern = name_czech_adj[prefix].pattern; @@ -505,7 +507,7 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) endlen = strlen(endstr); assert(postlen > 0 && endlen > 0); - // Kill the "avava" and "Jananna"-like cases + /* Kill the "avava" and "Jananna"-like cases */ if (postlen < 2 || postlen > endlen || ( (poststr[1] != 'v' || poststr[1] != endstr[1]) && poststr[2] != endstr[1]) @@ -514,7 +516,7 @@ static byte MakeCzechTownName(char *buf, uint32 seed, const char *last) strecat(buf, poststr, last); buflen = strlen(buf); - // k-i -> c-i, h-i -> z-i + /* k-i -> c-i, h-i -> z-i */ if (endstr[0] == 'i') { switch (buf[buflen - 1]) { case 'k': buf[buflen - 1] = 'c'; break; @@ -553,15 +555,15 @@ static byte MakeNorwegianTownName(char *buf, uint32 seed, const char *last) { strecpy(buf, "", last); - // Use first 4 bit from seed to decide whether or not this town should - // have a real name 3/16 chance. Bit 0-3 + /* Use first 4 bit from seed to decide whether or not this town should + * have a real name 3/16 chance. Bit 0-3 */ if (SeedChance(0, 15, seed) < 3) { - // Use 7bit for the realname table index. Bit 4-10 + /* Use 7bit for the realname table index. Bit 4-10 */ strecat(buf, name_norwegian_real[SeedChance(4, lengthof(name_norwegian_real), seed)], last); } else { - // Use 7bit for the first fake part. Bit 4-10 + /* Use 7bit for the first fake part. Bit 4-10 */ strecat(buf, name_norwegian_1[SeedChance(4, lengthof(name_norwegian_1), seed)], last); - // Use 7bit for the last fake part. Bit 11-17 + /* Use 7bit for the last fake part. Bit 11-17 */ strecat(buf, name_norwegian_2[SeedChance(11, lengthof(name_norwegian_2), seed)], last); } @@ -572,22 +574,22 @@ static byte MakeHungarianTownName(char *buf, uint32 seed, const char *last) { uint i; - //null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); if (SeedChance(12, 15, seed) < 3) { strecat(buf, name_hungarian_real[SeedChance(0, lengthof(name_hungarian_real), seed)], last); } else { - // optional first segment + /* optional first segment */ i = SeedChance(3, lengthof(name_hungarian_1) * 3, seed); if (i < lengthof(name_hungarian_1)) strecat(buf, name_hungarian_1[i], last); - // mandatory middle segments + /* mandatory middle segments */ strecat(buf, name_hungarian_2[SeedChance(3, lengthof(name_hungarian_2), seed)], last); strecat(buf, name_hungarian_3[SeedChance(6, lengthof(name_hungarian_3), seed)], last); - // optional last segment + /* optional last segment */ i = SeedChance(10, lengthof(name_hungarian_4) * 3, seed); if (i < lengthof(name_hungarian_4)) { strecat(buf, name_hungarian_4[i], last); @@ -607,15 +609,15 @@ static byte MakeDanishTownName(char *buf, uint32 seed, const char *last) { int i; - // null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); - // optional first segment + /* optional first segment */ i = SeedChanceBias(0, lengthof(name_danish_1), seed, 50); if (i >= 0) strecat(buf, name_danish_1[i], last); - // middle segments removed as this algorithm seems to create much more realistic names + /* middle segments removed as this algorithm seems to create much more realistic names */ strecat(buf, name_danish_2[SeedChance( 7, lengthof(name_danish_2), seed)], last); strecat(buf, name_danish_3[SeedChance(16, lengthof(name_danish_3), seed)], last); @@ -626,16 +628,16 @@ static byte MakeTurkishTownName(char *buf, uint32 seed, const char *last) { uint i; - // null terminates the string for strcat + /* null terminates the string for strcat */ strecpy(buf, "", last); if ((i = SeedModChance(0, 5, seed)) == 0) { strecat(buf, name_turkish_prefix[SeedModChance( 2, lengthof(name_turkish_prefix), seed)], last); - // middle segment + /* middle segment */ strecat(buf, name_turkish_middle[SeedModChance( 4, lengthof(name_turkish_middle), seed)], last); - // optional suffix + /* optional suffix */ if (SeedModChance(0, 7, seed) == 0) { strecat(buf, name_turkish_suffix[SeedModChance( 10, lengthof(name_turkish_suffix), seed)], last); } @@ -757,30 +759,30 @@ TownNameGenerator * const _town_name_generators[] = MakeCatalanTownName, }; -// DO WE NEED THIS ANY MORE? +/* DO WE NEED THIS ANY MORE? */ #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z) uint32 GetOldTownName(uint32 townnameparts, byte old_town_name_type) { switch (old_town_name_type) { - case 0: case 3: /* English, American */ + case 0: case 3: // English, American /* Already OK */ return townnameparts; - case 1: /* French */ + case 1: // French /* For some reason 86 needs to be subtracted from townnameparts * 0000 0000 0000 0000 0000 0000 1111 1111 */ return FIXNUM(townnameparts - 86, lengthof(name_french_real), 0); - case 2: /* German */ + case 2: // German DEBUG(misc, 0, "German Townnames are buggy (%d)", townnameparts); return townnameparts; - case 4: /* Latin-American */ + case 4: // Latin-American /* 0000 0000 0000 0000 0000 0000 1111 1111 */ return FIXNUM(townnameparts, lengthof(name_spanish_real), 0); - case 5: /* Silly */ + case 5: // Silly /* NUM_SILLY_1 - lower 16 bits * NUM_SILLY_2 - upper 16 bits without leading 1 (first 8 bytes) * 1000 0000 2222 2222 0000 0000 1111 1111 */ diff --git a/src/namegen.h b/src/namegen.h index 664a014ec..65105f03c 100644 --- a/src/namegen.h +++ b/src/namegen.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file namegen.h */ + #ifndef NAMEGEN_H #define NAMEGEN_H diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 6fbcf764f..34eeada1c 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf.cpp */ + #include "stdafx.h" #include <stdarg.h> @@ -242,7 +244,7 @@ static GRFFile *GetFileByFilename(const char *filename) static StringID MapGRFStringID(StringID str) { /* 0xD0 and 0xDC stand for all the TextIDs in the range - * of 0xD000 (misc graphics texts) and 0xDC00 (misc persistent texts). + * of 0xD000 (misc graphics texts) and 0xDC00 (misc persistent texts). * These strings are unique to each grf file, and thus require to be used with the * grfid in which they are declared */ if (GB(str, 8, 8) == 0xD0 || GB(str, 8, 8) == 0xDC) { @@ -288,7 +290,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf bool ret = false; switch (prop) { - case 0x05: /* Track type */ + case 0x05: // Track type FOR_EACH_OBJECT { uint8 tracktype = grf_load_byte(&buf); @@ -303,13 +305,13 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x08: /* AI passenger service */ - /* TODO */ + case 0x08: // AI passenger service + /* @todo missing feature */ FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; - case 0x09: /* Speed (1 unit is 1 kmh) */ + case 0x09: // Speed (1 unit is 1 kmh) FOR_EACH_OBJECT { uint16 speed = grf_load_word(&buf); if (speed == 0xFFFF) speed = 0; @@ -318,7 +320,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x0B: /* Power */ + case 0x0B: // Power FOR_EACH_OBJECT { uint16 power = grf_load_word(&buf); @@ -329,7 +331,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x0D: /* Running cost factor */ + case 0x0D: // Running cost factor FOR_EACH_OBJECT { uint8 runcostfact = grf_load_byte(&buf); @@ -339,7 +341,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x0E: /* Running cost base */ + case 0x0E: // Running cost base FOR_EACH_OBJECT { uint32 base = grf_load_dword(&buf); @@ -347,7 +349,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf case 0x4C30: rvi[i].running_cost_class = 0; break; case 0x4C36: rvi[i].running_cost_class = 1; break; case 0x4C3C: rvi[i].running_cost_class = 2; break; - case 0: break; /* Used by wagons */ + case 0: break; // Used by wagons default: grfmsg(1, "RailVehicleChangeInfo: Unsupported running cost base 0x%04X, ignoring", base); break; @@ -355,7 +357,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x12: /* Sprite ID */ + case 0x12: // Sprite ID FOR_EACH_OBJECT { uint8 spriteid = grf_load_byte(&buf); @@ -367,7 +369,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x13: /* Dual-headed */ + case 0x13: // Dual-headed FOR_EACH_OBJECT { uint8 dual = grf_load_byte(&buf); @@ -390,11 +392,11 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x14: /* Cargo capacity */ + case 0x14: // Cargo capacity FOR_EACH_OBJECT rvi[i].capacity = grf_load_byte(&buf); break; - case 0x15: /* Cargo type */ + case 0x15: // Cargo type FOR_EACH_OBJECT { uint8 ctype = grf_load_byte(&buf); @@ -407,19 +409,19 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x16: /* Weight */ + case 0x16: // Weight FOR_EACH_OBJECT SB(rvi[i].weight, 0, 8, grf_load_byte(&buf)); break; - case 0x17: /* Cost factor */ + case 0x17: // Cost factor FOR_EACH_OBJECT rvi[i].base_cost = grf_load_byte(&buf); break; - case 0x18: /* AI rank */ + case 0x18: // AI rank FOR_EACH_OBJECT rvi[i].ai_rank = grf_load_byte(&buf); break; - case 0x19: /* Engine traction type */ + case 0x19: // Engine traction type /* What do the individual numbers mean? * 0x00 .. 0x07: Steam * 0x08 .. 0x27: Diesel @@ -449,7 +451,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x1A: /* Alter purchase list sort order */ + case 0x1A: // Alter purchase list sort order FOR_EACH_OBJECT { EngineID pos = grf_load_byte(&buf); @@ -461,40 +463,40 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x1B: /* Powered wagons power bonus */ + case 0x1B: // Powered wagons power bonus FOR_EACH_OBJECT rvi[i].pow_wag_power = grf_load_word(&buf); break; - case 0x1C: /* Refit cost */ + case 0x1C: // Refit cost FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); break; - case 0x1D: /* Refit cargo */ + case 0x1D: // Refit cargo FOR_EACH_OBJECT ei[i].refit_mask = grf_load_dword(&buf); break; - case 0x1E: /* Callback */ + case 0x1E: // Callback FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf); break; - case 0x1F: /* Tractive effort coefficient */ + case 0x1F: // Tractive effort coefficient FOR_EACH_OBJECT rvi[i].tractive_effort = grf_load_byte(&buf); break; - case 0x21: /* Shorter vehicle */ + case 0x21: // Shorter vehicle FOR_EACH_OBJECT rvi[i].shorten_factor = grf_load_byte(&buf); break; - case 0x22: /* Visual effect */ - // see note in engine.h about rvi->visual_effect + case 0x22: // Visual effect + /* see note in engine.h about rvi->visual_effect */ FOR_EACH_OBJECT rvi[i].visual_effect = grf_load_byte(&buf); break; - case 0x23: /* Powered wagons weight bonus */ + case 0x23: // Powered wagons weight bonus FOR_EACH_OBJECT rvi[i].pow_wag_weight = grf_load_byte(&buf); break; - case 0x24: /* High byte of vehicle weight */ + case 0x24: // High byte of vehicle weight FOR_EACH_OBJECT { byte weight = grf_load_byte(&buf); @@ -506,34 +508,33 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x25: /* User-defined bit mask to set when checking veh. var. 42 */ + case 0x25: // User-defined bit mask to set when checking veh. var. 42 FOR_EACH_OBJECT rvi[i].user_def_data = grf_load_byte(&buf); break; - case 0x27: /* Miscellaneous flags */ + case 0x27: // Miscellaneous flags FOR_EACH_OBJECT { ei[i].misc_flags = grf_load_byte(&buf); if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; } break; - case 0x28: /* Cargo classes allowed */ + case 0x28: // Cargo classes allowed FOR_EACH_OBJECT cargo_allowed[engine + i] = grf_load_word(&buf); break; - case 0x29: /* Cargo classes disallowed */ + case 0x29: // Cargo classes disallowed FOR_EACH_OBJECT cargo_disallowed[engine + i] = grf_load_word(&buf); break; - case 0x2A: /* Long format introduction date (days since year 0) */ + case 0x2A: // Long format introduction date (days since year 0) FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); break; - /* TODO */ - /* Fall-through for unimplemented one byte long properties. */ - case 0x20: /* Air drag */ - case 0x26: /* Retire vehicle early */ - /* TODO */ + /* @todo air drag and retire vehicle early + * Fall-through for unimplemented one byte long properties. */ + case 0x20: // Air drag + case 0x26: // Retire vehicle early FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; @@ -555,25 +556,26 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf bool ret = false; switch (prop) { - case 0x08: /* Speed (1 unit is 0.5 kmh) */ + case 0x08: // Speed (1 unit is 0.5 kmh) FOR_EACH_OBJECT rvi[i].max_speed = grf_load_byte(&buf); break; - case 0x09: /* Running cost factor */ + case 0x09: // Running cost factor FOR_EACH_OBJECT rvi[i].running_cost = grf_load_byte(&buf); break; - case 0x0A: /* Running cost base */ - /* TODO: I have no idea. --pasky */ + case 0x0A: // Running cost base + /* @todo : I have no idea. --pasky + * I THINK it is used for overriding the base cost of all road vehicle (_price.roadveh_base) --belugas */ FOR_EACH_OBJECT grf_load_dword(&buf); ret = true; break; - case 0x0E: /* Sprite ID */ + case 0x0E: // Sprite ID FOR_EACH_OBJECT { uint8 spriteid = grf_load_byte(&buf); - // cars have different custom id in the GRF file + /* cars have different custom id in the GRF file */ if (spriteid == 0xFF) spriteid = 0xFD; if (spriteid < 0xFD) spriteid >>= 1; @@ -582,11 +584,11 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x0F: /* Cargo capacity */ + case 0x0F: // Cargo capacity FOR_EACH_OBJECT rvi[i].capacity = grf_load_byte(&buf); break; - case 0x10: /* Cargo type */ + case 0x10: // Cargo type FOR_EACH_OBJECT { uint8 cargo = grf_load_byte(&buf); @@ -599,17 +601,17 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x11: /* Cost factor */ + case 0x11: // Cost factor FOR_EACH_OBJECT rvi[i].base_cost = grf_load_byte(&buf); // ?? is it base_cost? break; - case 0x12: /* SFX */ + case 0x12: // SFX FOR_EACH_OBJECT rvi[i].sfx = (SoundFx)grf_load_byte(&buf); break; - case 0x13: /* Power in 10hp */ - case 0x14: /* Weight in 1/4 tons */ - case 0x15: /* Speed in mph*0.8 */ + case 0x13: // Power in 10hp + case 0x14: // Weight in 1/4 tons + case 0x15: // Speed in mph*0.8 /* TODO: Support for road vehicles realistic power * computations (called rvpower in TTDPatch) is just * missing in OTTD yet. --pasky */ @@ -617,41 +619,41 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf ret = true; break; - case 0x16: /* Cargos available for refitting */ + case 0x16: // Cargos available for refitting FOR_EACH_OBJECT ei[i].refit_mask = grf_load_dword(&buf); break; - case 0x17: /* Callback mask */ + case 0x17: // Callback mask FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf); break; - case 0x1A: /* Refit cost */ + case 0x1A: // Refit cost FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); break; - case 0x1C: /* Miscellaneous flags */ + case 0x1C: // Miscellaneous flags FOR_EACH_OBJECT { ei[i].misc_flags = grf_load_byte(&buf); if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; } break; - case 0x1D: /* Cargo classes allowed */ + case 0x1D: // Cargo classes allowed FOR_EACH_OBJECT cargo_allowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x1E: /* Cargo classes disallowed */ + case 0x1E: // Cargo classes disallowed FOR_EACH_OBJECT cargo_disallowed[ROAD_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x1F: /* Long format introduction date (days since year 0) */ + case 0x1F: // Long format introduction date (days since year 0) FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); break; - case 0x18: /* Tractive effort */ - case 0x19: /* Air drag */ - case 0x1B: /* Retire vehicle early */ - /* TODO */ + case 0x18: // Tractive effort + case 0x19: // Air drag + case 0x1B: // Retire vehicle early + /* @todo */ FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; @@ -675,11 +677,11 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf //printf("e %x prop %x?\n", engine, prop); switch (prop) { - case 0x08: /* Sprite ID */ + case 0x08: // Sprite ID FOR_EACH_OBJECT { uint8 spriteid = grf_load_byte(&buf); - // ships have different custom id in the GRF file + /* ships have different custom id in the GRF file */ if (spriteid == 0xFF) spriteid = 0xFD; if (spriteid < 0xFD) spriteid >>= 1; @@ -688,19 +690,19 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x09: /* Refittable */ + case 0x09: // Refittable FOR_EACH_OBJECT svi[i].refittable = (grf_load_byte(&buf) != 0); break; - case 0x0A: /* Cost factor */ + case 0x0A: // Cost factor FOR_EACH_OBJECT svi[i].base_cost = grf_load_byte(&buf); // ?? is it base_cost? break; - case 0x0B: /* Speed (1 unit is 0.5 kmh) */ + case 0x0B: // Speed (1 unit is 0.5 kmh) FOR_EACH_OBJECT svi[i].max_speed = grf_load_byte(&buf); break; - case 0x0C: /* Cargo type */ + case 0x0C: // Cargo type FOR_EACH_OBJECT { uint8 cargo = grf_load_byte(&buf); @@ -713,53 +715,53 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; - case 0x0D: /* Cargo capacity */ + case 0x0D: // Cargo capacity FOR_EACH_OBJECT svi[i].capacity = grf_load_word(&buf); break; - case 0x0F: /* Running cost factor */ + case 0x0F: // Running cost factor FOR_EACH_OBJECT svi[i].running_cost = grf_load_byte(&buf); break; - case 0x10: /* SFX */ + case 0x10: // SFX FOR_EACH_OBJECT svi[i].sfx = (SoundFx)grf_load_byte(&buf); break; - case 0x11: /* Cargos available for refitting */ + case 0x11: // Cargos available for refitting FOR_EACH_OBJECT ei[i].refit_mask = grf_load_dword(&buf); break; - case 0x12: /* Callback mask */ + case 0x12: // Callback mask FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf); break; - case 0x13: /* Refit cost */ + case 0x13: // Refit cost FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); break; - case 0x17: /* Miscellaneous flags */ + case 0x17: // Miscellaneous flags FOR_EACH_OBJECT { ei[i].misc_flags = grf_load_byte(&buf); if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; } break; - case 0x18: /* Cargo classes allowed */ + case 0x18: // Cargo classes allowed FOR_EACH_OBJECT cargo_allowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x19: /* Cargo classes disallowed */ + case 0x19: // Cargo classes disallowed FOR_EACH_OBJECT cargo_disallowed[SHIP_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x1A: /* Long format introduction date (days since year 0) */ + case 0x1A: // Long format introduction date (days since year 0) FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); break; - case 0x14: /* Ocean speed fraction */ - case 0x15: /* Canal speed fraction */ - case 0x16: /* Retire vehicle early */ - /* TODO */ + case 0x14: // Ocean speed fraction + case 0x15: // Canal speed fraction + case 0x16: // Retire vehicle early + /* @todo */ FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; @@ -783,11 +785,11 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * //printf("e %x prop %x?\n", engine, prop); switch (prop) { - case 0x08: /* Sprite ID */ + case 0x08: // Sprite ID FOR_EACH_OBJECT { uint8 spriteid = grf_load_byte(&buf); - // aircraft have different custom id in the GRF file + /* aircraft have different custom id in the GRF file */ if (spriteid == 0xFF) spriteid = 0xFD; if (spriteid < 0xFD) spriteid >>= 1; @@ -796,7 +798,7 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * } break; - case 0x09: /* Helicopter */ + case 0x09: // Helicopter FOR_EACH_OBJECT { if (grf_load_byte(&buf) == 0) { avi[i].subtype = AIR_HELI; @@ -806,71 +808,71 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte * } break; - case 0x0A: /* Large */ + case 0x0A: // Large FOR_EACH_OBJECT SB(avi[i].subtype, 1, 1, (grf_load_byte(&buf) != 0 ? 1 : 0)); // AIR_FAST break; - case 0x0B: /* Cost factor */ + case 0x0B: // Cost factor FOR_EACH_OBJECT avi[i].base_cost = grf_load_byte(&buf); // ?? is it base_cost? break; - case 0x0C: /* Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h) */ + case 0x0C: // Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h) FOR_EACH_OBJECT avi[i].max_speed = (grf_load_byte(&buf) * 129) / 10; break; - case 0x0D: /* Acceleration */ + case 0x0D: // Acceleration FOR_EACH_OBJECT avi[i].acceleration = (grf_load_byte(&buf) * 129) / 10; break; - case 0x0E: /* Running cost factor */ + case 0x0E: // Running cost factor FOR_EACH_OBJECT avi[i].running_cost = grf_load_byte(&buf); break; - case 0x0F: /* Passenger capacity */ + case 0x0F: // Passenger capacity FOR_EACH_OBJECT avi[i].passenger_capacity = grf_load_word(&buf); break; - case 0x11: /* Mail capacity */ + case 0x11: // Mail capacity FOR_EACH_OBJECT avi[i].mail_capacity = grf_load_byte(&buf); break; - case 0x12: /* SFX */ + case 0x12: // SFX FOR_EACH_OBJECT avi[i].sfx = (SoundFx)grf_load_byte(&buf); break; - case 0x13: /* Cargos available for refitting */ + case 0x13: // Cargos available for refitting FOR_EACH_OBJECT ei[i].refit_mask = grf_load_dword(&buf); break; - case 0x14: /* Callback mask */ + case 0x14: // Callback mask FOR_EACH_OBJECT ei[i].callbackmask = grf_load_byte(&buf); break; - case 0x15: /* Refit cost */ + case 0x15: // Refit cost FOR_EACH_OBJECT ei[i].refit_cost = grf_load_byte(&buf); break; - case 0x17: /* Miscellaneous flags */ + case 0x17: // Miscellaneous flags FOR_EACH_OBJECT { ei[i].misc_flags = grf_load_byte(&buf); if (HASBIT(ei[i].misc_flags, EF_USES_2CC)) _have_2cc = true; } break; - case 0x18: /* Cargo classes allowed */ + case 0x18: // Cargo classes allowed FOR_EACH_OBJECT cargo_allowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x19: /* Cargo classes disallowed */ + case 0x19: // Cargo classes disallowed FOR_EACH_OBJECT cargo_disallowed[AIRCRAFT_ENGINES_INDEX + engine + i] = grf_load_word(&buf); break; - case 0x1A: /* Long format introduction date (days since year 0) */ + case 0x1A: // Long format introduction date (days since year 0) FOR_EACH_OBJECT ei[i].base_intro = grf_load_dword(&buf); break; - case 0x16: /* Retire vehicle early */ - /* TODO */ + case 0x16: // Retire vehicle early + /* @todo */ FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; @@ -912,7 +914,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } switch (prop) { - case 0x08: /* Class ID */ + case 0x08: // Class ID FOR_EACH_OBJECT { /* Property 0x08 is special; it is where the station is allocated */ if (statspec[i] == NULL) statspec[i] = CallocT<StationSpec>(1); @@ -923,7 +925,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } break; - case 0x09: /* Define sprite layout */ + case 0x09: // Define sprite layout FOR_EACH_OBJECT { StationSpec *statspec = _cur_grffile->stations[stid + i]; @@ -947,7 +949,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int while (buf < *bufp + len) { DrawTileSeqStruct *dtss; - // no relative bounding box support + /* no relative bounding box support */ dts->seq = ReallocT((DrawTileSeqStruct*)dts->seq, ++seq_count); dtss = (DrawTileSeqStruct*) &dts->seq[seq_count - 1]; @@ -980,7 +982,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } break; - case 0x0A: /* Copy sprite layout */ + case 0x0A: // Copy sprite layout FOR_EACH_OBJECT { StationSpec *statspec = _cur_grffile->stations[stid + i]; byte srcid = grf_load_byte(&buf); @@ -992,19 +994,19 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } break; - case 0x0B: /* Callback mask */ + case 0x0B: // Callback mask FOR_EACH_OBJECT statspec[i]->callbackmask = grf_load_byte(&buf); break; - case 0x0C: /* Disallowed number of platforms */ + case 0x0C: // Disallowed number of platforms FOR_EACH_OBJECT statspec[i]->disallowed_platforms = grf_load_byte(&buf); break; - case 0x0D: /* Disallowed platform lengths */ + case 0x0D: // Disallowed platform lengths FOR_EACH_OBJECT statspec[i]->disallowed_lengths = grf_load_byte(&buf); break; - case 0x0E: /* Define custom layout */ + case 0x0E: // Define custom layout FOR_EACH_OBJECT { StationSpec *statspec = _cur_grffile->stations[stid + i]; @@ -1034,7 +1036,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int //debug("p %d > %d ?", number, stat->platforms[l]); if (number > statspec->platforms[l]) { statspec->layouts[l] = ReallocT(statspec->layouts[l], number); - // We expect NULL being 0 here, but C99 guarantees that. + /* We expect NULL being 0 here, but C99 guarantees that. */ memset(statspec->layouts[l] + statspec->platforms[l], 0, (number - statspec->platforms[l]) * sizeof(**statspec->layouts)); @@ -1057,7 +1059,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } break; - case 0x0F: /* Copy custom layout */ + case 0x0F: // Copy custom layout FOR_EACH_OBJECT { StationSpec *statspec = _cur_grffile->stations[stid + i]; byte srcid = grf_load_byte(&buf); @@ -1070,41 +1072,41 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int } break; - case 0x10: /* Little/lots cargo threshold */ + case 0x10: // Little/lots cargo threshold FOR_EACH_OBJECT statspec[i]->cargo_threshold = grf_load_word(&buf); break; - case 0x11: /* Pylon placement */ + case 0x11: // Pylon placement FOR_EACH_OBJECT statspec[i]->pylons = grf_load_byte(&buf); break; - case 0x12: /* Cargo types for random triggers */ + case 0x12: // Cargo types for random triggers FOR_EACH_OBJECT statspec[i]->cargo_triggers = grf_load_dword(&buf); break; - case 0x13: /* General flags */ + case 0x13: // General flags FOR_EACH_OBJECT statspec[i]->flags = grf_load_byte(&buf); break; - case 0x14: /* Overhead wire placement */ + case 0x14: // Overhead wire placement FOR_EACH_OBJECT statspec[i]->wires = grf_load_byte(&buf); break; - case 0x15: /* Blocked tiles */ + case 0x15: // Blocked tiles FOR_EACH_OBJECT statspec[i]->blocked = grf_load_byte(&buf); break; - case 0x16: /* TODO Animation info */ + case 0x16: // @todo Animation info FOR_EACH_OBJECT grf_load_word(&buf); ret = true; break; - case 0x17: /* TODO Animation speed */ + case 0x17: // @todo Animation speed FOR_EACH_OBJECT grf_load_byte(&buf); ret = true; break; - case 0x18: /* TODO Animation triggers */ + case 0x18: // @todo Animation triggers FOR_EACH_OBJECT grf_load_word(&buf); ret = true; break; @@ -1125,27 +1127,27 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int bool ret = false; switch (prop) { - case 0x08: /* Year of availability */ + case 0x08: // Year of availability FOR_EACH_OBJECT _bridge[brid + i].avail_year = ORIGINAL_BASE_YEAR + grf_load_byte(&buf); break; - case 0x09: /* Minimum length */ + case 0x09: // Minimum length FOR_EACH_OBJECT _bridge[brid + i].min_length = grf_load_byte(&buf); break; - case 0x0A: /* Maximum length */ + case 0x0A: // Maximum length FOR_EACH_OBJECT _bridge[brid + i].max_length = grf_load_byte(&buf); break; - case 0x0B: /* Cost factor */ + case 0x0B: // Cost factor FOR_EACH_OBJECT _bridge[brid + i].price = grf_load_byte(&buf); break; - case 0x0C: /* Maximum speed */ + case 0x0C: // Maximum speed FOR_EACH_OBJECT _bridge[brid + i].speed = grf_load_word(&buf); break; - case 0x0D: /* Bridge sprite tables */ + case 0x0D: // Bridge sprite tables FOR_EACH_OBJECT { Bridge *bridge = &_bridge[brid + i]; byte tableid = grf_load_byte(&buf); @@ -1185,11 +1187,11 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int } break; - case 0x0E: /* Flags; bit 0 - disable far pillars */ + case 0x0E: // Flags; bit 0 - disable far pillars FOR_EACH_OBJECT _bridge[brid + i].flags = grf_load_byte(&buf); break; - case 0x0F: /* Long format year of availability (year since year 0) */ + case 0x0F: // Long format year of availability (year since year 0) FOR_EACH_OBJECT _bridge[brid + i].avail_year = clamp(grf_load_dword(&buf), MIN_YEAR, MAX_YEAR); break; @@ -1547,7 +1549,7 @@ static bool SoundEffectChangeInfo(uint sid, int numinfo, int prop, byte **bufp, } switch (prop) { - case 0x08: /* Relative volume */ + case 0x08: // Relative volume FOR_EACH_OBJECT { uint sound = sid + i + _cur_grffile->sound_offset - GetNumOriginalSounds(); @@ -1559,7 +1561,7 @@ static bool SoundEffectChangeInfo(uint sid, int numinfo, int prop, byte **bufp, } break; - case 0x09: /* Priority */ + case 0x09: // Priority FOR_EACH_OBJECT { uint sound = sid + i + _cur_grffile->sound_offset - GetNumOriginalSounds(); @@ -1571,7 +1573,7 @@ static bool SoundEffectChangeInfo(uint sid, int numinfo, int prop, byte **bufp, } break; - case 0x0A: /* Override old sound */ + case 0x0A: // Override old sound FOR_EACH_OBJECT { uint sound = sid + i + _cur_grffile->sound_offset - GetNumOriginalSounds(); uint orig_sound = grf_load_byte(&buf); @@ -1672,27 +1674,27 @@ static void FeatureChangeInfo(byte *buf, int len) case GSF_AIRCRAFT: /* Common properties for vehicles */ switch (prop) { - case 0x00: /* Introduction date */ + case 0x00: // Introduction date FOR_EACH_OBJECT ei[i].base_intro = grf_load_word(&buf) + DAYS_TILL_ORIGINAL_BASE_YEAR; break; - case 0x02: /* Decay speed */ + case 0x02: // Decay speed FOR_EACH_OBJECT SB(ei[i].unk2, 0, 7, grf_load_byte(&buf) & 0x7F); break; - case 0x03: /* Vehicle life */ + case 0x03: // Vehicle life FOR_EACH_OBJECT ei[i].lifelength = grf_load_byte(&buf); break; - case 0x04: /* Model life */ + case 0x04: // Model life FOR_EACH_OBJECT ei[i].base_life = grf_load_byte(&buf); break; - case 0x06: /* Climates available */ + case 0x06: // Climates available FOR_EACH_OBJECT ei[i].climates = grf_load_byte(&buf); break; - case 0x07: /* Loading speed */ + case 0x07: // Loading speed /* Hyronymus explained me what does * this mean and insists on having a * credit ;-). --pasky */ @@ -1769,7 +1771,7 @@ static void InitChangeInfo(byte *buf, int len) switch (feature) { case GSF_GLOBALVAR: switch (prop) { - case 0x09: /* Cargo Translation Table */ + case 0x09: // Cargo Translation Table if (index != 0) { grfmsg(1, "InitChangeInfo: Cargo translation table must start at zero"); return; @@ -1804,8 +1806,8 @@ static const SpriteGroup* NewCallBackResultSpriteGroup(uint16 value) group->type = SGT_CALLBACK; - // Old style callback results have the highest byte 0xFF so signify it is a callback result - // New style ones only have the highest bit set (allows 15-bit results, instead of just 8) + /* Old style callback results have the highest byte 0xFF so signify it is a callback result + * New style ones only have the highest bit set (allows 15-bit results, instead of just 8) */ if ((value >> 8) == 0xFF) { value &= ~0xFF00; } else { @@ -1936,9 +1938,9 @@ static void NewSpriteGroup(byte *buf, int len) uint8 type = grf_load_byte(&buf); if (setid >= _cur_grffile->spritegroups_count) { - // Allocate memory for new sprite group references. + /* Allocate memory for new sprite group references. */ _cur_grffile->spritegroups = ReallocT(_cur_grffile->spritegroups, setid + 1); - // Initialise new space to NULL + /* Initialise new space to NULL */ for (; _cur_grffile->spritegroups_count < (setid + 1); _cur_grffile->spritegroups_count++) _cur_grffile->spritegroups[_cur_grffile->spritegroups_count] = NULL; } @@ -2269,7 +2271,7 @@ static void FeatureMapSpriteGroup(byte *buf, int len) if (feature == GSF_STATION) { - // We do things differently for stations. + /* We do things differently for stations. */ for (uint i = 0; i < idcount; i++) { uint8 stid = buf[3 + i]; @@ -2338,9 +2340,9 @@ static void FeatureMapSpriteGroup(byte *buf, int len) return; } - // FIXME: Tropicset contains things like: - // 03 00 01 19 01 00 00 00 00 - this is missing one 00 at the end, - // what should we exactly do with that? --pasky + /* FIXME: Tropicset contains things like: + * 03 00 01 19 01 00 00 00 00 - this is missing one 00 at the end, + * what should we exactly do with that? --pasky */ if (_cur_grffile->spriteset_start == 0 || _cur_grffile->spritegroups == 0) { grfmsg(1, "FeatureMapSpriteGroup: No sprite set to work on! Skipping"); @@ -2406,7 +2408,7 @@ static void FeatureMapSpriteGroup(byte *buf, int len) for (uint i = 0; i < idcount; i++) { uint8 engine = buf[3 + i] + _vehshifts[feature]; - // Don't tell me you don't love duplicated code! + /* Don't tell me you don't love duplicated code! */ if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) { grfmsg(1, "FeatureMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping", groupid, _cur_grffile->spritegroups_count); return; @@ -2418,7 +2420,7 @@ static void FeatureMapSpriteGroup(byte *buf, int len) if (feature == GSF_AIRCRAFT && engine == last_engines[i]) { SetRotorOverrideSprites(engine, _cur_grffile->spritegroups[groupid]); } else { - // TODO: No multiple cargo types per vehicle yet. --pasky + /* TODO: No multiple cargo types per vehicle yet. --pasky */ SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count); } } else { @@ -2501,7 +2503,7 @@ static void FeatureNewName(byte *buf, int len) case GSF_TOWNHOUSE: default: switch (GB(id, 8, 8)) { - case 0xC4: /* Station class name */ + case 0xC4: // Station class name if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); } else { @@ -2510,7 +2512,7 @@ static void FeatureNewName(byte *buf, int len) } break; - case 0xC5: /* Station name */ + case 0xC5: // Station name if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) { grfmsg(1, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring", GB(id, 0, 8)); } else { @@ -2518,7 +2520,7 @@ static void FeatureNewName(byte *buf, int len) } break; - case 0xC9: { /* House name */ + case 0xC9: { // House name if (_cur_grffile->housespec == NULL || _cur_grffile->housespec[GB(id, 0, 8)] == NULL) { grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8)); } else { @@ -2543,14 +2545,14 @@ static void FeatureNewName(byte *buf, int len) case GSF_BRIDGE : AddGRFString(_cur_spriteid, id, lang, name); switch (GB(id, 8,8)) { - case 0xC9: /* House name */ + case 0xC9: // House name default: grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id); } break; case GSF_INDUSTRIES : - case 0x48 : /* for generic strings */ + case 0x48 : // for generic strings AddGRFString(_cur_spriteid, id, lang, name); break; default : @@ -2580,7 +2582,7 @@ static void GraphicsNew(byte *buf, int len) uint16 num = grf_load_extended(&buf); switch (type) { - case 0x04: /* Signal graphics */ + case 0x04: // Signal graphics if (num != 112 && num != 240) { grfmsg(1, "GraphicsNews: Signal graphics sprite count must be 112 or 240, skipping"); return; @@ -2588,7 +2590,7 @@ static void GraphicsNew(byte *buf, int len) _signal_base = _cur_spriteid; break; - case 0x05: /* Catenary graphics */ + case 0x05: // Catenary graphics if (num != 48) { grfmsg(1, "GraphicsNews: Catenary graphics sprite count must be 48, skipping"); return; @@ -2596,7 +2598,7 @@ static void GraphicsNew(byte *buf, int len) replace = SPR_ELRAIL_BASE + 3; break; - case 0x06: /* Foundations */ + case 0x06: // Foundations if (num != 74) { grfmsg(1, "GraphicsNews: Foundation graphics sprite count must be 74, skipping"); return; @@ -2604,7 +2606,7 @@ static void GraphicsNew(byte *buf, int len) replace = SPR_SLOPES_BASE; break; - case 0x08: /* Canal graphics */ + case 0x08: // Canal graphics if (num != 65) { grfmsg(1, "GraphicsNews: Canal graphics sprite count must be 65, skipping"); return; @@ -2612,7 +2614,7 @@ static void GraphicsNew(byte *buf, int len) replace = SPR_CANALS_BASE + 5; break; - case 0x0D: /* Coast graphics */ + case 0x0D: // Coast graphics if (num != 16) { grfmsg(1, "GraphicsNews: Coast graphics sprite count must be 16, skipping"); return; @@ -2641,16 +2643,16 @@ static void GraphicsNew(byte *buf, int len) static uint32 GetParamVal(byte param, uint32 *cond_val) { switch (param) { - case 0x81: /* current year */ + case 0x81: // current year return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; - case 0x83: /* current climate, 0=temp, 1=arctic, 2=trop, 3=toyland */ + case 0x83: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland return _opt.landscape; - case 0x84: /* GRF loading stage */ + case 0x84: // GRF loading stage return (_cur_stage > GLS_INIT) | ((_cur_stage == GLS_ACTIVATION) << 9); - case 0x85: /* TTDPatch flags, only for bit tests */ + case 0x85: // TTDPatch flags, only for bit tests if (cond_val == NULL) { /* Supported in Action 0x07 and 0x09, not 0x0D */ return 0; @@ -2660,13 +2662,13 @@ static uint32 GetParamVal(byte param, uint32 *cond_val) return param_val; } - case 0x86: /* road traffic side, bit 4 clear=left, set=right */ + case 0x86: // road traffic side, bit 4 clear=left, set=right return _opt.road_side << 4; - case 0x88: /* GRF ID check */ + case 0x88: // GRF ID check return 0; - case 0x8B: { /* TTDPatch version */ + case 0x8B: { // TTDPatch version uint major = 2; uint minor = 6; uint revision = 0; // special case: 2.0.1 is 2.0.10 @@ -2674,22 +2676,22 @@ static uint32 GetParamVal(byte param, uint32 *cond_val) return (major << 24) | (minor << 20) | (revision << 16) | build; } - case 0x8D: /* TTD Version, 00=DOS, 01=Windows */ + case 0x8D: // TTD Version, 00=DOS, 01=Windows return !_use_dos_palette; - case 0x8E: /* Y-offset for train sprites */ + case 0x8E: // Y-offset for train sprites return _traininfo_vehicle_pitch; - case 0x92: /* Game mode */ + case 0x92: // Game mode return _game_mode; - case 0x9A: /* Always -1 */ + case 0x9A: // Always -1 return UINT_MAX; - case 0x9D: /* TTD Platform, 00=TTDPatch, 01=OpenTTD */ + case 0x9D: // TTD Platform, 00=TTDPatch, 01=OpenTTD return 1; - case 0x9E: /* Miscellaneous GRF features */ + case 0x9E: // Miscellaneous GRF features return _misc_grf_features; default: @@ -2837,23 +2839,23 @@ static void SkipIf(byte *buf, int len) switch (condtype) { /* Tests 6 to 10 are only for param 0x88, GRFID checks */ - case 6: /* Is GRFID active? */ + case 6: // Is GRFID active? result = c->status == GCS_ACTIVATED; break; - case 7: /* Is GRFID non-active? */ + case 7: // Is GRFID non-active? result = c->status != GCS_ACTIVATED; break; - case 8: /* GRFID is not but will be active? */ + case 8: // GRFID is not but will be active? result = c->status == GCS_INITIALISED; break; - case 9: /* GRFID is or will be active? */ + case 9: // GRFID is or will be active? result = c->status == GCS_ACTIVATED || c->status == GCS_INITIALISED; break; - case 10: /* GRFID is not nor will be active */ + case 10: // GRFID is not nor will be active /* This is the only condtype that doesn't get ignored if the GRFID is not found */ result = c == NULL || c->flags == GCS_DISABLED || c->status == GCS_NOT_FOUND; break; @@ -2987,7 +2989,7 @@ static void SpriteReplace(byte *buf, int len) * B num-sprites How many sprites are in this set * W first-sprite First sprite number to replace */ - buf++; /* skip action byte */ + buf++; // skip action byte uint8 num_sets = grf_load_byte(&buf); for (uint i = 0; i < num_sets; i++) { @@ -3053,7 +3055,7 @@ static void GRFLoadError(byte *buf, int len) /* For now we can only show one message per newgrf file. */ if (_cur_grfconfig->error != NULL) return; - buf++; /* Skip the action byte. */ + buf++; // Skip the action byte. byte severity = grf_load_byte(&buf); byte lang = grf_load_byte(&buf); byte message_id = grf_load_byte(&buf); @@ -3223,10 +3225,10 @@ static void ParamSet(byte *buf, int len) uint16 count = GB(data, 16, 16); switch (feature) { - case 0x00: /* Trains */ - case 0x01: /* Road Vehicles */ - case 0x02: /* Ships */ - case 0x03: /* Aircraft */ + case 0x00: // Trains + case 0x01: // Road Vehicles + case 0x02: // Ships + case 0x03: // Aircraft { uint start = 0; uint size = 0; @@ -3277,7 +3279,7 @@ static void ParamSet(byte *buf, int len) break; } - case 0x08: /* General sprites */ + case 0x08: // General sprites switch (op) { case 0: /* Check if the allocated sprites will fit below the original sprite limit */ @@ -3371,15 +3373,15 @@ static void ParamSet(byte *buf, int len) } break; - case 0x07: /* Bitwise AND */ + case 0x07: // Bitwise AND res = src1 & src2; break; - case 0x08: /* Bitwise OR */ + case 0x08: // Bitwise OR res = src1 | src2; break; - case 0x09: /* Unsigned division */ + case 0x09: // Unsigned division if (src2 == 0) { res = src1; } else { @@ -3387,7 +3389,7 @@ static void ParamSet(byte *buf, int len) } break; - case 0x0A: /* Signed divison */ + case 0x0A: // Signed divison if (src2 == 0) { res = src1; } else { @@ -3395,7 +3397,7 @@ static void ParamSet(byte *buf, int len) } break; - case 0x0B: /* Unsigned modulo */ + case 0x0B: // Unsigned modulo if (src2 == 0) { res = src1; } else { @@ -3403,7 +3405,7 @@ static void ParamSet(byte *buf, int len) } break; - case 0x0C: /* Signed modulo */ + case 0x0C: // Signed modulo if (src2 == 0) { res = src1; } else { @@ -3419,7 +3421,7 @@ static void ParamSet(byte *buf, int len) _traininfo_vehicle_pitch = res; break; - // TODO implement + /* @todo implement */ case 0x8F: // Rail track type cost factors case 0x93: // Tile refresh offset to left case 0x94: // Tile refresh offset to right @@ -3430,7 +3432,7 @@ static void ParamSet(byte *buf, int len) grfmsg(7, "ParamSet: Skipping unimplemented target 0x%02X", target); break; - case 0x9E: /* Miscellaneous GRF features */ + case 0x9E: // Miscellaneous GRF features _misc_grf_features = res; /* Set train list engine width */ _traininfo_vehicle_width = HASBIT(res, 3) ? 32 : 29; @@ -3624,7 +3626,7 @@ static void LoadGRFSound(byte *buf, int len) uint32 size = grf_load_dword(&buf); switch (tag) { - case ' tmf': /* 'fmt ' */ + case ' tmf': // 'fmt ' /* Audio format, must be 1 (PCM) */ if (grf_load_word(&buf) != 1) { grfmsg(1, "LoadGRFSound: Invalid audio format"); @@ -3640,7 +3642,7 @@ static void LoadGRFSound(byte *buf, int len) for (; size > 16; size--) grf_load_byte(&buf); break; - case 'atad': /* 'data' */ + case 'atad': // 'data' se->file_size = size; se->file_offset = FioGetPos() - (len - (buf - buf_start)) + 1; se->file_offset |= _file_index << 24; @@ -3945,15 +3947,15 @@ static void ResetNewGRFData() { CleanUpStrings(); - // Copy/reset original engine info data + /* Copy/reset original engine info data */ memcpy(&_engine_info, &orig_engine_info, sizeof(orig_engine_info)); memcpy(&_rail_vehicle_info, &orig_rail_vehicle_info, sizeof(orig_rail_vehicle_info)); memcpy(&_ship_vehicle_info, &orig_ship_vehicle_info, sizeof(orig_ship_vehicle_info)); memcpy(&_aircraft_vehicle_info, &orig_aircraft_vehicle_info, sizeof(orig_aircraft_vehicle_info)); memcpy(&_road_vehicle_info, &orig_road_vehicle_info, sizeof(orig_road_vehicle_info)); - // Copy/reset original bridge info data - // First, free sprite table data + /* Copy/reset original bridge info data + * First, free sprite table data */ for (uint i = 0; i < MAX_BRIDGES; i++) { if (_bridge[i].sprite_table != NULL) { for (uint j = 0; j < 7; j++) free(_bridge[i].sprite_table[j]); @@ -3962,21 +3964,21 @@ static void ResetNewGRFData() } memcpy(&_bridge, &orig_bridge, sizeof(_bridge)); - // Reset refit/cargo class data + /* Reset refit/cargo class data /* memset(&cargo_allowed, 0, sizeof(cargo_allowed)); memset(&cargo_disallowed, 0, sizeof(cargo_disallowed)); - // Reset GRM reservations + /* Reset GRM reservations */ memset(&_grm_engines, 0, sizeof(_grm_engines)); - // Unload sprite group data + /* Unload sprite group data */ UnloadWagonOverrides(); UnloadRotorOverrideSprites(); UnloadCustomEngineSprites(); UnloadCustomEngineNames(); ResetEngineListOrder(); - // Reset price base data + /* Reset price base data */ ResetPriceBaseMultipliers(); /* Reset the curencies array */ @@ -3986,7 +3988,7 @@ static void ResetNewGRFData() ResetCustomHouses(); ResetHouses(); - // Reset station classes + /* Reset station classes */ ResetStationClasses(); ResetCustomStations(); @@ -3996,7 +3998,7 @@ static void ResetNewGRFData() /* Reset NewGRF files */ ResetNewGRF(); - // Add engine type to engine data. This is needed for the refit precalculation. + /* Add engine type to engine data. This is needed for the refit precalculation. */ AddTypeToEngines(); /* Set up the default cargo types */ @@ -4164,14 +4166,14 @@ static void CalculateRefitMasks() } if (cargo_allowed[engine] != 0) { - // Build up the list of cargo types from the set cargo classes. + /* Build up the list of cargo types from the set cargo classes. */ for (CargoID i = 0; i < NUM_CARGO; i++) { const CargoSpec *cs = GetCargo(i); if (cargo_allowed[engine] & cs->classes) SETBIT(mask, i); if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, i); } } else { - // Don't apply default refit mask to wagons or engines with no capacity + /* Don't apply default refit mask to wagons or engines with no capacity */ if (xor_mask == 0 && ( GetEngine(engine)->type != VEH_TRAIN || ( RailVehInfo(engine)->capacity != 0 && @@ -4447,7 +4449,7 @@ void LoadNewGRF(uint load_index, uint file_index) for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) { if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue; - // TODO usererror() + /* @todo usererror() */ if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename); if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid); diff --git a/src/newgrf.h b/src/newgrf.h index e9e5418b0..554a6677b 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf.h */ + #ifndef NEWGRF_H #define NEWGRF_H @@ -60,7 +62,7 @@ struct GRFFile { HouseSpec **housespec; uint32 param[0x80]; - uint param_end; /// one more than the highest set parameter + uint param_end; ///< one more than the highest set parameter GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array. @@ -78,7 +80,7 @@ extern bool _have_newhouses; void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage); void LoadNewGRF(uint load_index, uint file_index); -void ReloadNewGRFData(); // in openttd.c +void ReloadNewGRFData(); // in openttd.cpp void CDECL grfmsg(int severity, const char *str, ...); diff --git a/src/newgrf_cargo.h b/src/newgrf_cargo.h index 67acf35bd..2711d1352 100644 --- a/src/newgrf_cargo.h +++ b/src/newgrf_cargo.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_cargo.h */ + #ifndef NEWGRF_CARGO_H #define NEWGRF_CARGO_H diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 12f072889..f03340601 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgfr_config.cpp */ + #include "stdafx.h" #include "openttd.h" #include "functions.h" @@ -481,3 +483,4 @@ extern const ChunkHandler _newgrf_chunk_handlers[] = { }; + diff --git a/src/newgrf_config.h b/src/newgrf_config.h index 26246594f..a3ed63ec5 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_config.h */ + #ifndef NEWGRF_CONFIG_H #define NEWGRF_CONFIG_H @@ -80,7 +82,7 @@ GRFListCompatibility IsGoodGRFConfigList(); bool FillGRFDetails(GRFConfig *config, bool is_static); char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last); -/* In newgrf_gui.c */ +/* In newgrf_gui.cpp */ void ShowNewGRFSettings(bool editable, bool show_params, bool exec_changes, GRFConfig **config); #ifdef ENABLE_NETWORK diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 71fefdbb5..6fd836631 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_engine.cpp */ + #include "stdafx.h" #include "openttd.h" #include "variables.h" @@ -66,10 +68,10 @@ static const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID car const WagonOverrides *wos = &_engine_wagon_overrides[engine]; int i; - // XXX: This could turn out to be a timesink on profiles. We could - // always just dedicate 65535 bytes for an [engine][train] trampoline - // for O(1). Or O(logMlogN) and searching binary tree or smt. like - // that. --pasky + /* XXX: This could turn out to be a timesink on profiles. We could + * always just dedicate 65535 bytes for an [engine][train] trampoline + * for O(1). Or O(logMlogN) and searching binary tree or smt. like + * that. --pasky */ for (i = 0; i < wos->overrides_count; i++) { const WagonOverride *wo = &wos->overrides[i]; @@ -260,11 +262,11 @@ static byte MapAircraftMovementState(const Vehicle *v) * to a landing by the hanger of an international airport. */ if (amdflag & AMED_SLOWTURN) return AMS_TTDP_FLIGHT_TO_TOWER; - // The final two conditions apply to helicopters or aircraft. - /* Has reached hanger? */ + /* The final two conditions apply to helicopters or aircraft. + * Has reached hanger? */ if (amdflag & AMED_EXACTPOS) return AMS_TTDP_HANGAR; - // Still moving towards hanger. + /* Still moving towards hanger. */ return AMS_TTDP_TO_HANGAR; case TERM1: @@ -318,7 +320,7 @@ static byte MapAircraftMovementState(const Vehicle *v) case ENDLANDING: // On the runway braking if (amdflag & AMED_BRAKE) return AMS_TTDP_BRAKING; - // Landed - moving off runway + /* Landed - moving off runway */ return AMS_TTDP_TO_INWAY; case HELILANDING: @@ -393,7 +395,7 @@ static byte MapAircraftMovementAction(const Vehicle *v) case STARTTAKEOFF: // Accelerating down runway case ENDTAKEOFF: // Ascent case HELITAKEOFF: - // TODO Need to find which terminal (or hanger) we've come from. How? + /* @todo Need to find which terminal (or hanger) we've come from. How? */ return AMA_TTDP_PAD1_TO_TAKEOFF; case FLYING: @@ -403,7 +405,7 @@ static byte MapAircraftMovementAction(const Vehicle *v) case ENDLANDING: // On the runway braking case HELILANDING: case HELIENDLANDING: - // TODO Need to check terminal we're landing to. Is it known yet? + /* @todo Need to check terminal we're landing to. Is it known yet? */ return (v->current_order.type == OT_GOTO_DEPOT) ? AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1; @@ -473,12 +475,12 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by if (v == NULL) { /* Vehicle does not exist, so we're in a purchase list */ switch (variable) { - case 0x43: return _current_player; /* Owner information */ - case 0x46: return 0; /* Motion counter */ - case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; /* Vehicle Type Info */ - case 0xC4: return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; /* Build year */ - case 0xDA: return INVALID_VEHICLE; /* Next vehicle */ - case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); /* Read GRF parameter */ + case 0x43: return _current_player; // Owner information + case 0x46: return 0; // Motion counter + case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; // Vehicle Type Info + case 0xC4: return clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; // Build year + case 0xDA: return INVALID_VEHICLE; // Next vehicle + case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); // Read GRF parameter } *available = false; @@ -487,8 +489,8 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by /* Calculated vehicle parameters */ switch (variable) { - case 0x40: /* Get length of consist */ - case 0x41: /* Get length of same consecutive wagons */ + case 0x40: // Get length of consist + case 0x41: // Get length of same consecutive wagons if (v->type != VEH_TRAIN) return 1; { @@ -509,7 +511,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return chain_before | chain_after << 8 | (chain_before + chain_after + (variable == 0x41)) << 16; } - case 0x42: { /* Consist cargo information */ + case 0x42: { // Consist cargo information /* XXX Missing support for common refit cycle and property 25 */ const Vehicle *u; byte cargo_classes = 0; @@ -541,15 +543,15 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return cargo_classes | (common_cargo_type << 8) | (user_def_data << 24); } - case 0x43: /* Player information */ + case 0x43: // Player information return v->owner; - case 0x44: /* Aircraft information */ + case 0x44: // Aircraft information if (v->type != VEH_AIRCRAFT) return UINT_MAX; { const Vehicle *w = v->next; - uint16 altitude = v->z_pos - w->z_pos; /* Aircraft height - shadow height */ + uint16 altitude = v->z_pos - w->z_pos; // Aircraft height - shadow height byte airporttype; switch (GetStation(v->u.air.targetairport)->airport_type) { @@ -571,10 +573,10 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return (altitude << 8) | airporttype; } - case 0x46: /* Motion counter */ + case 0x46: // Motion counter return v->motion_counter; - case 0x47: { /* Vehicle cargo info */ + case 0x47: { // Vehicle cargo info /* Format: ccccwwtt * tt - the cargo type transported by the vehicle, * translated if a translation table has been installed. @@ -586,10 +588,10 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return (cs->classes << 16) | (cs->weight << 8) | GetEngineGRF(v->engine_type)->cargo_map[v->cargo_type]; } - case 0x48: return GetEngine(v->engine_type)->flags; /* Vehicle Type Info */ + case 0x48: return GetEngine(v->engine_type)->flags; // Vehicle Type Info /* Variables which use the parameter */ - case 0x60: /* Count consist's engine ID occurance */ + case 0x60: // Count consist's engine ID occurance if (v->type != VEH_TRAIN) return v->engine_type == parameter; { @@ -600,13 +602,13 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by return count; } - case 0x7F: return GetGRFParameter(v->engine_type, parameter); /* Read GRF parameter */ + case 0x7F: return GetGRFParameter(v->engine_type, parameter); // Read GRF parameter case 0xFE: case 0xFF: { uint16 modflags = 0; - /* TODO: There are some other bits that should be implemented: + /* @todo: There are some other bits that should be implemented: * bit 5: Whether the rail vehicle is powered or not (mostly useful for wagons). * bit 6: This is an electrically powered rail vehicle which is running on normal rail. * bit 8: (Maybe?) Toggled whenever the train reverses. @@ -992,7 +994,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_rando void TriggerVehicle(Vehicle *v, VehicleTrigger trigger) { if (trigger == VEHICLE_TRIGGER_DEPOT) { - // store that the vehicle entered a depot this tick + /* store that the vehicle entered a depot this tick */ VehicleEnteredDepotThisTick(v); } @@ -1020,8 +1022,8 @@ StringID GetCustomEngineName(EngineID engine) return _engine_custom_names[engine] == 0 ? _engine_name_strings[engine] : _engine_custom_names[engine]; } -// Functions for changing the order of vehicle purchase lists -// This is currently only implemented for rail vehicles. +/* Functions for changing the order of vehicle purchase lists + * This is currently only implemented for rail vehicles. */ static EngineID _engine_list_order[NUM_TRAIN_ENGINES]; static byte _engine_list_position[NUM_TRAIN_ENGINES]; @@ -1066,13 +1068,13 @@ void AlterRailVehListOrder(EngineID engine, EngineID target) if (engine == target) return; - // First, remove our ID from the list. + /* First, remove our ID from the list. */ for (i = 0; i < NUM_TRAIN_ENGINES - 1; i++) { if (_engine_list_order[i] == engine) moving = true; if (moving) _engine_list_order[i] = _engine_list_order[i + 1]; } - // Now, insert it again, before the target engine. + /* Now, insert it again, before the target engine. */ for (i = NUM_TRAIN_ENGINES - 1; i > 0; i--) { _engine_list_order[i] = _engine_list_order[i - 1]; if (_engine_list_order[i] == target) { @@ -1081,7 +1083,7 @@ void AlterRailVehListOrder(EngineID engine, EngineID target) } } - // Update the engine list position (a reverse of engine list order) + /* Update the engine list position (a reverse of engine list order) */ for (i = 0; i < NUM_TRAIN_ENGINES; i++) { _engine_list_position[_engine_list_order[i]] = i; } diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index de1eb77d0..5d24e76ab 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_engine.h */ + #ifndef NEWGRF_ENGINE_H #define NEWGRF_ENGINE_H @@ -7,9 +9,6 @@ #include "direction.h" #include "newgrf_cargo.h" -/** @file newgrf_engine.h - */ - extern int _traininfo_vehicle_pitch; extern int _traininfo_vehicle_width; @@ -38,11 +37,11 @@ bool UsesWagonOverride(const Vehicle *v); enum VehicleTrigger { VEHICLE_TRIGGER_NEW_CARGO = 1, - // Externally triggered only for the first vehicle in chain + /* Externally triggered only for the first vehicle in chain */ VEHICLE_TRIGGER_DEPOT = 2, - // Externally triggered only for the first vehicle in chain, only if whole chain is empty + /* Externally triggered only for the first vehicle in chain, only if whole chain is empty */ VEHICLE_TRIGGER_EMPTY = 4, - // Not triggered externally (called for the whole chain if we got NEW_CARGO) + /* Not triggered externally (called for the whole chain if we got NEW_CARGO) */ VEHICLE_TRIGGER_ANY_NEW_CARGO = 8, }; void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index cf9a52508..b1d604954 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_gui.cpp */ + #include "stdafx.h" #include "openttd.h" #include "functions.h" @@ -157,7 +159,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) case WE_CLICK: switch (e->we.click.widget) { case 3: { - // Get row... + /* Get row... */ const GRFConfig *c; uint i = (e->we.click.pt.y - w->widget[3].top) / 10 + w->vscroll.pos; @@ -167,7 +169,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) break; } - case 6: /* Add selection to list */ + case 6: // Add selection to list if (WP(w, newgrf_add_d).sel != NULL) { const GRFConfig *src = WP(w, newgrf_add_d).sel; GRFConfig **list; @@ -196,7 +198,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e) } break; - case 7: /* Rescan list */ + case 7: // Rescan list WP(w, newgrf_add_d).sel = NULL; ScanNewGRFFiles(); SetWindowDirty(w); @@ -376,7 +378,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) case WE_CLICK: switch (e->we.click.widget) { - case SNGRFS_ADD: { /* Add GRF */ + case SNGRFS_ADD: { // Add GRF GRFConfig **list = WP(w, newgrf_d).list; Window *w; @@ -388,7 +390,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } - case SNGRFS_REMOVE: { /* Remove GRF */ + case SNGRFS_REMOVE: { // Remove GRF GRFConfig **pc, *c, *newsel; /* Choose the next GRF file to be the selected file */ @@ -412,7 +414,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } - case SNGRFS_MOVE_UP: { /* Move GRF up */ + case SNGRFS_MOVE_UP: { // Move GRF up GRFConfig **pc, *c; if (WP(w, newgrf_d).sel == NULL) break; @@ -428,7 +430,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } - case SNGRFS_MOVE_DOWN: { /* Move GRF down */ + case SNGRFS_MOVE_DOWN: { // Move GRF down GRFConfig **pc, *c; if (WP(w, newgrf_d).sel == NULL) break; @@ -444,7 +446,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } - case SNGRFS_FILE_LIST: { /* Select a GRF */ + case SNGRFS_FILE_LIST: { // Select a GRF GRFConfig *c; uint i = (e->we.click.pt.y - w->widget[SNGRFS_FILE_LIST].top) / 14 + w->vscroll.pos; @@ -455,7 +457,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) break; } - case SNGRFS_APPLY_CHANGES: /* Apply changes made to GRF list */ + case SNGRFS_APPLY_CHANGES: // Apply changes made to GRF list if (WP(w, newgrf_d).execute) { ShowQuery( STR_POPUP_CAUTION_CAPTION, @@ -468,7 +470,7 @@ static void NewGRFWndProc(Window *w, WindowEvent *e) } break; - case SNGRFS_SET_PARAMETERS: { /* Edit parameters */ + case SNGRFS_SET_PARAMETERS: { // Edit parameters char buff[512]; if (WP(w, newgrf_d).sel == NULL) break; diff --git a/src/newgrf_sound.cpp b/src/newgrf_sound.cpp index 8064546fe..d9fe2e882 100644 --- a/src/newgrf_sound.cpp +++ b/src/newgrf_sound.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_sound.cpp */ + #include "stdafx.h" #include "openttd.h" #include "oldpool.h" diff --git a/src/newgrf_sound.h b/src/newgrf_sound.h index 3b52d68cb..1b368a510 100644 --- a/src/newgrf_sound.h +++ b/src/newgrf_sound.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_sound.h */ + #ifndef NEWGRF_SOUND_H #define NEWGRF_SOUND_H diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 7fba72c0f..95d5a2f7a 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_spritegroup.cpp */ + #include "stdafx.h" #include "openttd.h" #include "variables.h" diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index bf1c54fe5..a62e23c82 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file newgrf_spritegroup.h */ + #ifndef NEWGRF_SPRITEGROUP_H #define NEWGRF_SPRITEGROUP_H @@ -11,12 +13,12 @@ struct SpriteGroup; /* 'Real' sprite groups contain a list of other result or callback sprite * groups. */ struct RealSpriteGroup { - // Loaded = in motion, loading = not moving - // Each group contains several spritesets, for various loading stages + /* Loaded = in motion, loading = not moving + * Each group contains several spritesets, for various loading stages */ - // XXX: For stations the meaning is different - loaded is for stations - // with small amount of cargo whilst loading is for stations with a lot - // of da stuff. + /* XXX: For stations the meaning is different - loaded is for stations + * with small amount of cargo whilst loading is for stations with a lot + * of da stuff. */ byte num_loaded; ///< Number of loaded groups byte num_loading; ///< Number of loading groups @@ -27,7 +29,7 @@ struct RealSpriteGroup { /* Shared by deterministic and random groups. */ enum VarSpriteGroupScope { VSG_SCOPE_SELF, - // Engine of consists for vehicles, city for stations. + /* Engine of consists for vehicles, city for stations. */ VSG_SCOPE_PARENT, }; @@ -44,20 +46,20 @@ enum DeterministicSpriteGroupAdjustType { }; enum DeterministicSpriteGroupAdjustOperation { - DSGA_OP_ADD, // a + b - DSGA_OP_SUB, // a - b - DSGA_OP_SMIN, // (signed) min(a, b) - DSGA_OP_SMAX, // (signed) max(a, b) - DSGA_OP_UMIN, // (unsigned) min(a, b) - DSGA_OP_UMAX, // (unsigned) max(a, b) - DSGA_OP_SDIV, // (signed) a / b - DSGA_OP_SMOD, // (signed) a % b - DSGA_OP_UDIV, // (unsigned) a / b - DSGA_OP_UMOD, // (unsigned) a & b - DSGA_OP_MUL, // a * b - DSGA_OP_AND, // a & b - DSGA_OP_OR, // a | b - DSGA_OP_XOR, // a ^ b + DSGA_OP_ADD, ///< a + b + DSGA_OP_SUB, ///< a - b + DSGA_OP_SMIN, ///< (signed) min(a, b) + DSGA_OP_SMAX, ///< (signed) max(a, b) + DSGA_OP_UMIN, ///< (unsigned) min(a, b) + DSGA_OP_UMAX, ///< (unsigned) max(a, b) + DSGA_OP_SDIV, ///< (signed) a / b + DSGA_OP_SMOD, ///< (signed) a % b + DSGA_OP_UDIV, ///< (unsigned) a / b + DSGA_OP_UMOD, ///< (unsigned) a & b + DSGA_OP_MUL, ///< a * b + DSGA_OP_AND, ///< a & b + DSGA_OP_OR, ///< a | b + DSGA_OP_XOR, ///< a ^ b }; @@ -89,7 +91,7 @@ struct DeterministicSpriteGroup { DeterministicSpriteGroupAdjust *adjusts; DeterministicSpriteGroupRange *ranges; // Dynamically allocated - // Dynamically allocated, this is the sole owner + /* Dynamically allocated, this is the sole owner */ const SpriteGroup *default_group; }; @@ -99,19 +101,15 @@ enum RandomizedSpriteGroupCompareMode { }; struct RandomizedSpriteGroup { - // Take this object: - VarSpriteGroupScope var_scope; + VarSpriteGroupScope var_scope; ///< Take this object: - // Check for these triggers: - RandomizedSpriteGroupCompareMode cmp_mode; + RandomizedSpriteGroupCompareMode cmp_mode; ///< Check for these triggers: byte triggers; - // Look for this in the per-object randomized bitmask: - byte lowest_randbit; - byte num_groups; // must be power of 2 + byte lowest_randbit; ///< Look for this in the per-object randomized bitmask: + byte num_groups; ///< must be power of 2 - // Take the group with appropriate index: - const SpriteGroup **groups; + const SpriteGroup **groups; ///< Take the group with appropriate index: }; @@ -130,7 +128,7 @@ struct ResultSpriteGroup { }; struct TileLayoutSpriteGroup { - byte num_sprites; /* Number of sprites in the spriteset, used for loading stages */ + byte num_sprites; ///< Number of sprites in the spriteset, used for loading stages struct DrawTileSprites *dts; }; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 28beec471..2d7fc5c17 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -43,7 +43,7 @@ void ResetStationClasses() station_classes[i].spec = NULL; } - // Set up initial data + /* Set up initial data */ station_classes[0].id = 'DFLT'; station_classes[0].name = STR_STAT_CLASS_DFLT; station_classes[0].stations = 1; @@ -66,10 +66,10 @@ StationClassID AllocateStationClass(uint32 cls) { for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) { if (station_classes[i].id == cls) { - // ClassID is already allocated, so reuse it. + /* ClassID is already allocated, so reuse it. */ return i; } else if (station_classes[i].id == 0) { - // This class is empty, so allocate it to the ClassID. + /* This class is empty, so allocate it to the ClassID. */ station_classes[i].id = cls; return i; } @@ -168,8 +168,8 @@ const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station) if (station < station_classes[sclass].stations) return station_classes[sclass].spec[station]; - // If the custom station isn't defined any more, then the GRF file - // probably was not loaded. + /* If the custom station isn't defined any more, then the GRF file + * probably was not loaded. */ return NULL; } @@ -355,11 +355,11 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by case 0x41: case 0x46: case 0x47: - case 0x49: return 0x2110000; /* Platforms, tracks & position */ - case 0x42: return 0; /* Rail type (XXX Get current type from GUI?) */ - case 0x43: return _current_player; /* Station owner */ - case 0x44: return 2; /* PBS status */ - case 0xFA: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); /* Build date */ + case 0x49: return 0x2110000; // Platforms, tracks & position + case 0x42: return 0; // Rail type (XXX Get current type from GUI?) + case 0x43: return _current_player; // Station owner + case 0x44: return 2; // PBS status + case 0xFA: return max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); // Build date } *available = false; @@ -370,16 +370,16 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by /* Calculated station variables */ case 0x40: return GetPlatformInfoHelper(tile, false, false, false); case 0x41: return GetPlatformInfoHelper(tile, true, false, false); - case 0x42: /* Terrain and rail type */ + case 0x42: // Terrain and rail type return ((_opt.landscape == LT_HILLY && GetTileZ(tile) > GetSnowLine()) ? 4 : 0) | (_opt.landscape == LT_DESERT ? GetTropicZone(tile) : 0) | (GetRailType(tile) << 8); - case 0x43: return st->owner; /* Station owner */ - case 0x44: return 2; /* PBS status */ + case 0x43: return st->owner; // Station owner + case 0x44: return 2; // PBS status case 0x45: return GetRailContinuationInfo(tile); case 0x46: return GetPlatformInfoHelper(tile, false, false, true); case 0x47: return GetPlatformInfoHelper(tile, true, false, true); - case 0x48: { /* Accepted cargo types */ + case 0x48: { // Accepted cargo types CargoID cargo_type; uint32 value = 0; @@ -557,7 +557,7 @@ SpriteID GetCustomStationGroundRelocation(const StationSpec *statspec, const Sta ResolverObject object; NewStationResolver(&object, statspec, st, tile); - object.callback_param1 = 1; /* Indicate we are resolving the ground sprite */ + object.callback_param1 = 1; // Indicate we are resolving the ground sprite group = ResolveStation(&object); if (group == NULL || group->type != SGT_RESULT) return 0; diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index d5dfb5fcf..8f4457791 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -1,6 +1,6 @@ /* $Id$ */ -/** @file +/** @file newgrf_text.cpp * Implementation of Action 04 "universal holder" structure and functions. * This file implements a linked-lists of strings, * holding everything that the newgrf action 04 will send over to OpenTTD. @@ -122,7 +122,7 @@ const iso_grf iso_codes[] = { {"sv_SE", GRFLX_SWEDISH}, {"tr_TR", GRFLX_TURKISH}, {"uk_UA", GRFLX_UKRAINIAN}, - {"gen", GRFLB_GENERIC} //this is not iso code, but there has to be something... + {"gen", GRFLB_GENERIC} ///< this is not iso code, but there has to be something... }; @@ -180,12 +180,12 @@ struct GRFTextEntry { static uint _num_grf_texts = 0; static GRFTextEntry _grf_text[(1 << TABSIZE) * 3]; -static byte _currentLangID = GRFLX_ENGLISH; //by default, english is used. +static byte _currentLangID = GRFLX_ENGLISH; ///< by default, english is used. char *TranslateTTDPatchCodes(const char *str) { - char *tmp = MallocT<char>(strlen(str) * 10 + 1); /* Allocate space to allow for expansion */ + char *tmp = MallocT<char>(strlen(str) * 10 + 1); // Allocate space to allow for expansion char *d = tmp; bool unicode = false; WChar c; @@ -198,7 +198,7 @@ char *TranslateTTDPatchCodes(const char *str) } for (;;) { - const char *tmp = str; /* Used for UTF-8 decoding */ + const char *tmp = str; // Used for UTF-8 decoding c = (byte)*str++; if (c == 0) break; diff --git a/src/newgrf_text.h b/src/newgrf_text.h index 1f2e16f0c..272b78422 100644 --- a/src/newgrf_text.h +++ b/src/newgrf_text.h @@ -2,7 +2,7 @@ #ifndef NEWGRF_TEXT_H #define NEWGRF_TEXT_H -/** @file +/** @file newgrf_text.h * Header of Action 04 "universal holder" structure and functions */ diff --git a/src/news.h b/src/news.h index 362b34a03..84e86366d 100644 --- a/src/news.h +++ b/src/news.h @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file news.h */ + #ifndef NEWS_H #define NEWS_H diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 2c1add796..32d7cdc57 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -64,14 +64,14 @@ StringID GetNewsStringNewVehicleAvail(const NewsItem *ni); StringID GetNewsStringBankrupcy(const NewsItem *ni); static DrawNewsCallbackProc * const _draw_news_callback[] = { - DrawNewsNewVehicleAvail, /* DNC_VEHICLEAVAIL */ - DrawNewsBankrupcy, /* DNC_BANKRUPCY */ + DrawNewsNewVehicleAvail, //< DNC_VEHICLEAVAIL + DrawNewsBankrupcy, //< DNC_BANKRUPCY }; extern GetNewsStringCallbackProc * const _get_news_string_callback[]; GetNewsStringCallbackProc * const _get_news_string_callback[] = { - GetNewsStringNewVehicleAvail, /* DNC_VEHICLEAVAIL */ - GetNewsStringBankrupcy, /* DNC_BANKRUPCY */ + GetNewsStringNewVehicleAvail, ///< DNC_VEHICLEAVAIL + GetNewsStringBankrupcy, ///< DNC_BANKRUPCY }; void InitNewsItemStructs() @@ -104,7 +104,7 @@ void DrawNewsBorder(const Window *w) static void NewsWindowProc(Window *w, WindowEvent *e) { switch (e->event) { - case WE_CREATE: { /* If chatbar is open at creation time, we need to go above it */ + case WE_CREATE: { // If chatbar is open at creation time, we need to go above it const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0); w->message.msg = (w1 != NULL) ? w1->height : 0; } break; @@ -189,20 +189,20 @@ static void NewsWindowProc(Window *w, WindowEvent *e) case WE_KEYPRESS: if (e->we.keypress.keycode == WKC_SPACE) { - // Don't continue. + /* Don't continue. */ e->we.keypress.cont = false; DeleteWindow(w); } break; - case WE_MESSAGE: /* The chatbar has notified us that is was either created or closed */ + case WE_MESSAGE: // The chatbar has notified us that is was either created or closed switch (e->we.message.msg) { case WE_CREATE: w->message.msg = e->we.message.wparam; break; case WE_DESTROY: w->message.msg = 0; break; } break; - case WE_TICK: { /* Scroll up newsmessages from the bottom in steps of 4 pixels */ + case WE_TICK: { // Scroll up newsmessages from the bottom in steps of 4 pixels int diff; int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg); if (y == w->top) return; @@ -260,7 +260,7 @@ void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b) if (_game_mode == GM_MENU) return; - // check the rare case that the oldest (to be overwritten) news item is open + /* check the rare case that the oldest (to be overwritten) news item is open */ if (_total_news == MAX_NEWS && (_oldest_news == _current_news || _oldest_news == _forced_news)) MoveToNextItem(); @@ -281,7 +281,8 @@ void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b) /*DEBUG(misc, 0, "+cur %3d, old %2d, lat %3d, for %3d, tot %2d", _current_news, _oldest_news, _latest_news, _forced_news, _total_news);*/ - { /* Add news to _latest_news */ + /* Add news to _latest_news */ + { Window *w; NewsItem *ni = &_news_items[_latest_news]; memset(ni, 0, sizeof(*ni)); @@ -290,7 +291,7 @@ void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b) ni->display_mode = (byte)flags; ni->flags = (byte)(flags >> 8); - // show this news message in color? + /* show this news message in color? */ if (_cur_year >= _patches.colored_news_year) ni->flags |= NF_INCOLOR; ni->type = (byte)(flags >> 16); @@ -405,7 +406,7 @@ static inline void SetNewsDisplayValue(byte item, byte val) SB(_news_display_opt, item * 2, 2, val); } -// open up an own newspaper window for the news item +/* open up an own newspaper window for the news item */ static void ShowNewspaper(NewsItem *ni) { Window *w; @@ -455,7 +456,7 @@ static void ShowNewspaper(NewsItem *ni) w->flags4 |= WF_DISABLE_VP_SCROLL; } -// show news item in the ticker +/* show news item in the ticker */ static void ShowTicker(const NewsItem *ni) { Window *w; @@ -468,8 +469,8 @@ static void ShowTicker(const NewsItem *ni) } -// Are we ready to show another news item? -// Only if nothing is in the newsticker and no newspaper is displayed +/** Are we ready to show another news item? + * Only if nothing is in the newsticker and no newspaper is displayed */ static bool ReadyForNextItem() { const Window *w; @@ -479,15 +480,15 @@ static bool ReadyForNextItem() if (item >= MAX_NEWS) return true; ni = &_news_items[item]; - // Ticker message - // Check if the status bar message is still being displayed? + /* Ticker message + * Check if the status bar message is still being displayed? */ w = FindWindowById(WC_STATUS_BAR, 0); if (w != NULL && WP(w, const def_d).data_1 > -1280) return false; - // Newspaper message, decrement duration counter + /* Newspaper message, decrement duration counter */ if (ni->duration != 0) ni->duration--; - // neither newsticker nor newspaper are running + /* neither newsticker nor newspaper are running */ return (ni->duration == 0 || FindWindowById(WC_NEWS_WINDOW, 0) == NULL); } @@ -496,18 +497,18 @@ static void MoveToNextItem() DeleteWindowById(WC_NEWS_WINDOW, 0); _forced_news = INVALID_NEWS; - // if we're not at the last item, then move on + /* if we're not at the last item, then move on */ if (_current_news != _latest_news) { NewsItem *ni; _current_news = (_current_news == INVALID_NEWS) ? _oldest_news : increaseIndex(_current_news); ni = &_news_items[_current_news]; - // check the date, don't show too old items + /* check the date, don't show too old items */ if (_date - _news_items_age[ni->type] > ni->date) return; switch (GetNewsDisplayValue(ni->type)) { - case 0: { /* Off - show nothing only a small reminder in the status bar */ + case 0: { // Off - show nothing only a small reminder in the status bar Window *w = FindWindowById(WC_STATUS_BAR, 0); if (w != NULL) { @@ -517,14 +518,14 @@ static void MoveToNextItem() break; } - case 1: /* Summary - show ticker, but if forced big, cascade to full */ + case 1: // Summary - show ticker, but if forced big, cascade to full if (!(ni->flags & NF_FORCE_BIG)) { ShowTicker(ni); break; } /* Fallthrough */ - case 2: /* Full - show newspaper*/ + case 2: // Full - show newspaper ShowNewspaper(ni); break; } @@ -533,7 +534,7 @@ static void MoveToNextItem() void NewsLoop() { - // no news item yet + /* no news item yet */ if (_total_news == 0) return; if (ReadyForNextItem()) MoveToNextItem(); @@ -544,10 +545,10 @@ static void ShowNewsMessage(NewsID i) { if (_total_news == 0) return; - // Delete the news window + /* Delete the news window */ DeleteWindowById(WC_NEWS_WINDOW, 0); - // setup forced news item + /* setup forced news item */ _forced_news = i; if (_forced_news != INVALID_NEWS) { @@ -649,7 +650,7 @@ static void MessageHistoryWndProc(Window *w, WindowEvent *e) show = min(_total_news, w->vscroll.cap); for (p = w->vscroll.pos; p < w->vscroll.pos + show; p++) { - // get news in correct order + /* get news in correct order */ const NewsItem *ni = &_news_items[getNews(p)]; SetDParam(0, ni->date); diff --git a/src/npf.cpp b/src/npf.cpp index 8ded2d8c2..d5689ab47 100644 --- a/src/npf.cpp +++ b/src/npf.cpp @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file npf.cpp */ + #include "stdafx.h" #include "openttd.h" #include "bridge_map.h" @@ -99,14 +101,14 @@ static TileIndex CalcClosestStationTile(StationID station, TileIndex tile) uint x; uint y; - // we are going the aim for the x coordinate of the closest corner - // but if we are between those coordinates, we will aim for our own x coordinate + /* we are going the aim for the x coordinate of the closest corner + * but if we are between those coordinates, we will aim for our own x coordinate */ x = clamp(TileX(tile), minx, maxx); - // same for y coordinate, see above comment + /* same for y coordinate, see above comment */ y = clamp(TileY(tile), miny, maxy); - // return the tile of our target coordinates + /* return the tile of our target coordinates */ return TileXY(x, y); } @@ -121,7 +123,7 @@ static int32 NPFCalcStationOrTileHeuristic(AyStar* as, AyStarNode* current, Open TileIndex to = fstd->dest_coords; uint dist; - // for train-stations, we are going to aim for the closest station tile + /* for train-stations, we are going to aim for the closest station tile */ if (as->user_data[NPF_TYPE] == TRANSPORT_RAIL && fstd->station_index != INVALID_STATION) to = CalcClosestStationTile(fstd->station_index, from); @@ -173,7 +175,7 @@ static uint NPFTunnelCost(AyStarNode* current) FindLengthOfTunnelResult flotr; flotr = FindLengthOfTunnel(tile, ReverseDiagDir(exitdir)); return flotr.length * NPF_TILE_LENGTH; - //TODO: Penalty for tunnels? + /* @todo: Penalty for tunnels? */ } else { /* We are entering the tunnel, the enter tile is just a * straight track */ @@ -244,19 +246,19 @@ static void NPFMarkTile(TileIndex tile) static int32 NPFWaterPathCost(AyStar* as, AyStarNode* current, OpenListNode* parent) { - //TileIndex tile = current->tile; + /* TileIndex tile = current->tile; */ int32 cost = 0; Trackdir trackdir = (Trackdir)current->direction; - cost = _trackdir_length[trackdir]; /* Should be different for diagonal tracks */ + cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir)) - cost += _patches.npf_buoy_penalty; /* A small penalty for going over buoys */ + cost += _patches.npf_buoy_penalty; // A small penalty for going over buoys if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) cost += _patches.npf_water_curve_penalty; - /* TODO More penalties? */ + /* @todo More penalties? */ return cost; } @@ -385,8 +387,8 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare /* Check for turns */ if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) cost += _patches.npf_rail_curve_penalty; - //TODO, with realistic acceleration, also the amount of straight track between - // curves should be taken into account, as this affects the speed limit. + /*TODO, with realistic acceleration, also the amount of straight track between + * curves should be taken into account, as this affects the speed limit. */ /* Check for reverse in depot */ if (IsTileDepotType(tile, TRANSPORT_RAIL) && as->EndNodeCheck(as, &new_node) != AYSTAR_FOUND_END_NODE) { @@ -484,7 +486,7 @@ static bool VehicleMayEnterTile(Owner owner, TileIndex tile, DiagDirection enter break; } - return true; /* no need to check */ + return true; // no need to check } @@ -544,7 +546,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) /* Find out the exit direction first */ if (IsRoadStopTile(src_tile)) { exitdir = GetRoadStopDir(src_tile); - } else { /* Train or road depot */ + } else { // Train or road depot exitdir = GetDepotDirection(src_tile, type); } @@ -610,7 +612,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) DiagDirection exitdir; if (IsRoadStopTile(dst_tile)) { exitdir = GetRoadStopDir(dst_tile); - } else { /* Road or train depot */ + } else { // Road or train depot exitdir = GetDepotDirection(dst_tile, type); } /* Find the trackdirs that are available for a depot or station with this @@ -640,7 +642,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current) /* Check for oneway signal against us */ if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) { if (HasSignalOnTrackdir(dst_tile, ReverseTrackdir(dst_trackdir)) && !HasSignalOnTrackdir(dst_tile, dst_trackdir)) - // if one way signal not pointing towards us, stop going in this direction. + /* if one way signal not pointing towards us, stop going in this direction. */ break; } { @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file npf.h */ + #ifndef NPF_H #define NPF_H @@ -9,9 +11,9 @@ #include "vehicle.h" #include "tile.h" -//mowing grass +/* mowing grass */ enum { - NPF_HASH_BITS = 12, /* The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value. */ + NPF_HASH_BITS = 12, ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value. /* Do no change below values */ NPF_HASH_SIZE = 1 << NPF_HASH_BITS, NPF_HASH_HALFBITS = NPF_HASH_BITS / 2, @@ -35,33 +37,38 @@ enum { NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH }; -struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */ - TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */ - StationID station_index; /* station index we're heading for, or INVALID_STATION when we're heading for a tile */ +/* Meant to be stored in AyStar.targetdata */ +struct NPFFindStationOrTileData { + TileIndex dest_coords; ///< An indication of where the station is, for heuristic purposes, or the target tile + StationID station_index; ///< station index we're heading for, or INVALID_STATION when we're heading for a tile }; -enum { /* Indices into AyStar.userdata[] */ - NPF_TYPE = 0, /* Contains a TransportTypes value */ - NPF_OWNER, /* Contains an Owner value */ - NPF_RAILTYPES, /* Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise. */ +/* Indices into AyStar.userdata[] */ +enum { + NPF_TYPE = 0, ///< Contains a TransportTypes value + NPF_OWNER, ///< Contains an Owner value + NPF_RAILTYPES, ///< Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise. }; -enum { /* Indices into AyStarNode.userdata[] */ - NPF_TRACKDIR_CHOICE = 0, /* The trackdir chosen to get here */ +/* Indices into AyStarNode.userdata[] */ +enum { + NPF_TRACKDIR_CHOICE = 0, ///< The trackdir chosen to get here NPF_NODE_FLAGS, }; -enum NPFNodeFlag { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ - NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */ - NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */ - NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */ +/* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ +enum NPFNodeFlag { + NPF_FLAG_SEEN_SIGNAL, ///< Used to mark that a signal was seen on the way, for rail only + NPF_FLAG_REVERSE, ///< Used to mark that this node was reached from the second start node, if applicable + NPF_FLAG_LAST_SIGNAL_RED, ///< Used to mark that the last signal on this path was red }; -struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */ - uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */ - uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */ - Trackdir best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */ - AyStarNode node; /* The node within the target the search led us to */ +/* Meant to be stored in AyStar.userpath */ +struct NPFFoundTargetData { + uint best_bird_dist; ///< The best heuristic found. Is 0 if the target was found + uint best_path_dist; ///< The shortest path. Is (uint)-1 if no path is found + Trackdir best_trackdir; ///< The trackdir that leads to the shortest path/closest birds dist + AyStarNode node; ///< The node within the target the search led us to }; /* These functions below are _not_ re-entrant, in favor of speed! */ |