mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-09-15 12:59:45 +00:00
Compare commits
256
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41e8be2835 | ||
|
|
698d840581 | ||
|
|
060b2b736b | ||
|
|
2d6ebd3bf4 | ||
|
|
fa64ae9b3a | ||
|
|
289206b033 | ||
|
|
4682434bc9 | ||
|
|
2f6c840ebf | ||
|
|
6a2ae92811 | ||
|
|
89a135293a | ||
|
|
6435a89c28 | ||
|
|
d426906a01 | ||
|
|
be44f1306f | ||
|
|
b5468e7a80 | ||
|
|
613743538d | ||
|
|
cfbbcf1597 | ||
|
|
10a7678beb | ||
|
|
22922414eb | ||
|
|
3f9fa65a42 | ||
|
|
795a528328 | ||
|
|
e54a1f6721 | ||
|
|
e95718bf43 | ||
|
|
c9609bbbc2 | ||
|
|
a82118f360 | ||
|
|
2707186f6a | ||
|
|
07e14525b8 | ||
|
|
922d60f516 | ||
|
|
9ca4b629cd | ||
|
|
7efd7e19ed | ||
|
|
6c9078fd30 | ||
|
|
d89095b3ec | ||
|
|
b8c9988d9f | ||
|
|
6371b75bcc | ||
|
|
5f28591610 | ||
|
|
73da045f50 | ||
|
|
561449992a | ||
|
|
22d17aa745 | ||
|
|
c0b051eb33 | ||
|
|
772de6b52d | ||
|
|
488b525161 | ||
|
|
6a17bf91e3 | ||
|
|
3f900d3580 | ||
|
|
39d7f3b2bd | ||
|
|
ff6aeb8791 | ||
|
|
39c5cfc5d1 | ||
|
|
2f4a77f47e | ||
|
|
b3fdf69ab5 | ||
|
|
62128e8263 | ||
|
|
805afdb002 | ||
|
|
92b90d877e | ||
|
|
82346d4608 | ||
|
|
32cd182ecc | ||
|
|
4a203e8a49 | ||
|
|
1e7c3fd2ff | ||
|
|
a2297dc594 | ||
|
|
b8559492b5 | ||
|
|
7ab524b048 | ||
|
|
9b4beb0a5c | ||
|
|
7645c5ac43 | ||
|
|
6e4dd56158 | ||
|
|
4d8a93c870 | ||
|
|
a1df4bea68 | ||
|
|
89f245ab2f | ||
|
|
1d3ce9ef1b | ||
|
|
bd9f07e5a0 | ||
|
|
4784c3ac3c | ||
|
|
bc9afec3b0 | ||
|
|
53c9846f14 | ||
|
|
93b26e8e3d | ||
|
|
0ab078158e | ||
|
|
679cd3c21b | ||
|
|
2709454040 | ||
|
|
7be31ee03e | ||
|
|
0c497dd113 | ||
|
|
1b3e2309df | ||
|
|
804542b3f3 | ||
|
|
6b86ee9888 | ||
|
|
080a941eda | ||
|
|
85255ea001 | ||
|
|
75351f4043 | ||
|
|
110e25e859 | ||
|
|
26eb9eb7e2 | ||
|
|
c6b46725db | ||
|
|
c58a910c8e | ||
|
|
fad00367ae | ||
|
|
93ae848b0a | ||
|
|
6cb017456a | ||
|
|
c53c869556 | ||
|
|
d811238dd0 | ||
|
|
ff469ab352 | ||
|
|
ee67d10c80 | ||
|
|
3d1008318b | ||
|
|
09d7f172a6 | ||
|
|
28676531b0 | ||
|
|
1b237216a8 | ||
|
|
eb2b510e01 | ||
|
|
87dade4698 | ||
|
|
998246430a | ||
|
|
e8e535f58c | ||
|
|
ab91d8eb4f | ||
|
|
313654f18d | ||
|
|
b1546da65e | ||
|
|
00f9a36645 | ||
|
|
0e802c462d | ||
|
|
49e191cc8e | ||
|
|
12b4fa7dba | ||
|
|
7e6ccf3a0a | ||
|
|
60874f88d0 | ||
|
|
4eb4aad54f | ||
|
|
57c6133c3b | ||
|
|
da09ebc59a | ||
|
|
beb7f63746 | ||
|
|
91e95dfd53 | ||
|
|
352fd000ea | ||
|
|
f5364269b5 | ||
|
|
9d8496e65e | ||
|
|
3281b91c48 | ||
|
|
0a16e4ee91 | ||
|
|
dbef775e76 | ||
|
|
d8567d2699 | ||
|
|
ec54970058 | ||
|
|
bd72b9d2a4 | ||
|
|
9845f10668 | ||
|
|
e898a6a9f6 | ||
|
|
63319e4658 | ||
|
|
ade2f29f5d | ||
|
|
35be634974 | ||
|
|
8ffc288901 | ||
|
|
716f4e924e | ||
|
|
c8a4d122c5 | ||
|
|
2da2b57631 | ||
|
|
51b97aa3c1 | ||
|
|
f420b5a66a | ||
|
|
e2ef4aff46 | ||
|
|
be106c77a9 | ||
|
|
29a0dd65a9 | ||
|
|
4863d934af | ||
|
|
c597237032 | ||
|
|
ce9a7acc8f | ||
|
|
03088dadda | ||
|
|
68412eebec | ||
|
|
4cc2d71d6d | ||
|
|
b890bcb840 | ||
|
|
0b27228d9a | ||
|
|
eab47d2227 | ||
|
|
7dafd04f4b | ||
|
|
ace917f872 | ||
|
|
995e80ba57 | ||
|
|
aac2289bf8 | ||
|
|
38ed740e80 | ||
|
|
bf45eacd97 | ||
|
|
7e6e7a6737 | ||
|
|
b621e4545c | ||
|
|
4f1e96acf1 | ||
|
|
2103f7e91a | ||
|
|
e4b8a4e3bf | ||
|
|
ebb360f48c | ||
|
|
5268d03abd | ||
|
|
73d26d3831 | ||
|
|
017a7f902b | ||
|
|
868d035b45 | ||
|
|
6a38f88bd1 | ||
|
|
1b61d234a1 | ||
|
|
3408814169 | ||
|
|
d9305ef99d | ||
|
|
80591d73c1 | ||
|
|
b68d37f2aa | ||
|
|
7daf2a4ec0 | ||
|
|
810873ff33 | ||
|
|
8e3e93b96f | ||
|
|
37b9c31118 | ||
|
|
b25cf57542 | ||
|
|
1c2d56d314 | ||
|
|
6b5992788c | ||
|
|
ad15cd37a6 | ||
|
|
4ec6c19d44 | ||
|
|
b22945350f | ||
|
|
3ca65ab7b3 | ||
|
|
a25d6c64dd | ||
|
|
c6a90361fc | ||
|
|
8b6a8a8935 | ||
|
|
13456934b1 | ||
|
|
7814e6e792 | ||
|
|
2d17f09902 | ||
|
|
cae28bf8eb | ||
|
|
666fbb28c2 | ||
|
|
62bc55cf7b | ||
|
|
36f55a8823 | ||
|
|
9ddcbaf9b7 | ||
|
|
675f1376e0 | ||
|
|
f1a4bad7f7 | ||
|
|
aa7a587ca3 | ||
|
|
64c7cc51b5 | ||
|
|
582472d626 | ||
|
|
41015b877d | ||
|
|
fe6080650c | ||
|
|
b46aee796b | ||
|
|
1d47e0a4d2 | ||
|
|
4a0ce4bb14 | ||
|
|
e166a0eaed | ||
|
|
65e04c8a38 | ||
|
|
6cf67eff15 | ||
|
|
4f4f9a1e4e | ||
|
|
6546561360 | ||
|
|
661e13a86a | ||
|
|
cedb07bba3 | ||
|
|
22a13850cb | ||
|
|
703ff560c1 | ||
|
|
5b25e620dd | ||
|
|
c986325763 | ||
|
|
14d8ef9add | ||
|
|
83d7634122 | ||
|
|
affd8b9d7b | ||
|
|
cea92937eb | ||
|
|
e7971c2971 | ||
|
|
6331923653 | ||
|
|
bfc386fe10 | ||
|
|
399a9641fe | ||
|
|
0d613156e7 | ||
|
|
aa4f269f3e | ||
|
|
ade19e5242 | ||
|
|
639e22b83b | ||
|
|
f3292c304a | ||
|
|
b98c758e0b | ||
|
|
744616bb36 | ||
|
|
9858065ff9 | ||
|
|
8282b66b70 | ||
|
|
28f16a732f | ||
|
|
b06b05c360 | ||
|
|
64f04c3a74 | ||
|
|
8a278f7711 | ||
|
|
9b2a54bfbf | ||
|
|
1d21903eb4 | ||
|
|
d2564a3e56 | ||
|
|
2c41b8ee97 | ||
|
|
13c5cd820b | ||
|
|
091cc85a18 | ||
|
|
2c4c6b4fe1 | ||
|
|
d8b823142e | ||
|
|
b5268dccbd | ||
|
|
b323000253 | ||
|
|
7cce507443 | ||
|
|
2ebd4c62bc | ||
|
|
96906c1a45 | ||
|
|
852e647bcc | ||
|
|
9a5cce382f | ||
|
|
62f2771edd | ||
|
|
d28d469b7a | ||
|
|
d9405a0bcc | ||
|
|
479d117c68 | ||
|
|
9cdd8c6d48 | ||
|
|
e930b9985d | ||
|
|
cdae336feb | ||
|
|
c5ce84267a | ||
|
|
fffb8f89a4 | ||
|
|
889c8d3022 |
+2
-2
@@ -256,9 +256,9 @@ ifeq ($(OS), PSP)
|
||||
# Because of a bug in the PSP GCC tools, linking via CXX results
|
||||
# in total chaos and more problems then you can handle. So we need
|
||||
# CC to link OpenTTD for PSP
|
||||
$(Q)$(CC_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
$(Q)+$(CC_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
else
|
||||
$(Q)$(CXX_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
$(Q)+$(CXX_HOST) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||
endif
|
||||
ifdef STRIP
|
||||
$(Q)$(STRIP) $@
|
||||
|
||||
@@ -1028,6 +1028,7 @@ function Regression::RailTypeList()
|
||||
print(" ListDump:");
|
||||
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||
print(" RailType: " + i);
|
||||
print(" GetName(): " + AIRail.GetName(i));
|
||||
print(" IsRailTypeAvailable(): " + AIRail.IsRailTypeAvailable(i));
|
||||
print(" GetMaxSpeed(): " + AIRail.GetMaxSpeed(i));
|
||||
}
|
||||
@@ -1477,6 +1478,7 @@ function Regression::Town()
|
||||
print(" GetLocation(): " + AITown.GetLocation(i));
|
||||
print(" GetHouseCount(): " + AITown.GetHouseCount(i));
|
||||
print(" GetRating(): " + AITown.GetRating(i, AICompany.COMPANY_SELF));
|
||||
print(" IsCity(): " + AITown.IsCity(i));
|
||||
}
|
||||
print(" Valid Towns: " + j);
|
||||
print(" GetTownCount(): " + AITown.GetTownCount());
|
||||
|
||||
@@ -7209,6 +7209,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
Count(): 1
|
||||
ListDump:
|
||||
RailType: 0
|
||||
GetName(): Railway construction
|
||||
IsRailTypeAvailable(): true
|
||||
GetMaxSpeed(): 0
|
||||
|
||||
@@ -7980,6 +7981,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 15508
|
||||
GetHouseCount(): 30
|
||||
GetRating(): 0
|
||||
IsCity(): true
|
||||
Town 1
|
||||
IsValidTown(): true
|
||||
GetName(): Trenningville
|
||||
@@ -7987,6 +7989,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 46751
|
||||
GetHouseCount(): 17
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 2
|
||||
IsValidTown(): true
|
||||
GetName(): Tonston
|
||||
@@ -7994,6 +7997,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 28365
|
||||
GetHouseCount(): 19
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 3
|
||||
IsValidTown(): true
|
||||
GetName(): Tunford
|
||||
@@ -8001,6 +8005,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 41895
|
||||
GetHouseCount(): 11
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 4
|
||||
IsValidTown(): true
|
||||
GetName(): Wruntown
|
||||
@@ -8008,6 +8013,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 41450
|
||||
GetHouseCount(): 18
|
||||
GetRating(): 0
|
||||
IsCity(): true
|
||||
Town 5
|
||||
IsValidTown(): true
|
||||
GetName(): Fratston
|
||||
@@ -8015,6 +8021,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 55007
|
||||
GetHouseCount(): 11
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 6
|
||||
IsValidTown(): true
|
||||
GetName(): Muningville
|
||||
@@ -8022,6 +8029,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 38200
|
||||
GetHouseCount(): 28
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 7
|
||||
IsValidTown(): true
|
||||
GetName(): Hutford
|
||||
@@ -8029,6 +8037,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 59234
|
||||
GetHouseCount(): 33
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 8
|
||||
IsValidTown(): true
|
||||
GetName(): Satown
|
||||
@@ -8036,6 +8045,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 51267
|
||||
GetHouseCount(): 20
|
||||
GetRating(): 0
|
||||
IsCity(): true
|
||||
Town 9
|
||||
IsValidTown(): true
|
||||
GetName(): Frindinghattan
|
||||
@@ -8043,6 +8053,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 5825
|
||||
GetHouseCount(): 18
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 10
|
||||
IsValidTown(): true
|
||||
GetName(): Nuntburg
|
||||
@@ -8050,6 +8061,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 6446
|
||||
GetHouseCount(): 26
|
||||
GetRating(): 6
|
||||
IsCity(): false
|
||||
Town 11
|
||||
IsValidTown(): true
|
||||
GetName(): Fort Frindston
|
||||
@@ -8057,6 +8069,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 14935
|
||||
GetHouseCount(): 13
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 12
|
||||
IsValidTown(): true
|
||||
GetName(): Gintborough
|
||||
@@ -8064,6 +8077,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 32740
|
||||
GetHouseCount(): 28
|
||||
GetRating(): 0
|
||||
IsCity(): true
|
||||
Town 13
|
||||
IsValidTown(): true
|
||||
GetName(): Great Hinninghall
|
||||
@@ -8071,6 +8085,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 9595
|
||||
GetHouseCount(): 14
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 14
|
||||
IsValidTown(): true
|
||||
GetName(): Prundinghall
|
||||
@@ -8078,6 +8093,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 51298
|
||||
GetHouseCount(): 18
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 15
|
||||
IsValidTown(): true
|
||||
GetName(): Beningville
|
||||
@@ -8085,6 +8101,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 42338
|
||||
GetHouseCount(): 33
|
||||
GetRating(): 6
|
||||
IsCity(): false
|
||||
Town 16
|
||||
IsValidTown(): true
|
||||
GetName(): Kennville
|
||||
@@ -8092,6 +8109,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 17345
|
||||
GetHouseCount(): 33
|
||||
GetRating(): 0
|
||||
IsCity(): true
|
||||
Town 17
|
||||
IsValidTown(): true
|
||||
GetName(): Quarfingfield
|
||||
@@ -8099,6 +8117,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 24252
|
||||
GetHouseCount(): 13
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 18
|
||||
IsValidTown(): true
|
||||
GetName(): Nefingbridge
|
||||
@@ -8106,6 +8125,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 10574
|
||||
GetHouseCount(): 13
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 19
|
||||
IsValidTown(): true
|
||||
GetName(): Mendston
|
||||
@@ -8113,6 +8133,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 6511
|
||||
GetHouseCount(): 14
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 20
|
||||
IsValidTown(): true
|
||||
GetName(): Chenfingbourne
|
||||
@@ -8120,6 +8141,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 22585
|
||||
GetHouseCount(): 15
|
||||
GetRating(): 6
|
||||
IsCity(): true
|
||||
Town 21
|
||||
IsValidTown(): true
|
||||
GetName(): Franinghead
|
||||
@@ -8127,6 +8149,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 9634
|
||||
GetHouseCount(): 27
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 22
|
||||
IsValidTown(): true
|
||||
GetName(): Natborough
|
||||
@@ -8134,6 +8157,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 51891
|
||||
GetHouseCount(): 12
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 23
|
||||
IsValidTown(): true
|
||||
GetName(): Larborough
|
||||
@@ -8141,6 +8165,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 59622
|
||||
GetHouseCount(): 27
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 24
|
||||
IsValidTown(): true
|
||||
GetName(): Little Frutford
|
||||
@@ -8148,6 +8173,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 19596
|
||||
GetHouseCount(): 34
|
||||
GetRating(): 4
|
||||
IsCity(): true
|
||||
Town 25
|
||||
IsValidTown(): true
|
||||
GetName(): Grinnway
|
||||
@@ -8155,6 +8181,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 16433
|
||||
GetHouseCount(): 15
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 26
|
||||
IsValidTown(): true
|
||||
GetName(): Beburg
|
||||
@@ -8162,6 +8189,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 39505
|
||||
GetHouseCount(): 18
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Town 27
|
||||
IsValidTown(): true
|
||||
GetName(): Fudhattan
|
||||
@@ -8169,6 +8197,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||
GetLocation(): 45525
|
||||
GetHouseCount(): 19
|
||||
GetRating(): 0
|
||||
IsCity(): false
|
||||
Valid Towns: 28
|
||||
GetTownCount(): 28
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ fi
|
||||
if [ -n "$gdb" ]; then
|
||||
$gdb ./openttd -x -c ai/regression/regression.cfg $params -g ai/regression/regression.sav
|
||||
else
|
||||
./openttd -x -c ai/regression/regression.cfg $params -g ai/regression/regression.sav -d ai=2 2>&1 | awk '{ gsub("0x(\\(nil\\)|0+)", "0x00000000", $0); gsub("^dbg: \\[ai\\]", "", $0); gsub("^ ", "ERROR: ", $0); gsub("ERROR: \\[1\\] ", "", $0); gsub("\\[P\\] ", "", $0); print $0; }' > tmp.regression
|
||||
./openttd -x -c ai/regression/regression.cfg $params -g ai/regression/regression.sav -d ai=2 2>&1 | awk '{ gsub("0x(\\(nil\\)|0+)(x0)?", "0x00000000", $0); gsub("^dbg: \\[ai\\]", "", $0); gsub("^ ", "ERROR: ", $0); gsub("ERROR: \\[1\\] ", "", $0); gsub("\\[P\\] ", "", $0); print $0; }' > tmp.regression
|
||||
fi
|
||||
|
||||
if [ -z "$gdb" ]; then
|
||||
|
||||
+91
-5
@@ -1,3 +1,89 @@
|
||||
1.1.0-beta4 (2011-01-21)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [NewGRF] Rail type property to influence sorting of rail types in the drop down list [FS#4394] (r21866)
|
||||
- Feature: [Network] Console command to change the password of other companies for servers [FS#4368] (r21855)
|
||||
- Feature: [NewGRF] Introduction dates/required types for rail types; e.g. introduce a particular rail type in 1960 (or when a vehicle using it is introduced), but also allow limiting its introduction to only happen when the required railtypes are available [FS#4393] (r21842)
|
||||
- Feature: Limit vehicle lateness to the length of a full timetable cycle, e.g. when a cycle takes 50 days and the vehicle is 65 days later reduce the lateness to 15 days (r21832)
|
||||
- Feature: After building a road or tram bridge/tunnel, connect it to any existing road or tram (r21778, r21777)
|
||||
- Feature: Display NewGRF object sprites during object picking (r21772)
|
||||
- Feature: Display NewGRF station sprites during station picking (r21755)
|
||||
- Change: Allow LMB scrolling with the mouse outside of the extra viewport instead of canceling scrolling when going slightly over the edge (r21838)
|
||||
- Change: Only show rail/road types that will eventually be available in-game. For example do not show trams when there is no tram NewGRF loaded (r21817)
|
||||
- Change: Keep aqueducts and road/tram tunnels and bridges after removing a company (r21780)
|
||||
- Fix: Distant-join station would build at the wrong location when having persistent building turned on and selecting a 'second' location for the station tile [FS#4430] (r21864)
|
||||
- Fix: Slowing down of trains was done by reducing the speed by 10%, but also when you are just 1% too fast, so limit the slowdown till the new maximum speed [FS#4423] (r21847)
|
||||
- Fix: Left-mouse-button dragging would switch over to other viewports instead of staying locked to the viewport you started on [FS#4419] (r21837)
|
||||
- Fix: When a train was reversed while inside a tunnel/bridge, it would not have (re)set the GOINGUP/DOWN bits after leaving the tunnel/bridge (r21836)
|
||||
- Fix: Desync debug savegames might not be actually saved in case threading is enabled, which is enabled by default [FS#4427] (r21833)
|
||||
- Fix: Service orders for trains/aircraft would (sometimes) not get a time when autofilling [FS#4414] (r21831)
|
||||
- Fix: Crash with the small map window on big endian platforms [FS#4417] (r21830)
|
||||
- Fix: The expectations from the 'always build infrastructure' setting name/description did not match the behaviour [FS#4007] (r21826)
|
||||
- Fix: Allow dragging of combo signals (again) [FS#4378] (r21816)
|
||||
- Fix: [YAPF] Apply a pathfinder penalty for back of one-way path signals so those arenot preferred over other possibilities [FS#3908] (r21815)
|
||||
- Fix: Check GRF version from action 8, and disallow usage of GRFs with versions above 7 (r21814)
|
||||
- Fix: Crash when displaying the owner view [FS#4411] (r21813)
|
||||
- Fix: Do not create automatic orders when there are no manual orders, and remove unreached automatic orders when reaching an ordered waypoint or depot [FS#4404] (r21809, r21808)
|
||||
- Fix: Loading a TTO savegame failed after loading a TTDP savegame (r21799, r21798)
|
||||
- Fix: The size (in characters) of the string inputs was too small for loading some TTD savegames (r21797)
|
||||
- Fix: Drive through road stop state was not properly converted from TTDPatch savegames [FS#4398] (r21796)
|
||||
- Fix: Broken usage of GetTileOwner() caused wrong conversion of old savegames (r21793)
|
||||
- Fix: Terraforming limit was off-by-one when terraforming a single tile height [FS#4407] (r21791)
|
||||
- Fix: TTDPatch savegames can have train waypoints encoded as buoys [FS#4398] (r21790)
|
||||
- Fix: When the font misses the fallback character '?', use the sprite font's '?' instead [FS#4405] (r21789)
|
||||
- Fix: Crash due to invalid rail station width and height data stored in TTDPatch savegames [FS#4398] (r21786)
|
||||
- Fix: Crash when converting savegame with custom waypoint name (r21784)
|
||||
- Fix: Diagonal tile iterator failed for A * 0 selections [FS#4396] (r21768)
|
||||
- Fix: Do not limit tile clearing during bankruptcy [FS#4397] (r21767)
|
||||
- Fix: PBS reservation was not shown on road crossings with NewGRF railtypes [FS#4369] (r21765)
|
||||
- Remove: The 'stopall' console command, as its functionality was broken. Group start/stop commands can be used instead [FS#4409] (r21804)
|
||||
|
||||
|
||||
1.1.0-beta3 (2011-01-09)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Configurable limit amount of tiles that can be cleared/terraformed by a company [FS#4331] (r21728)
|
||||
- Feature: Show a list of companies in the owner legend and allow them to be toggled for visibility (r21720, r21718)
|
||||
- Feature: Console command 'list_ai_libs' to get a list of recognized AI libraries [FS#4372] (r21703)
|
||||
- Feature: Allow changing the AI configuration in the scenario editor / in game [FS#4362] (r21696)
|
||||
- Change: Tune 'realistic' acceleration even more to make more trains reach their top speed, and make it behave more like TTDPatch (r21712)
|
||||
- Change: Display the minimum height of the tile in the LandInfo window instead of the height of the northern corner. So it is more useful for NewGRF and AI developers, and maybe more transparent for players (r21711)
|
||||
- Fix: The diagonal iterator would iterate twice over some tiles [FS#4395] (r21747)
|
||||
- Fix: [NewGRF] Canal variable 83 accessed water random bits also for non-water tiles (e.g. watery industries or objects) (r21746)
|
||||
- Fix: [NewGRF] Canal variable 80 shall return consistent heights within a lock (r21745)
|
||||
- Fix: Allow Ctrl+Clicking automatic orders for scrolling to their destination (r21744)
|
||||
- Fix: Coast tiles were not drawn under bridges [FS#4386] (r21743)
|
||||
- Fix: Make clearing refit orders work again [FS#4388] (r21739)
|
||||
- Fix: Start loading when cur_order_index points to the destination station, i.e. after deleting not-reached automatic orders [FS#4384] (r21738)
|
||||
- Fix: A loading order was also marked as 'not part of orders' when the order before the current order was deleted (r21737)
|
||||
- Fix: Admin bots were not always notified of password changes [FS#4377] (r21727)
|
||||
- Fix: Vehicle sprite was cached into a 16 bit variable, causing incorrect sprites to be displayed (r21709)
|
||||
- Fix: [NewGRF] Report TTDPatch flag 4A (newobjects) as set (r21708)
|
||||
- Fix: The old ship pathfinder is too stupid to provide 'lost' notices; it would even get lost while following its own path [FS#4370] (r21706)
|
||||
- Fix: Do not perform any more checks after the connection is closed [FS#4374] (r21704)
|
||||
- Fix: Changing AI settings ingame was impossible when the difficulty level was other than custom (r21694)
|
||||
- Fix: Due to an error in the Debian changelog building of Debian/Ubuntu packages failed (r21682)
|
||||
|
||||
|
||||
1.1.0-beta2 (2010-12-31)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Command logging using the admin interface (r21668)
|
||||
- Feature: Concept of automatic station orders; add stub orders for intermediate stations and remove them when not visiting them anymore. This allows you to see what trains visit a station without actually having to order a vehicle to stop at all stations (r21642)
|
||||
- Add: [NoAI] AIEventTownFounded (r21664)
|
||||
- Add: [NoAI] AIRail::GetName() to get the name of a railtype (r21663)
|
||||
- Add: [NoAI] AITown::IsCity() so AIs can find out which towns grow faster than others (r21654)
|
||||
- Change: Do not show price to build a bridge in the scenario editor as they are free to build there [FS#4358] (r21673)
|
||||
- Change: Do not highlight tile when selecting a vehicle to clone or an order to skip to (r21616)
|
||||
- Fix: Estonia introduced the Euro in 2011 (r21670)
|
||||
- Fix: Autofill timetable had side effects in test mode, possibly causing desyncs in MP [FS#4354] (r21660)
|
||||
- Fix: Cargo payment graph was not properly invalidated when payment rate changed [FS#4351] (r21658)
|
||||
- Fix: Use a bool instead of uint8 to store a bool and use the dedicated accessor function when reading boolean settings [FS#4345] (r21656)
|
||||
- Fix: Infinite loop in the road pathfinder due to bouncing around in an 'one way' trap; two one ways pointing towards eachother making it impossible to leave [FS#4338] (r21651)
|
||||
- Fix: Make '[centre|main] view' consistent, and make '[main|global] view' consistent [FS#4339] (r21650)
|
||||
- Fix: Newly created skip-to order was created at wrong place (r21633)
|
||||
- Fix: Ships with the old pathfinder would easily show up as lost, even when it would eventually find a path. Now also the distance from the 'end' of the pathfinding run to the destination is compared to the current distance to the destination; if the distance to the destination at the end of the pathfinder run is less than the current distance from the destination the ship will not be marked as lost. This means that the ships with the old pathfinder will less likely get marked as lost, but due to the design of the old ship pathfinder there 'lostness' is merely a best guess. When you still get a lost message you need to build buoys to guide the ship pathfinder [FS#4325] (r21631)
|
||||
- Fix: Version detection of subversion branches and tags got broken (r21630)
|
||||
- Fix: Crash under certain circumstances when using autorail [FS#4327] (r21619)
|
||||
|
||||
|
||||
1.1.0-beta1 (2010-12-24)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [NewGRF] Variable 7B for accessing 60+x variables while taking the parameter from the accumulator (r21604)
|
||||
@@ -286,7 +372,7 @@
|
||||
- Fix: Road vehicles could be dead locked with one way roads. This allows one wayness to be removed if there are vehicles on a tile; it does not allow you to add one wayness to roads that have vehicles on them as it makes turning vehicles jump [FS#3961] (r20230)
|
||||
- Fix: 'Service at nearest depot' behaved the same as 'Go to nearest depot' [FS#3986] (r20229)
|
||||
- Fix: Depot did not become unsnowy, when snowline rises [FS#3976] (r20224)
|
||||
- Fix: Strip non-printable characters before showing it in an edit box, so when renaming a vehicle type you won't get the 'SETX stuff' that some NewGRFs use [FS#3974] (r20220)
|
||||
- Fix: Strip non-printable characters before showing it in an edit box, so when renaming a vehicle type you will not get the 'SETX stuff' that some NewGRFs use [FS#3974] (r20220)
|
||||
- Fix: NewGRFs that defined a vehicle without either loaded or loading groups could crash OpenTTD [FS#3964] (r20199)
|
||||
- Fix: [NewGRF] GetNearbyTileInformation can be used to get the terrain type of a MP_VOID tile [FS#3963] (r20197)
|
||||
- Fix: [NewGRF] Vehicle var FE bit 6 did return incorrect values for new railtypes (r20175)
|
||||
@@ -295,7 +381,7 @@
|
||||
|
||||
1.0.3 (2010-08-01)
|
||||
------------------------------------------------------------------------
|
||||
- Fix: Make it possible to properly assess the length of the rail toolbar caption, don't require '{WHITE}' control codes (r20242)
|
||||
- Fix: Make it possible to properly assess the length of the rail toolbar caption, do not require '{WHITE}' control codes (r20242)
|
||||
- Fix: Check for disallowed level crossings also when converting rail (r20237)
|
||||
- Fix: Haiku uses a 'special' location for headers (r20219)
|
||||
- Fix: Desync due to (temporary) wrong railtype; when loading a savegame the railtype of some (high ID) trains could be wrong [FS#3945] (r20137)
|
||||
@@ -778,7 +864,7 @@
|
||||
- Fix: Do not try to overtake a vehicle in a road station as overtaking in a station is not allowed [FS#3390] (r18561)
|
||||
- Fix: Make aircraft behave the same on autoreplace/autorenew as other vehicle types (r18553)
|
||||
- Fix: First do the time-since-last-service check and only then determine whether autoreplace needs to take place. This way they will not keep autoreplacing continuously on failure, but only after some timeout. Also check some minimal requirements (engine availability, refittability) and a heuristic for the needed money when sending vehicles for autoreplace [FS#1762] (r18551, r18549)
|
||||
- Fix: Do not account for path reservation costs when entering a signal block via a 'block' signal. This way you won't get double penalties, both red signals and reservation costs, for the block signalled tracks [FS#2722] (r18535)
|
||||
- Fix: Do not account for path reservation costs when entering a signal block via a 'block' signal. This way you will not get double penalties, both red signals and reservation costs, for the block signalled tracks [FS#2722] (r18535)
|
||||
- Fix: [NewGRF] An industry NewGRF that defined a too small size for action0 prop 0A could cause a crash (r18527)
|
||||
- Fix: Allegro does not like to work with extmidi, so warn the user about that [FS#3272] (r18520)
|
||||
- Fix: When you pass a signal at danger, in a PBS controlled area, do not try to do the 'safe' thing and stop, but continue going; the user wanted the train to pass the signal at danger so (s)he has to suffer the consequences. Ofcourse one can always stop the train manually [FS#2891] (r18515)
|
||||
@@ -791,7 +877,7 @@
|
||||
- Fix: Unselect an AI in the AI Settings window when it falls out of the range of active AIs [FS#3357] (r18436)
|
||||
- Fix: Road vehicles would not pick an empty drive through stop. Now they will *if* the penalty for driving around is less than the occupancy penalty [FS#1944] (r18404)
|
||||
- Fix: Long (articulated) road vehicles could block loading of others when the following road vehicle already got 'permission' to go to the next bay even when it could not reach it [FS#1495] (r18404)
|
||||
- Fix: The tree 'which one to draw' hash wasn't anywhere near random and thus showed a very visible repeated pattern when only one tree type was used [FS#3343] (r18398)
|
||||
- Fix: The tree 'which one to draw' hash was not anywhere near random and thus showed a very visible repeated pattern when only one tree type was used [FS#3343] (r18398)
|
||||
- Fix: [NoAI] Make AIIndustryType::GetConstructionCost() return -1, if the industry is neither buildable nor prospectable (r18276)
|
||||
- Fix: Use free type ascender/descender metrics to position font offset correctly (r18096)
|
||||
- Fix: Make the 'pause' chat message when actually executing the pause command. This to prevent showing paused and especially unpaused to be shown when the state does not change. Output now mentions whether pause changes keep the game paused and what reasons for pausing there 'currently' are (r18052)
|
||||
@@ -2300,7 +2386,7 @@
|
||||
- Fix: Several desync fixes (incorrect roadstop update of old games, autoreplace bugs) [FS#551] (r8137, r8147, r8157)
|
||||
- Fix: Some disaster-events fixed: combat chopper shoots from right position, submarine once again moves around (r8140, r8158)
|
||||
- Fix: 'out of sprite memory' warning messages due to incorrect assumption of requested memory for sprites (r8133)
|
||||
- Fix: Bouys are now built and numbered 1..9 not 9..1 [FS#538] (r8123)
|
||||
- Fix: Buoys are now built and numbered 1..9 not 9..1 [FS#538] (r8123)
|
||||
- Fix: Clicking for more news properly cycles through the news history backwards, and does not show the first item doubly if it's already open (r8049)
|
||||
- Fix: Crash when removing a town in the scenario editor while the query window is open for one of the town's tiles (r8030)
|
||||
- Fix: Overflow of system-ticks was not handled properly, resulting in a possibly unresponsive server/client (r8028)
|
||||
|
||||
+15
-10
@@ -1295,7 +1295,12 @@ make_compiler_cflags() {
|
||||
has_lto=`$1 -dumpspecs | grep '\%{flto'`
|
||||
if [ -n "$has_lto" ]; then
|
||||
# Use LTO only if we see LTO exists and is requested
|
||||
flags="$flags -flto"
|
||||
if [ $cc_version -lt 46 ]; then
|
||||
flags="$flags -flto"
|
||||
else
|
||||
flags="$flags -flto=jobserver"
|
||||
fi
|
||||
ldflags="$ldflags -fwhole-program"
|
||||
features="$features lto"
|
||||
fi
|
||||
fi
|
||||
@@ -1658,8 +1663,8 @@ make_cflags_and_ldflags() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$have_broken_iconv" != "no" ]; then
|
||||
CFLAGS="$CFLAGS -DHAVE_BROKEN_ICONV"
|
||||
if [ "$have_non_const_iconv" != "no" ]; then
|
||||
CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -2916,9 +2921,9 @@ detect_iconv() {
|
||||
|
||||
log 1 "checking iconv... found"
|
||||
|
||||
# Check if we need to work around buggy iconv implementation where inbuf
|
||||
# is wrongly typed as non-const. Correct implementation is at
|
||||
# http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html
|
||||
# There are different implementations of iconv. The older ones,
|
||||
# e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
|
||||
# IEEE 1003.1 (2004), pass a non-const pointer.
|
||||
|
||||
cat > tmp.iconv.cpp << EOF
|
||||
#include "src/stdafx.h"
|
||||
@@ -2938,8 +2943,8 @@ EOF
|
||||
ret=$?
|
||||
log 2 "executing $execute"
|
||||
log 2 " exit code $ret"
|
||||
if [ "$ret" = "0" ]; then have_broken_iconv="no"; else have_broken_iconv="yes"; fi
|
||||
log 1 "checking if iconv has non-const inbuf... $have_broken_iconv"
|
||||
if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
|
||||
log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
|
||||
|
||||
cat > tmp.iconv.cpp << EOF
|
||||
#include "src/stdafx.h"
|
||||
@@ -3249,13 +3254,13 @@ generate_src_osx() {
|
||||
|
||||
# We don't want to duplicate the x86_64 stuff for each target, so do it once here
|
||||
if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
|
||||
# 64 bits is always 10.5 or higher. Furthermore it has a broken ICONV
|
||||
# 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
|
||||
# and they also removed support for QuickTime/QuickDraw
|
||||
if [ -n "$osx_sdk_path" ]; then
|
||||
CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
|
||||
LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
|
||||
fi
|
||||
CFLAGS="$CFLAGS -D_SQ64 -DHAVE_BROKEN_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
|
||||
CFLAGS="$CFLAGS -D_SQ64 -DHAVE_NON_CONST_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
|
||||
LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
|
||||
fi
|
||||
|
||||
|
||||
+13
-5
@@ -1,15 +1,24 @@
|
||||
32bpp and OpenTTD
|
||||
=================
|
||||
Last updated: 2007-06-13
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) About
|
||||
2.0) The format
|
||||
|
||||
|
||||
1.0) About
|
||||
---- -----
|
||||
OpenTTD has 32bpp support. This means: OpenTTD still is 8bpp, but it has the
|
||||
posibility to override the graphics with 32bpp. This means that it isn't a
|
||||
replacement of grf or newgrf, but simply an addition. If you want to use 32bpp
|
||||
graphics of a newgrf, you do need the newgrf itself too (with 8bpp graphics).
|
||||
|
||||
|
||||
The Format
|
||||
----------
|
||||
|
||||
2.0) The format
|
||||
---- ----------
|
||||
32bpp images are stored in PNG. They should go in:
|
||||
data/sprites/<grfname>/<SpriteID>.png
|
||||
|
||||
@@ -33,4 +42,3 @@ to add this information. Sadly enough most graphical editors trashes those
|
||||
chunks upon save, so you have to readd it every time you save your image.
|
||||
|
||||
Your images should be the same as the grf, in size.
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
STRGEN USAGE
|
||||
------------
|
||||
OpenTTD and strgen
|
||||
Last updated: 2009-06-30
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) strgen usage
|
||||
* 1.1) Examples
|
||||
* 1.2) strgen command switches
|
||||
|
||||
|
||||
1.0) strgen usage
|
||||
---- ------------
|
||||
This guide is only interesting for people who want to alter something
|
||||
themselves without access to translator.openttd.org. Please note that
|
||||
your compiled language file will only be compatible with the OpenTTD version
|
||||
@@ -14,8 +26,8 @@ strgen takes as argument a txt file and translates it to a lng file, allowing
|
||||
it to be used inside OpenTTD. strgen needs the master language file
|
||||
english.txt to work. Below are some examples of strgen usage.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
1.1) Examples
|
||||
---- --------
|
||||
Example 1:
|
||||
if you are in the root of your working copy (svn code), you should type
|
||||
strgen/strgen -s lang lang/english.txt
|
||||
@@ -35,8 +47,8 @@ resulting language file to go to /tmp. Use
|
||||
You can interchange english.txt to whichever language you want to generate a
|
||||
.lng file for.
|
||||
|
||||
STRGEN COMMAND SWITCHES
|
||||
-----------------------
|
||||
1.2) strgen command switches
|
||||
---- -----------------------
|
||||
-v | --version
|
||||
strgen will tell what svn revision it was last modified
|
||||
|
||||
|
||||
+45
-39
@@ -1,19 +1,23 @@
|
||||
Admin Network
|
||||
|
||||
Preface
|
||||
1. Joining the network
|
||||
2. Asking for updates
|
||||
3. Polling manually
|
||||
4. Sending rcon commands
|
||||
5. Sending chat
|
||||
6. Receiving chat
|
||||
7. Disconnecting
|
||||
8. Certain packet information
|
||||
OpenTTD's admin network
|
||||
Last updated: 2011-01-20
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Preface
|
||||
----------
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) Preface
|
||||
2.0) Joining the network
|
||||
3.0) Asking for updates
|
||||
* 3.1) Polling manually
|
||||
4.0) Sending rcon commands
|
||||
5.0) Sending chat
|
||||
* 5.1) Receiving chat
|
||||
6.0) Disconnecting
|
||||
7.0) Certain packet information
|
||||
|
||||
|
||||
1.0) Preface
|
||||
---- -------
|
||||
The admin network provides a dedicated network protocol designed for other
|
||||
applications to communicate with OpenTTD. Connected applications can execute
|
||||
console commands remotely (rcon commands) with no further authentication.
|
||||
@@ -33,12 +37,14 @@ Admin Network
|
||||
removed from packets in later versions, except the possibility that complete
|
||||
packets are dropped in favour of a new packet.
|
||||
This though will be reflected in the protocol version as announced in the
|
||||
ADMIN_PACKET_SERVER_PROTOCOL in section 1.
|
||||
ADMIN_PACKET_SERVER_PROTOCOL in section 2.0).
|
||||
|
||||
A reference implementation in Java for a client connecting to the admin interface
|
||||
can be found at: http://dev.openttdcoop.org/projects/joan
|
||||
|
||||
|
||||
1. Joining the network
|
||||
----------------------
|
||||
|
||||
2.0) Joining the network
|
||||
---- -------------------
|
||||
Create a TCP connection to the server on port 3977. The application is
|
||||
expected to authenticate within 10 seconds.
|
||||
|
||||
@@ -68,9 +74,8 @@ Admin Network
|
||||
However, ADMIN_PACKET_SERVER_WELCOME only after a ADMIN_PACKET_SERVER_NEWGAME
|
||||
|
||||
|
||||
2. Asking for updates
|
||||
---------------------
|
||||
|
||||
3.0) Asking for updates
|
||||
---- ------------------
|
||||
Asking for updates is done with ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY.
|
||||
With this packet you define which update you wish to receive at which
|
||||
frequency.
|
||||
@@ -113,15 +118,18 @@ Admin Network
|
||||
- ADMIN_PACKET_SERVER_CONSOLE
|
||||
|
||||
|
||||
3. Polling manually
|
||||
-------------------
|
||||
ADMIN_UPDATE_CMD_LOGGING results in the server sending:
|
||||
- ADMIN_PACKET_SERVER_CMD_LOGGING
|
||||
|
||||
3.1) Polling manually
|
||||
---- ----------------
|
||||
Certain AdminUpdateTypes can also be polled:
|
||||
- ADMIN_UPDATE_DATE
|
||||
- ADMIN_UPDATE_CLIENT_INFO
|
||||
- ADMIN_UPDATE_COMPANY_INFO
|
||||
- ADMIN_UPDATE_COMPANY_ECONOMY
|
||||
- ADMIN_UPDATE_COMPANY_STATS
|
||||
- ADMIN_UPDATE_CMD_NAMES
|
||||
|
||||
ADMIN_UPDATE_CLIENT_INFO and ADMIN_UPDATE_COMPANY_INFO accept an additional
|
||||
parameter. This parameter is used to specify a certain client or company.
|
||||
@@ -134,9 +142,8 @@ Admin Network
|
||||
Additional debug information can be found with a debug level of net=3.
|
||||
|
||||
|
||||
4. Sending rcon commands
|
||||
------------------------
|
||||
|
||||
4.0) Sending rcon commands
|
||||
---- ---------------------
|
||||
Rcon runs separate from the ADMIN_UPDATE_CONSOLE AdminUpdateType. Requesting
|
||||
the execution of a remote console command is done with the packet
|
||||
ADMIN_PACKET_ADMIN_RCON.
|
||||
@@ -154,9 +161,8 @@ Admin Network
|
||||
was not sent from the admin network.
|
||||
|
||||
|
||||
5. Sending Chat
|
||||
---------------
|
||||
|
||||
5.0) Sending chat
|
||||
---- ------------
|
||||
Sending a ADMIN_PACKET_ADMIN_CHAT results in chat originating from the server.
|
||||
|
||||
Currently four types of chat are supported:
|
||||
@@ -169,10 +175,8 @@ Admin Network
|
||||
using the respective DestType and ID.
|
||||
This is a message prefixed with the 3 stars, e.g. *** foo has joined the game
|
||||
|
||||
|
||||
6. Receiving chat
|
||||
-----------------
|
||||
|
||||
5.1) Receiving chat
|
||||
---- -------------
|
||||
Register ADMIN_UPDATE_CHAT at ADMIN_FREQUENCY_AUTOMATIC to receive chat.
|
||||
The application will be able to receive all chat the server can see.
|
||||
|
||||
@@ -180,16 +184,14 @@ Admin Network
|
||||
private chat for to the server is distributed into the admin network.
|
||||
|
||||
|
||||
7. Disconnecting
|
||||
----------------
|
||||
|
||||
6.0) Disconnecting
|
||||
---- -------------
|
||||
It is a kind thing to say good bye before leaving. Do this by sending the
|
||||
ADMIN_PACKET_ADMIN_QUIT packet.
|
||||
|
||||
|
||||
8. Certain packet information
|
||||
-----------------------------
|
||||
|
||||
7.0) Certain packet information
|
||||
---- --------------------------
|
||||
All ADMIN_PACKET_SERVER_* packets have an enum value greater 100.
|
||||
|
||||
ADMIN_PACKET_SERVER_WELCOME
|
||||
@@ -202,4 +204,8 @@ Admin Network
|
||||
a CLIENT_JOIN / COMPANY_NEW packet without having received the INFO packet
|
||||
it may be a good idea to POLL for the specific ID.
|
||||
|
||||
|
||||
ADMIN_PACKET_SERVER_CMD_NAMES and ADMIN_PACKET_SERVER_CMD_LOGGING
|
||||
Data provided with these packets is not stable and will not be
|
||||
treated as such. Do not rely on IDs or names to be constant
|
||||
across different versions / revisions of OpenTTD.
|
||||
Data provided in this packet is for logging purposes only.
|
||||
|
||||
+68
-22
@@ -1,9 +1,22 @@
|
||||
Multiplayer Manual for OpenTTD
|
||||
==============================
|
||||
Multiplayer manual for OpenTTD
|
||||
Last updated: 2011-01-20
|
||||
------------------------------------------------------------------------
|
||||
|
||||
1. Starting a Server
|
||||
---------------------
|
||||
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) Starting a server
|
||||
2.0) Connecting to a server
|
||||
* 2.1) Connecting to a server over the console
|
||||
3.0) Playing internet games
|
||||
4.0) Tips for servers
|
||||
* 4.1) Imposing landscaping limits
|
||||
5.0) Some useful things
|
||||
6.0) Troubleshooting
|
||||
|
||||
|
||||
1.0) Starting a server
|
||||
---- -----------------
|
||||
- Click "multiplayer" on the startup screen
|
||||
- Click "start server"
|
||||
- Type in a game name
|
||||
@@ -14,9 +27,8 @@ Multiplayer Manual for OpenTTD
|
||||
- Start playing
|
||||
|
||||
|
||||
2. Connecting to a Server
|
||||
--------------------------
|
||||
|
||||
2.0) Connecting to a server
|
||||
---- ----------------------
|
||||
- Click "multiplayer" on the startup screen
|
||||
|
||||
- If you want to connect to any network game in your LAN click on 'LAN', then
|
||||
@@ -43,17 +55,14 @@ Multiplayer Manual for OpenTTD
|
||||
|
||||
- Happy playing
|
||||
|
||||
|
||||
3. Connecting to a Server over the Console
|
||||
-------------------------------------------
|
||||
|
||||
2.1) Connecting to a server over the console
|
||||
---- ---------------------------------------
|
||||
- Open the console and type in the following command:
|
||||
connect <ip/host>:<port>#<company-no>
|
||||
|
||||
|
||||
4. Playing Internet-Games
|
||||
--------------------------
|
||||
|
||||
3.0) Playing internet games
|
||||
---- ----------------------
|
||||
- Servers with a red dot behind it have a different version then you have. You
|
||||
will not be able to join those servers.
|
||||
|
||||
@@ -83,9 +92,8 @@ Multiplayer Manual for OpenTTD
|
||||
NB: changing frame_freq has more effect on the bandwidth then sync_freq.
|
||||
|
||||
|
||||
5. Tips for servers
|
||||
--------------------
|
||||
|
||||
4.0) Tips for servers
|
||||
---- ----------------
|
||||
- You can launch a dedicated server by adding -D as parameter.
|
||||
- In UNIX like systems, you can fork your dedicated server by adding -f as
|
||||
parameter.
|
||||
@@ -141,10 +149,49 @@ Multiplayer Manual for OpenTTD
|
||||
maximum memory usage for packets is:
|
||||
#max_clients * #max_clients * bytes_per_frame * 10 KiB.
|
||||
|
||||
4.1) Imposing landscaping limits
|
||||
---- ---------------------------
|
||||
- You can impose limits on companies by the following 4 settings:
|
||||
- terraform_per_64k_frames
|
||||
- terraform_frame_burst
|
||||
- clear_per_64k_frames
|
||||
- clear_frame_burst
|
||||
|
||||
6. Some useful things
|
||||
----------------------
|
||||
- Explaining 'per_64K_frames' and 'burst'
|
||||
- 'burst' defines 3 things, the maximum limit, the limit of a single action,
|
||||
and the initial value for the limit assigned to a new company.
|
||||
This setting is fairly simple and requires no math.
|
||||
|
||||
A value of 1 means a single tile can be affected by a single action.
|
||||
This results in having to click 400 times when wanting to cover an area
|
||||
of 20 x 20 tiles.
|
||||
|
||||
The default value 4096 covers an area of 64 x 64 tiles.
|
||||
|
||||
- 'per_64k_frames' defines the number of tiles added to each companies limit
|
||||
per frame (however not past the possible maximum value,the 'burst').
|
||||
64k rather resembles the exact number of 65536 frames. So setting this
|
||||
variable to 65536 means: 65536 / 65536 = 1 tile per frame.
|
||||
As a day consists of 74 frames, a company's limit is increased by 74
|
||||
tiles during the course of a single day (2.22 seconds).
|
||||
|
||||
To achieve a 1 tile per day increase the following calculation is needed:
|
||||
1 / 74 (frames per day) * 65536 (per_64k_frames) = 885.62...
|
||||
after rounding: a value of 886 means adding a bit over 1 tile per day.
|
||||
|
||||
There is still enough space to scale this value downwards:
|
||||
decreasing this value to 127 results in a bit over 1 tile added to the
|
||||
allowance per week (7 days).
|
||||
|
||||
To create a setup in which a company gets an initial allowance only,
|
||||
set the value to 0 - no increase of the allowance per frame.
|
||||
|
||||
- Even though construction actions include a clear tile action, they are not
|
||||
affected by the above settings.
|
||||
|
||||
|
||||
5.0) Some useful things
|
||||
---- ------------------
|
||||
- You can protect your company so nobody else can join uninvited. To do this,
|
||||
set a password in your Company Screen
|
||||
|
||||
@@ -156,9 +203,8 @@ Multiplayer Manual for OpenTTD
|
||||
- Servers can now kick players, so don't make them use it!
|
||||
|
||||
|
||||
7. Troubleshooting
|
||||
------------------
|
||||
|
||||
6.0) Troubleshooting
|
||||
---- ---------------
|
||||
- My advertising server does not show up in list at servers.openttd.org
|
||||
Run openttd with the '-d net=2' parameter, as this will show whether it
|
||||
receives replies from the master server. If it does not receive replies it
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.Dd Apr 01, 2010
|
||||
.Dd Dec 31, 2010
|
||||
.Dt OPENTTD 6
|
||||
.Sh NAME
|
||||
.Nm openttd
|
||||
|
||||
+17
-3
@@ -93,12 +93,17 @@ elif [ -d "$ROOT_DIR/.git" ]; then
|
||||
fi
|
||||
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
|
||||
REV="g`echo $HASH | cut -c1-8`"
|
||||
BRANCH=`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@;s@^master$@@'`
|
||||
BRANCH="`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@;s@^master$@@'`"
|
||||
REV_NR=`LC_ALL=C git log --pretty=format:%s --grep="^(svn r[0-9]*)" -1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
|
||||
if [ -z "$REV_NR" ]; then
|
||||
# No rev? Maybe it is a custom git-svn clone
|
||||
REV_NR=`LC_ALL=C git log --pretty=format:%b --grep="git-svn-id:.*@[0-9]*" -1 | sed "s@.*\@\([0-9]*\).*@\1@"`
|
||||
fi
|
||||
TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null`"
|
||||
if [ -n "$TAG" ]; then
|
||||
BRANCH=""
|
||||
REV="$TAG"
|
||||
fi
|
||||
elif [ -d "$ROOT_DIR/.hg" ]; then
|
||||
# We are a hg checkout
|
||||
if [ -n "`hg status | grep -v '^?'`" ]; then
|
||||
@@ -106,8 +111,17 @@ elif [ -d "$ROOT_DIR/.hg" ]; then
|
||||
fi
|
||||
HASH=`LC_ALL=C hg id -i | cut -c1-12`
|
||||
REV="h`echo $HASH | cut -c1-8`"
|
||||
BRANCH=`hg branch | sed 's@^default$@@'`
|
||||
REV_NR=`LC_ALL=C hg log -f -k "(svn r" -l 1 --template "{desc}\n" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
|
||||
BRANCH="`hg branch | sed 's@^default$@@'`"
|
||||
TAG="`hg id -t | grep -v 'tip$'`"
|
||||
if [ -n "$TAG" ]; then
|
||||
BRANCH=""
|
||||
REV="$TAG"
|
||||
fi
|
||||
REV_NR=`LC_ALL=C hg log -f -k "(svn r" -l 1 --template "{desc|firstline}\n" | grep "^(svn r[0-9]*)" | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
|
||||
if [ -z "$REV_NR" ]; then
|
||||
# No rev? Maybe it is a custom hgsubversion clone
|
||||
REV_NR=`LC_ALL=C hg parent --template="{svnrev}"`
|
||||
fi
|
||||
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
|
||||
# We are an exported source bundle
|
||||
cat $ROOT_DIR/.ottdrev
|
||||
|
||||
+44
-19
@@ -1,18 +1,18 @@
|
||||
OpenTTD's known bugs
|
||||
Last updated: 2010-12-24
|
||||
Release version: 1.1.0-beta1
|
||||
Last updated: 2011-01-21
|
||||
Release version: 1.1.0-beta4
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Table of Contents:
|
||||
------------------
|
||||
1) About
|
||||
2) Known bugs in the this stable release
|
||||
3) Known bugs that will not be solved
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) About
|
||||
2.0) Known bugs in this release
|
||||
* 2.1) Known bugs that will not be solved
|
||||
|
||||
|
||||
1) About:
|
||||
-- ------
|
||||
1.0) About
|
||||
---- -----
|
||||
All bugs listed below are marked as known. Please do not submit any bugs
|
||||
that are the same as these. If you do, do not act surprised, because
|
||||
we WILL flame you!!
|
||||
@@ -22,12 +22,12 @@ specifics, we welcome you to report them. React to the given bug indicated
|
||||
by the number below on http://bugs.openttd.org.
|
||||
|
||||
|
||||
2) Known bugs in this stable release:
|
||||
-- ----------------------------------
|
||||
The following bugs are known to exist in this stable release and
|
||||
we intend to fix them. Some bugs are known but are not fixable or
|
||||
fixing them would cause further problems. Those bugs can be found
|
||||
in the "Known bugs that will not be solved" section.
|
||||
2.0) Known bugs in this release
|
||||
---- --------------------------
|
||||
The following bugs are known to exist in this release and we intend to
|
||||
fix them. Some bugs are known but are not fixable or fixing them would
|
||||
cause further problems. Those bugs can be found in the "Known bugs that
|
||||
will not be solved" section.
|
||||
|
||||
The bugs in this section all refer to a ticket in our bug tracking system
|
||||
that you can find at: http://bugs.openttd.org
|
||||
@@ -39,13 +39,11 @@ officially supporting Mac OS X again. For now it remains unsupported and
|
||||
we only apply bug fixes provided by the community but we are unable to fix
|
||||
these bugs ourselves.
|
||||
|
||||
- 3569 Location of wagons can be outside of the wagon
|
||||
- 3447 [OSX] SDL port is unuseable
|
||||
- 2484 [OSX] Cannot enter CJK characters
|
||||
|
||||
|
||||
3) Known bugs that will not be solved:
|
||||
-- -----------------------------------
|
||||
2.1) Known bugs that will not be solved
|
||||
---- ----------------------------------
|
||||
This section lists all known bugs that we do not intend to fix and the
|
||||
reasons why we think that fixing them is infeasible. We might make some
|
||||
minor improvements that reduce the scope of these bugs, but we will not
|
||||
@@ -259,3 +257,30 @@ OpenTTD hangs when started on 32 bits Windows [FS#4083]
|
||||
The reason we do not use the "win32" music driver as default are
|
||||
described in the "Long delay between switching music/song" section
|
||||
of this document.
|
||||
|
||||
Pre- and exit signals are not dragged [FS#4378]
|
||||
Unlike all other signal types, the entry- and exit signals are not
|
||||
dragged but instead normal signals are placed on subsequent track
|
||||
sections. This is done on purpose as this is the usually more con-
|
||||
venient solution. There are little to no occasions where more than
|
||||
one entry or exit signal in a row are useful. This is different
|
||||
for all other signal types where several in a row can serve one
|
||||
purpose or another.
|
||||
|
||||
Station build date is incorrect [FS#4415]
|
||||
The tile query tool will show the date of the last (re)construction
|
||||
at the station and not the date of the first construction. This is
|
||||
due to compatability reasons with NewGRFs and the fact that it is
|
||||
wrong to say that the station is built in a particular year when it
|
||||
was completely destroyed/rebuilt later on.
|
||||
The tile query tool can be fixed by changing the "Build date" text
|
||||
to "Date at which the last (re)construction took place" but this is
|
||||
deemed too specific and long for that window.
|
||||
|
||||
Can't change volume inside OpenTTD [FS#4416]
|
||||
Some backends do not provide a means to change the volume of sound
|
||||
effects or music. The mixing of music and sound is left to external
|
||||
libraries/the operating system we can't handle the volume control
|
||||
in OpenTTD. As a result you can't change the volume inside OpenTTD
|
||||
for backends such as SDL; just use the volume control provided by
|
||||
your operating system.
|
||||
|
||||
+16
-5
@@ -1,11 +1,22 @@
|
||||
openttd (1.1~svn-0) UNRELEASED; urgency=low
|
||||
openttd (1.1.0~beta4) unstable; urgency=low
|
||||
|
||||
* Unreleased SVN version. Versioned to allow normal upgrades to released
|
||||
versions.
|
||||
* New upstream release 1.1.0-beta4
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 24 Dec 2010 00:00:00 +0000
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 21 Jan 2011 00:00:00 +0100
|
||||
|
||||
openttd (1.1.0~beta1); urgency=low
|
||||
openttd (1.1.0~beta3) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.1.0-beta3
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Sun, 09 Jan 2011 18:00:00 +0100
|
||||
|
||||
openttd (1.1.0~beta2) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.1.0-beta2
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 31 Dec 2010 18:00:00 +0100
|
||||
|
||||
openttd (1.1.0~beta1) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.1.0-beta1
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
set OPENTTD_VERSION=1.1.0-beta1
|
||||
set OPENTTD_VERSION=1.1.0-beta4
|
||||
set OPENSFX_VERSION=0.8.0
|
||||
set NOSOUND_VERSION=0.8.0
|
||||
set OPENGFX_VERSION=0.7.0
|
||||
|
||||
+2
-1
@@ -2,7 +2,7 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
# spec file for the openttd rpm package
|
||||
#
|
||||
# Copyright (c) 2007-2010 The OpenTTD developers
|
||||
# Copyright (c) 2007-2011 The OpenTTD developers
|
||||
#
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself
|
||||
@@ -26,6 +26,7 @@ Source: %{name}-%{version}-source.tar.bz2
|
||||
Requires: fontconfig
|
||||
Requires: SDL
|
||||
Requires: zlib
|
||||
Requires: xz-devel
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: fontconfig-devel
|
||||
BuildRequires: libpng-devel
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
!define APPV_MAJOR 1
|
||||
!define APPV_MINOR 1
|
||||
!define APPV_MAINT 0
|
||||
!define APPV_BUILD 0
|
||||
!define APPV_EXTRA "-beta1"
|
||||
!define APPV_BUILD 3
|
||||
!define APPV_EXTRA "-beta4"
|
||||
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
|
||||
|
||||
@@ -157,8 +157,10 @@ Function DetermineSVNVersion()
|
||||
|
||||
If version <> "norev000" Then
|
||||
If InStr(url, "branches") Then
|
||||
url = Mid(url, InStr(url, "branches/") + 9)
|
||||
branch = Mid(url, 1, InStr(2, url, "/") - 1)
|
||||
branch = Mid(url, InStr(url, "branches/") + 9)
|
||||
End If
|
||||
If InStr(url, "tags") Then
|
||||
version = Mid(url, InStr(url, "tags/") + 5)
|
||||
End If
|
||||
Else ' version <> "norev000"
|
||||
' svn detection failed, reset error and try git
|
||||
@@ -199,7 +201,7 @@ Function DetermineSVNVersion()
|
||||
End If ' line <> "master"
|
||||
End If ' Err.Number = 0
|
||||
|
||||
Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1 ../")
|
||||
Set oExec = WshShell.Exec("git log --pretty=format:%s --grep=" & Chr(34) & "^(svn r[0-9]*)" & Chr(34) & " -1")
|
||||
if Err.Number = 0 Then
|
||||
revision = Mid(oExec.StdOut.ReadLine(), 7)
|
||||
revision = Mid(revision, 1, InStr(revision, ")") - 1)
|
||||
@@ -208,13 +210,26 @@ Function DetermineSVNVersion()
|
||||
' No revision? Maybe it is a custom git-svn clone
|
||||
' Reset error number as WshShell.Exec will not do that on success
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("git log --pretty=format:%b --grep=" & Chr(34) & "git-svn-id:.*@[0-9]*" & Chr(34) & " -1 ../")
|
||||
Set oExec = WshShell.Exec("git log --pretty=format:%b --grep=" & Chr(34) & "git-svn-id:.*@[0-9]*" & Chr(34) & " -1")
|
||||
If Err.Number = 0 Then
|
||||
revision = oExec.StdOut.ReadLine()
|
||||
revision = Mid(revision, InStr(revision, "@") + 1)
|
||||
revision = Mid(revision, 1, InStr(revision, " ") - 1)
|
||||
End If ' Err.Number = 0
|
||||
End If ' revision = ""
|
||||
|
||||
' Check if a tag is currently checked out
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("git name-rev --name-only --tags --no-undefined HEAD")
|
||||
If Err.Number = 0 Then
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
Loop
|
||||
If oExec.ExitCode = 0 Then
|
||||
version = oExec.StdOut.ReadLine()
|
||||
branch = ""
|
||||
End If ' oExec.ExitCode = 0
|
||||
End If ' Err.Number = 0
|
||||
End If ' Err.Number = 0
|
||||
End If ' oExec.ExitCode = 0
|
||||
End If ' Err.Number = 0
|
||||
@@ -222,7 +237,7 @@ Function DetermineSVNVersion()
|
||||
If version = "norev000" Then
|
||||
' git detection failed, reset error and try mercurial (hg)
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("hg parents")
|
||||
Set oExec = WshShell.Exec("hg id -i")
|
||||
If Err.Number = 0 Then
|
||||
' Wait till the application is finished ...
|
||||
Do While oExec.Status = 0
|
||||
@@ -230,8 +245,21 @@ Function DetermineSVNVersion()
|
||||
|
||||
If oExec.ExitCode = 0 Then
|
||||
line = OExec.StdOut.ReadLine()
|
||||
hash = Mid(line, InStrRev(line, ":") + 1)
|
||||
hash = Left(line, 12)
|
||||
version = "h" & Mid(hash, 1, 8)
|
||||
|
||||
' Check if a tag is currently checked out
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("hg id -t")
|
||||
If Err.Number = 0 Then
|
||||
line = oExec.StdOut.ReadLine()
|
||||
If Len(line) > 0 And Right(line, 3) <> "tip" Then
|
||||
version = line
|
||||
branch = ""
|
||||
End If ' Len(line) > 0 And Right(line, 3) <> "tip"
|
||||
End If ' Err.Number = 0
|
||||
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("hg status ../")
|
||||
If Err.Number = 0 Then
|
||||
Do
|
||||
@@ -250,11 +278,23 @@ Function DetermineSVNVersion()
|
||||
End If ' line <> "default"
|
||||
End If ' Err.Number = 0
|
||||
|
||||
Set oExec = WshShell.Exec("hg log -f -k " & Chr(34) & "(svn r" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc}\n" & Chr(34) & " --cwd ../")
|
||||
Set oExec = WshShell.Exec("hg log -f -k " & Chr(34) & "(svn r" & Chr(34) & " -l 1 --template " & Chr(34) & "{desc|firstline}\n" & Chr(34) & " --cwd ../")
|
||||
If Err.Number = 0 Then
|
||||
revision = Mid(OExec.StdOut.ReadLine(), 7)
|
||||
revision = Mid(revision, 1, InStr(revision, ")") - 1)
|
||||
line = oExec.StdOut.ReadLine()
|
||||
If Left(line, 6) = "(svn r" Then
|
||||
revision = Mid(line, 7)
|
||||
revision = Mid(revision, 1, InStr(revision, ")") - 1)
|
||||
End If 'Left(line, 6) = "(svn r"
|
||||
End If ' Err.Number = 0
|
||||
|
||||
If revision = "" Then
|
||||
' No rev? Maybe it is a custom hgsubversion clone
|
||||
Err.Clear
|
||||
Set oExec = WshShell.Exec("hg parent --template=" & Chr(34) & "{svnrev}" & Chr(34))
|
||||
If Err.Number = 0 Then
|
||||
revision = oExec.StdOut.ReadLine()
|
||||
End If ' Err.Number = 0
|
||||
End If ' revision = ""
|
||||
End If ' Err.Number = 0
|
||||
End If ' oExec.ExitCode = 0
|
||||
End If ' Err.Number = 0
|
||||
|
||||
+54
-58
@@ -1,34 +1,35 @@
|
||||
OpenTTD README
|
||||
Last updated: 2010-12-24
|
||||
Release version: 1.1.0-beta1
|
||||
OpenTTD readme
|
||||
Last updated: 2011-01-21
|
||||
Release version: 1.1.0-beta4
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Table of Contents:
|
||||
------------------
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) About
|
||||
2.0) Contacting
|
||||
* 2.1 Reporting Bugs
|
||||
* 2.2 Reporting Desyncs
|
||||
3.0) Supported Platforms
|
||||
* 2.1) Reporting bugs
|
||||
* 2.2) Reporting desyncs
|
||||
3.0) Supported platforms
|
||||
4.0) Installing and running OpenTTD
|
||||
* 4.1 (Required) 3rd party files
|
||||
* 4.2 OpenTTD directories
|
||||
* 4.3 Portable Installations (External Media)
|
||||
* 4.1) (Required) 3rd party files
|
||||
* 4.2) OpenTTD directories
|
||||
* 4.3) Portable installations (portable media)
|
||||
5.0) OpenTTD features
|
||||
6.0) Configuration File
|
||||
* 5.1) Logging of potentially dangerous actions
|
||||
6.0) Configuration file
|
||||
7.0) Compiling
|
||||
* 7.1) Required/optional libraries
|
||||
* 7.2) Supported compilers
|
||||
8.0) Translating
|
||||
* 8.1 Translation
|
||||
* 8.2 Previewing
|
||||
* 8.1) Translation
|
||||
* 8.2) Previewing
|
||||
9.0) Troubleshooting
|
||||
X.X) Credits
|
||||
|
||||
|
||||
1.0) About:
|
||||
---- ------
|
||||
1.0) About
|
||||
---- -----
|
||||
OpenTTD is a transport simulation game based upon the popular game Transport
|
||||
Tycoon Deluxe, written by Chris Sawyer. It attempts to mimic the original
|
||||
game as closely as possible while extending it with new features.
|
||||
@@ -36,7 +37,8 @@ game as closely as possible while extending it with new features.
|
||||
OpenTTD is licensed under the GNU General Public License version 2.0. For
|
||||
more information, see the file 'COPYING'.
|
||||
|
||||
2.0) Contacting:
|
||||
|
||||
2.0) Contacting
|
||||
---- ----------
|
||||
The easiest way to contact the OpenTTD team is by submitting bug reports or
|
||||
posting comments in our forums. You can also chat with us on IRC (#openttd
|
||||
@@ -47,9 +49,8 @@ The OpenTTD homepage is http://www.openttd.org/.
|
||||
You can also find the OpenTTD forums at
|
||||
http://forum.openttd.org/
|
||||
|
||||
|
||||
2.1) Reporting Bugs:
|
||||
---- ---------------
|
||||
2.1) Reporting bugs
|
||||
---- --------------
|
||||
First of all, check whether the bug is not already known. Do this by looking
|
||||
through the file called 'known-bugs.txt' which is distributed with OpenTTD
|
||||
like this readme.
|
||||
@@ -87,8 +88,8 @@ following information in your bug report:
|
||||
* Attach crash.dmp, crash.log and crash.sav. These files are usually created
|
||||
next to your openttd.cfg. The crash handler will tell you the location.
|
||||
|
||||
2.2) Reporting Desyncs:
|
||||
---- ------------------
|
||||
2.2) Reporting desyncs
|
||||
---- -----------------
|
||||
As desyncs are hard to make reproducible OpenTTD has the ability to log all
|
||||
actions done by clients so we can replay the whole game in an effort to make
|
||||
desyncs better reproducible. You need to turn this ability on. When turned
|
||||
@@ -140,8 +141,9 @@ Do NOT remove the dmp_cmds savegames of a desync you have reported until the
|
||||
desync has been fixed; if you, by accident, send us the wrong savegames we
|
||||
will not be able to reproduce the desync and thus will be unable to fix it.
|
||||
|
||||
3.0) Supported Platforms:
|
||||
---- --------------------
|
||||
|
||||
3.0) Supported platforms
|
||||
---- -------------------
|
||||
OpenTTD has been ported to several platforms and operating systems. It shouldn't
|
||||
be very difficult to port it to a new platform. The currently working platforms
|
||||
are:
|
||||
@@ -157,9 +159,8 @@ are:
|
||||
Windows - Win32 GDI (faster) or SDL or Allegro
|
||||
|
||||
|
||||
4.0) Installing and running OpenTTD:
|
||||
---- -------------------------------
|
||||
|
||||
4.0) Installing and running OpenTTD
|
||||
---- ------------------------------
|
||||
Installing OpenTTD is fairly straightforward. Either you have downloaded an
|
||||
archive which you have to extract to a directory where you want OpenTTD to
|
||||
be installed, or you have downloaded an installer, which will automatically
|
||||
@@ -186,9 +187,8 @@ automatically selected (and downloaded) if you get the AIs via the "Check
|
||||
Online Content". If you do not have an AI but have configured OpenTTD to start
|
||||
an AI a message will be shown that the 'dummy' AI has been started.
|
||||
|
||||
4.1) (Required) 3rd party files:
|
||||
---- ---------------------------
|
||||
|
||||
4.1) (Required) 3rd party files
|
||||
---- --------------------------
|
||||
Before you run OpenTTD, you need to put the game's data files into a data/
|
||||
directory which can be located in various places addressed in the following
|
||||
section.
|
||||
@@ -248,8 +248,7 @@ wait for an error message to pop up. The error message will tell you
|
||||
"couldn't find library 'lib-name'". Download that library and try again.
|
||||
|
||||
4.2) OpenTTD directories
|
||||
---- -------------------------------
|
||||
|
||||
---- -------------------
|
||||
The required 3rd party files listed in the section 4.1 "(Required) 3rd party files"
|
||||
as well as other non-compulsory extensions (NewGRFs, AI, heightmaps, scenarios) can be
|
||||
placed in a few different locations:
|
||||
@@ -289,10 +288,8 @@ Place 3rd party files in shared directory (or in personal directory if you don't
|
||||
have write access on shared directory) and have your openttd.cfg config file in
|
||||
personal directory (where the game will then also place savegames and screenshots).
|
||||
|
||||
|
||||
4.3) Portable Installations (External Media):
|
||||
---- ----------------------------------------
|
||||
|
||||
4.3) Portable installations (portable media)
|
||||
---- ---------------------------------------
|
||||
You can install OpenTTD on external media so you can take it with you, i.e.
|
||||
using a USB key, or a USB HDD, etc.
|
||||
Create a directory where you shall store the game in (i.e. OpenTTD/).
|
||||
@@ -305,9 +302,8 @@ As always - additional grf files are stored in the data/ dir (for details,
|
||||
again, see section 4.1).
|
||||
|
||||
|
||||
5.0) OpenTTD features:
|
||||
---- -----------------
|
||||
|
||||
5.0) OpenTTD features
|
||||
---- ----------------
|
||||
OpenTTD has a lot of features going beyond the original Transport Tycoon Deluxe
|
||||
emulation. Unfortunately, there is currently no comprehensive list of features,
|
||||
but there is a basic features list on the web, and some optional features can be
|
||||
@@ -326,10 +322,8 @@ Several important non-standard controls:
|
||||
* Hovering over a GUI element shows tooltips. This can be changed to right click
|
||||
via the advanced settings.
|
||||
|
||||
|
||||
5.1) Logging of potentially dangerous actions:
|
||||
5.1) Logging of potentially dangerous actions
|
||||
---- ----------------------------------------
|
||||
|
||||
OpenTTD is a complex program, and together with NewGRF, it may show a buggy
|
||||
behaviour. But not only bugs in code can cause problems. There are several
|
||||
ways to affect game state possibly resulting in program crash or multiplayer
|
||||
@@ -358,8 +352,8 @@ You can show the game log by typing 'gamelog' in the console or by running
|
||||
OpenTTD in debug mode.
|
||||
|
||||
|
||||
6.0) Configuration File:
|
||||
---- -------------------
|
||||
6.0) Configuration file
|
||||
---- ------------------
|
||||
The configuration file for OpenTTD (openttd.cfg) is in a simple Windows-like
|
||||
.INI format. It's mostly undocumented. Almost all settings can be changed
|
||||
ingame by using the 'Advanced Settings' window.
|
||||
@@ -368,8 +362,8 @@ described in section 4.2. If you do not have an openttd.cfg OpenTTD will
|
||||
create one after closing.
|
||||
|
||||
|
||||
7.0) Compiling:
|
||||
---- ----------
|
||||
7.0) Compiling
|
||||
---- ---------
|
||||
Windows:
|
||||
You need Microsoft Visual Studio .NET. Open the project file
|
||||
and it should build automatically. In case you want to build with SDL support
|
||||
@@ -421,8 +415,8 @@ DOS:
|
||||
will be generated that does not need cwsdpmi.exe by adding the cswdstub.exe
|
||||
to the created OpenTTD binary.
|
||||
|
||||
7.1) Required/optional libraries:
|
||||
---- -------------------
|
||||
7.1) Required/optional libraries
|
||||
---- ---------------------------
|
||||
The following libraries are used by OpenTTD for:
|
||||
- libSDL/liballegro: hardware access (video, sound, mouse)
|
||||
- zlib: (de)compressing of old (0.3.0-1.0.5) savegames, content downloads, heightmaps
|
||||
@@ -446,7 +440,7 @@ GRFCodec can be found at: http://www.openttd.org/download-grfcodec
|
||||
The compilation of these extra graphics does generally not happen, unless
|
||||
you remove the graphics file using "make maintainer-clean".
|
||||
|
||||
7.2) Supported compilers:
|
||||
7.2) Supported compilers
|
||||
---- -------------------
|
||||
The following compilers are known to compile OpenTTD:
|
||||
- Microsoft Visual C++ (MSVC) 2005, 2008 and 2010.
|
||||
@@ -470,8 +464,9 @@ The following compilers are known not to compile OpenTTD:
|
||||
If any of these compilers can compile OpenTTD again, please let us know.
|
||||
Patches to support more compilers are welcome.
|
||||
|
||||
8.0) Translating:
|
||||
---- -------------------
|
||||
|
||||
8.0) Translating
|
||||
---- -----------
|
||||
See http://www.openttd.org/development for up-to-date information.
|
||||
|
||||
The use of the online Translator service, located at
|
||||
@@ -485,8 +480,8 @@ Please contact the translations manager (http://www.openttd.org/contact)
|
||||
before beginning the translation process! This avoids double work, as
|
||||
someone else may have already started translating to the same language.
|
||||
|
||||
8.1) Translation:
|
||||
---- -------------------
|
||||
8.1) Translation
|
||||
---- -----------
|
||||
So, now that you've notified the development team about your intention to
|
||||
translate (You did, right? Of course you did.) you can pick up english.txt
|
||||
(found in the SVN repository under /src/lang) and translate.
|
||||
@@ -503,8 +498,8 @@ Note: Do not alter the following parts of the file:
|
||||
* Lines beginning with ## (such as ##id), other than the first two lines of
|
||||
the file
|
||||
|
||||
8.2) Previewing:
|
||||
---- -------------------
|
||||
8.2) Previewing
|
||||
---- ----------
|
||||
In order to view the translation in the game, you need to compile your language
|
||||
file with the strgen utility. You can download the precompiled strgen from:
|
||||
http://www.openttd.org/download-strgen
|
||||
@@ -523,9 +518,9 @@ should also be.
|
||||
|
||||
That's all! You should now be able to select the language in the game options.
|
||||
|
||||
|
||||
9.0) Troubleshooting
|
||||
---- ---------------
|
||||
|
||||
To see all startup options available to you, start OpenTTD with the
|
||||
"./openttd -h" option. This might help you tweak some of the settings.
|
||||
|
||||
@@ -558,8 +553,9 @@ will be output to the console at the moment, so use the '-d' flag (on windows)
|
||||
to see this list. You just have to find the files (http://grfcrawler.tt-forums.net/)
|
||||
put them in the data/ folder and you're set to go.
|
||||
|
||||
X.X) Credits:
|
||||
---- --------
|
||||
|
||||
X.X) Credits
|
||||
---- -------
|
||||
The OpenTTD team (in alphabetical order):
|
||||
Albert Hofkamp (Alberth) - GUI expert
|
||||
Jean-François Claeys (Belugas) - GUI, newindustries and more
|
||||
|
||||
@@ -126,6 +126,8 @@ public:
|
||||
|
||||
/** Wrapper function for AIScanner::GetAIConsoleList */
|
||||
static char *GetConsoleList(char *p, const char *last);
|
||||
/** Wrapper function for AIScanner::GetAIConsoleLibraryList */
|
||||
static char *GetConsoleLibraryList(char *p, const char *last);
|
||||
/** Wrapper function for AIScanner::GetAIInfoList */
|
||||
static const AIInfoList *GetInfoList();
|
||||
/** Wrapper function for AIScanner::GetUniqueAIInfoList */
|
||||
|
||||
@@ -108,10 +108,10 @@ int AIConfig::GetSetting(const char *name) const
|
||||
{
|
||||
SettingValueList::const_iterator it = this->settings.find(name);
|
||||
/* Return the default value if the setting is not set, or if we are in a not-custom difficult level */
|
||||
if (it == this->settings.end() || ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) != 3) {
|
||||
if (it == this->settings.end() || GetGameSettings().difficulty.diff_level != 3) {
|
||||
if (this->info == NULL) {
|
||||
assert(strcmp("start_date", name) == 0);
|
||||
switch ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) {
|
||||
switch (GetGameSettings().difficulty.diff_level) {
|
||||
case 0: return AI::START_NEXT_EASY;
|
||||
case 1: return AI::START_NEXT_MEDIUM;
|
||||
case 2: return AI::START_NEXT_HARD;
|
||||
|
||||
@@ -294,6 +294,11 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
||||
return AI::ai_scanner->GetAIConsoleList(p, last);
|
||||
}
|
||||
|
||||
/* static */ char *AI::GetConsoleLibraryList(char *p, const char *last)
|
||||
{
|
||||
return AI::ai_scanner->GetAIConsoleLibraryList(p, last);
|
||||
}
|
||||
|
||||
/* static */ const AIInfoList *AI::GetInfoList()
|
||||
{
|
||||
return AI::ai_scanner->GetAIInfoList();
|
||||
|
||||
+53
-21
@@ -185,6 +185,11 @@ struct AIListWindow : public Window {
|
||||
|
||||
virtual void OnInvalidateData(int data)
|
||||
{
|
||||
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
|
||||
this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
|
||||
|
||||
/* selected goes from -1 .. length of ai list - 1. */
|
||||
@@ -263,7 +268,7 @@ struct AISettingsWindow : public Window {
|
||||
this->vscroll = this->GetScrollbar(AIS_WIDGET_SCROLLBAR);
|
||||
this->FinishInitNested(desc, slot); // Initializes 'this->line_height' as side effect.
|
||||
|
||||
this->SetWidgetDisabledState(AIS_WIDGET_RESET, _game_mode != GM_MENU);
|
||||
this->SetWidgetDisabledState(AIS_WIDGET_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
|
||||
|
||||
this->vscroll->SetCount((int)this->ai_config->GetConfigList()->size());
|
||||
}
|
||||
@@ -297,7 +302,7 @@ struct AISettingsWindow : public Window {
|
||||
int y = r.top;
|
||||
for (; this->vscroll->IsVisible(i) && it != config->GetConfigList()->end(); i++, it++) {
|
||||
int current_value = config->GetSetting((*it).name);
|
||||
bool editable = (_game_mode == GM_MENU) || ((it->flags & AICONFIG_INGAME) != 0);
|
||||
bool editable = _game_mode == GM_MENU || !Company::IsValidID(this->slot) || (it->flags & AICONFIG_INGAME) != 0;
|
||||
|
||||
StringID str;
|
||||
TextColour colour;
|
||||
@@ -353,7 +358,7 @@ struct AISettingsWindow : public Window {
|
||||
AIConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
|
||||
for (int i = 0; i < num; i++) it++;
|
||||
AIConfigItem config_item = *it;
|
||||
if (_game_mode != GM_MENU && (config_item.flags & AICONFIG_INGAME) == 0) return;
|
||||
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot) && (config_item.flags & AICONFIG_INGAME) == 0) return;
|
||||
|
||||
bool bool_item = (config_item.flags & AICONFIG_BOOLEAN) != 0;
|
||||
|
||||
@@ -398,8 +403,10 @@ struct AISettingsWindow : public Window {
|
||||
break;
|
||||
|
||||
case AIS_WIDGET_RESET:
|
||||
this->ai_config->ResetSettings();
|
||||
this->SetDirty();
|
||||
if (_game_mode == GM_MENU || !Company::IsValidID(this->slot)) {
|
||||
this->ai_config->ResetSettings();
|
||||
this->SetDirty();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -409,6 +416,7 @@ struct AISettingsWindow : public Window {
|
||||
if (StrEmpty(str)) return;
|
||||
AIConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
|
||||
for (int i = 0; i < this->clicked_row; i++) it++;
|
||||
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot) && (it->flags & AICONFIG_INGAME) == 0) return;
|
||||
int32 value = atoi(str);
|
||||
this->ai_config->SetSetting((*it).name, value);
|
||||
this->CheckDifficultyLevel();
|
||||
@@ -429,6 +437,11 @@ struct AISettingsWindow : public Window {
|
||||
this->SetDirty();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnInvalidateData(int data)
|
||||
{
|
||||
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
|
||||
}
|
||||
};
|
||||
|
||||
/** Widgets for the AI settings window. */
|
||||
@@ -556,7 +569,7 @@ struct AIConfigWindow : public Window {
|
||||
{
|
||||
switch (widget) {
|
||||
case AIC_WIDGET_NUMBER:
|
||||
SetDParam(0, _settings_newgame.difficulty.max_no_competitors);
|
||||
SetDParam(0, GetGameSettings().difficulty.max_no_competitors);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -571,6 +584,25 @@ struct AIConfigWindow : public Window {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the AI config in the given company slot be edited?
|
||||
* @param slot The slot to query.
|
||||
* @return True if and only if the given AI Config slot can e edited.
|
||||
*/
|
||||
static bool IsEditable(CompanyID slot)
|
||||
{
|
||||
if (_game_mode != GM_NORMAL) {
|
||||
return slot > 0 && slot <= GetGameSettings().difficulty.max_no_competitors;
|
||||
}
|
||||
if (Company::IsValidID(slot) || slot < 0) return false;
|
||||
|
||||
int max_slot = GetGameSettings().difficulty.max_no_competitors;
|
||||
for (CompanyID cid = COMPANY_FIRST; cid < (CompanyID)max_slot && cid < MAX_COMPANIES; cid++) {
|
||||
if (Company::IsValidHumanID(cid)) max_slot++;
|
||||
}
|
||||
return slot < max_slot;
|
||||
}
|
||||
|
||||
virtual void DrawWidget(const Rect &r, int widget) const
|
||||
{
|
||||
switch (widget) {
|
||||
@@ -579,16 +611,16 @@ struct AIConfigWindow : public Window {
|
||||
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
|
||||
StringID text;
|
||||
|
||||
if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
|
||||
if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
|
||||
text = STR_AI_CONFIG_HUMAN_PLAYER;
|
||||
} else if (AIConfig::GetConfig((CompanyID)i)->GetInfo() != NULL) {
|
||||
SetDParamStr(0, AIConfig::GetConfig((CompanyID)i)->GetInfo()->GetName());
|
||||
text = STR_JUST_RAW_STRING;
|
||||
} else if (i == 0) {
|
||||
text = STR_AI_CONFIG_HUMAN_PLAYER;
|
||||
} else {
|
||||
text = STR_AI_CONFIG_RANDOM_AI;
|
||||
}
|
||||
DrawString(r.left + 10, r.right - 10, y + WD_MATRIX_TOP, text,
|
||||
(this->selected_slot == i) ? TC_WHITE : ((i > _settings_newgame.difficulty.max_no_competitors || i == 0) ? TC_SILVER : TC_ORANGE));
|
||||
(this->selected_slot == i) ? TC_WHITE : (IsEditable((CompanyID)i) ? TC_ORANGE : TC_SILVER));
|
||||
y += this->line_height;
|
||||
}
|
||||
break;
|
||||
@@ -603,9 +635,9 @@ struct AIConfigWindow : public Window {
|
||||
case AIC_WIDGET_INCREASE: {
|
||||
int new_value;
|
||||
if (widget == AIC_WIDGET_DECREASE) {
|
||||
new_value = max(0, _settings_newgame.difficulty.max_no_competitors - 1);
|
||||
new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1);
|
||||
} else {
|
||||
new_value = min(MAX_COMPANIES - 1, _settings_newgame.difficulty.max_no_competitors + 1);
|
||||
new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1);
|
||||
}
|
||||
IConsoleSetSetting("difficulty.max_no_competitors", new_value);
|
||||
this->InvalidateData();
|
||||
@@ -620,8 +652,8 @@ struct AIConfigWindow : public Window {
|
||||
}
|
||||
|
||||
case AIC_WIDGET_MOVE_UP:
|
||||
if (this->selected_slot > 1) {
|
||||
Swap(_settings_newgame.ai_config[this->selected_slot], _settings_newgame.ai_config[this->selected_slot - 1]);
|
||||
if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) {
|
||||
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]);
|
||||
this->selected_slot--;
|
||||
this->vscroll->ScrollTowards(this->selected_slot);
|
||||
this->InvalidateData();
|
||||
@@ -629,8 +661,8 @@ struct AIConfigWindow : public Window {
|
||||
break;
|
||||
|
||||
case AIC_WIDGET_MOVE_DOWN:
|
||||
if (this->selected_slot < _settings_newgame.difficulty.max_no_competitors) {
|
||||
Swap(_settings_newgame.ai_config[this->selected_slot], _settings_newgame.ai_config[this->selected_slot + 1]);
|
||||
if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) {
|
||||
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]);
|
||||
this->selected_slot++;
|
||||
this->vscroll->ScrollTowards(this->selected_slot);
|
||||
this->InvalidateData();
|
||||
@@ -663,16 +695,16 @@ struct AIConfigWindow : public Window {
|
||||
|
||||
virtual void OnInvalidateData(int data)
|
||||
{
|
||||
if (this->selected_slot == 0 || this->selected_slot > _settings_newgame.difficulty.max_no_competitors) {
|
||||
if (!IsEditable(this->selected_slot)) {
|
||||
this->selected_slot = INVALID_COMPANY;
|
||||
}
|
||||
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_DECREASE, _settings_newgame.difficulty.max_no_competitors == 0);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, _settings_newgame.difficulty.max_no_competitors == MAX_COMPANIES - 1);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_DECREASE, GetGameSettings().difficulty.max_no_competitors == 0);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_INCREASE, GetGameSettings().difficulty.max_no_competitors == MAX_COMPANIES - 1);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_CHANGE, this->selected_slot == INVALID_COMPANY);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_CONFIGURE, this->selected_slot == INVALID_COMPANY);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_MOVE_UP, this->selected_slot == INVALID_COMPANY || this->selected_slot == 1);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || this->selected_slot == _settings_newgame.difficulty.max_no_competitors);
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_MOVE_UP, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot - 1)));
|
||||
this->SetWidgetDisabledState(AIC_WIDGET_MOVE_DOWN, this->selected_slot == INVALID_COMPANY || !IsEditable((CompanyID)(this->selected_slot + 1)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ int AIInfo::GetSettingDefaultValue(const char *name) const
|
||||
for (AIConfigItemList::const_iterator it = this->config_list.begin(); it != this->config_list.end(); it++) {
|
||||
if (strcmp((*it).name, name) != 0) continue;
|
||||
/* The default value depends on the difficulty level */
|
||||
switch ((_game_mode == GM_MENU) ? _settings_newgame.difficulty.diff_level : _settings_game.difficulty.diff_level) {
|
||||
switch (GetGameSettings().difficulty.diff_level) {
|
||||
case 0: return (*it).easy_value;
|
||||
case 1: return (*it).medium_value;
|
||||
case 2: return (*it).hard_value;
|
||||
|
||||
@@ -209,6 +209,7 @@ void AIInstance::RegisterAPI()
|
||||
SQAIEventSubsidyExpired_Register(this->engine);
|
||||
SQAIEventSubsidyOffer_Register(this->engine);
|
||||
SQAIEventSubsidyOfferExpired_Register(this->engine);
|
||||
SQAIEventTownFounded_Register(this->engine);
|
||||
SQAIEventVehicleCrashed_Register(this->engine);
|
||||
SQAIEventVehicleLost_Register(this->engine);
|
||||
SQAIEventVehicleUnprofitable_Register(this->engine);
|
||||
|
||||
@@ -343,6 +343,19 @@ char *AIScanner::GetAIConsoleList(char *p, const char *last) const
|
||||
return p;
|
||||
}
|
||||
|
||||
char *AIScanner::GetAIConsoleLibraryList(char *p, const char *last) const
|
||||
{
|
||||
p += seprintf(p, last, "List of AI Libraries:\n");
|
||||
AILibraryList::const_iterator it = this->library_list.begin();
|
||||
for (; it != this->library_list.end(); it++) {
|
||||
AILibrary *i = (*it).second;
|
||||
p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription());
|
||||
}
|
||||
p += seprintf(p, last, "\n");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_NETWORK)
|
||||
#include "../network/network_content.h"
|
||||
#include "../3rdparty/md5/md5.h"
|
||||
|
||||
@@ -58,6 +58,11 @@ public:
|
||||
*/
|
||||
char *GetAIConsoleList(char *p, const char *last) const;
|
||||
|
||||
/**
|
||||
* Get the list of available AI Libraries for the console.
|
||||
*/
|
||||
char *GetAIConsoleLibraryList(char *p, const char *last) const;
|
||||
|
||||
/**
|
||||
* Get the list of all registered AIs.
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,13 @@
|
||||
*
|
||||
* API additions:
|
||||
* \li IsEnd for all lists.
|
||||
* \li AIEventTownFounded
|
||||
* \li AIIndustry::GetIndustryID
|
||||
* \li AIIndustryType::INDUSTRYTYPE_TOWN
|
||||
* \li AIIndustryType::INDUSTRYTYPE_UNKNOWN
|
||||
* \li AIOrder::IsVoidOrder
|
||||
* \li AIRail::GetName
|
||||
* \li AITown::IsCity
|
||||
*
|
||||
* API removals:
|
||||
* \li HasNext for all lists.
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
AI_ET_STATION_FIRST_VEHICLE,
|
||||
AI_ET_DISASTER_ZEPPELINER_CRASHED,
|
||||
AI_ET_DISASTER_ZEPPELINER_CLEARED,
|
||||
AI_ET_TOWN_FOUNDED,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,6 +52,7 @@ void SQAIEvent_Register(Squirrel *engine)
|
||||
SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_STATION_FIRST_VEHICLE, "AI_ET_STATION_FIRST_VEHICLE");
|
||||
SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_DISASTER_ZEPPELINER_CRASHED, "AI_ET_DISASTER_ZEPPELINER_CRASHED");
|
||||
SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_DISASTER_ZEPPELINER_CLEARED, "AI_ET_DISASTER_ZEPPELINER_CLEARED");
|
||||
SQAIEvent.DefSQConst(engine, AIEvent::AI_ET_TOWN_FOUNDED, "AI_ET_TOWN_FOUNDED");
|
||||
|
||||
SQAIEvent.DefSQMethod(engine, &AIEvent::GetEventType, "GetEventType", 1, "x");
|
||||
|
||||
|
||||
@@ -800,4 +800,37 @@ private:
|
||||
StationID station;
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Town Founded, indicating a new town has been created.
|
||||
*/
|
||||
class AIEventTownFounded : public AIEvent {
|
||||
public:
|
||||
/** Get the name of this class to identify it towards squirrel. */
|
||||
static const char *GetClassName() { return "AIEventTownFounded"; }
|
||||
|
||||
/**
|
||||
* @param town The town that was created.
|
||||
*/
|
||||
AIEventTownFounded(TownID town) :
|
||||
AIEvent(AI_ET_TOWN_FOUNDED),
|
||||
town(town)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Convert an AIEvent to the real instance.
|
||||
* @param instance The instance to convert.
|
||||
* @return The converted instance.
|
||||
*/
|
||||
static AIEventTownFounded *Convert(AIEvent *instance) { return (AIEventTownFounded *)instance; }
|
||||
|
||||
/**
|
||||
* Get the TownID of the town.
|
||||
* @return The TownID of the town that was created.
|
||||
*/
|
||||
TownID GetTownID() { return this->town; }
|
||||
|
||||
private:
|
||||
TownID town;
|
||||
};
|
||||
|
||||
#endif /* AI_EVENT_TYPES_HPP */
|
||||
|
||||
@@ -454,3 +454,24 @@ void SQAIEventDisasterZeppelinerCleared_Register(Squirrel *engine)
|
||||
|
||||
SQAIEventDisasterZeppelinerCleared.PostRegister(engine);
|
||||
}
|
||||
|
||||
namespace SQConvert {
|
||||
/* Allow AIEventTownFounded to be used as Squirrel parameter */
|
||||
template <> AIEventTownFounded *GetParam(ForceType<AIEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTownFounded *)instance; }
|
||||
template <> AIEventTownFounded &GetParam(ForceType<AIEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTownFounded *)instance; }
|
||||
template <> const AIEventTownFounded *GetParam(ForceType<const AIEventTownFounded *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIEventTownFounded *)instance; }
|
||||
template <> const AIEventTownFounded &GetParam(ForceType<const AIEventTownFounded &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEventTownFounded *)instance; }
|
||||
template <> int Return<AIEventTownFounded *>(HSQUIRRELVM vm, AIEventTownFounded *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEventTownFounded", res, NULL, DefSQDestructorCallback<AIEventTownFounded>); return 1; }
|
||||
} // namespace SQConvert
|
||||
|
||||
void SQAIEventTownFounded_Register(Squirrel *engine)
|
||||
{
|
||||
DefSQClass <AIEventTownFounded> SQAIEventTownFounded("AIEventTownFounded");
|
||||
SQAIEventTownFounded.PreRegister(engine, "AIEvent");
|
||||
|
||||
SQAIEventTownFounded.DefSQStaticMethod(engine, &AIEventTownFounded::Convert, "Convert", 2, ".x");
|
||||
|
||||
SQAIEventTownFounded.DefSQMethod(engine, &AIEventTownFounded::GetTownID, "GetTownID", 1, "x");
|
||||
|
||||
SQAIEventTownFounded.PostRegister(engine);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,18 @@
|
||||
#include "../../newgrf.h"
|
||||
#include "../../newgrf_generic.h"
|
||||
#include "../../newgrf_station.h"
|
||||
#include "../../strings_func.h"
|
||||
|
||||
/* static */ char *AIRail::GetName(RailType rail_type)
|
||||
{
|
||||
if (!IsRailTypeAvailable(rail_type)) return NULL;
|
||||
|
||||
static const int len = 64;
|
||||
char *railtype_name = MallocT<char>(len);
|
||||
|
||||
::GetString(railtype_name, GetRailTypeInfo((::RailType)rail_type)->strings.menu_text, &railtype_name[len - 1]);
|
||||
return railtype_name;
|
||||
}
|
||||
|
||||
/* static */ bool AIRail::IsRailTile(TileIndex tile)
|
||||
{
|
||||
|
||||
@@ -96,6 +96,18 @@ public:
|
||||
BT_WAYPOINT, ///< Build a rail waypoint
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the name of a rail type.
|
||||
* @param rail_type The rail type to get the name of.
|
||||
* @pre IsRailTypeAvailable(rail_type).
|
||||
* @return The name the rail type has.
|
||||
* @note Since there is no string with only the name of the track, the text which
|
||||
* is shown in the dropdown where you can chose a track type is returned. This
|
||||
* means that the name could be something like "Maglev construction" instead
|
||||
* of just "Maglev".
|
||||
*/
|
||||
static char *GetName(RailType rail_type);
|
||||
|
||||
/**
|
||||
* Checks whether the given tile is actually a tile with rail that can be
|
||||
* used to traverse a tile. This excludes rail depots but includes
|
||||
|
||||
@@ -79,6 +79,7 @@ void SQAIRail_Register(Squirrel *engine)
|
||||
AIError::RegisterErrorMapString(AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
|
||||
AIError::RegisterErrorMapString(AIRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
|
||||
|
||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::GetName, "GetName", 2, ".i");
|
||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTile, "IsRailTile", 2, ".i");
|
||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::IsLevelCrossingTile, "IsLevelCrossingTile", 2, ".i");
|
||||
SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailDepotTile, "IsRailDepotTile", 2, ".i");
|
||||
|
||||
@@ -129,6 +129,13 @@
|
||||
return ::HasBit(::Town::Get(town_id)->statues, _current_company);
|
||||
}
|
||||
|
||||
/* static */ bool AITown::IsCity(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return false;
|
||||
|
||||
return ::Town::Get(town_id)->larger_town;
|
||||
}
|
||||
|
||||
/* static */ int AITown::GetRoadReworkDuration(TownID town_id)
|
||||
{
|
||||
if (!IsValidTown(town_id)) return -1;
|
||||
|
||||
@@ -226,6 +226,14 @@ public:
|
||||
*/
|
||||
static bool HasStatue(TownID town_id);
|
||||
|
||||
/**
|
||||
* Find out if the town is a city.
|
||||
* @param town_id The town to check.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @return True if the town is a city.
|
||||
*/
|
||||
static bool IsCity(TownID town_id);
|
||||
|
||||
/**
|
||||
* Find out how long the town is undergoing road reconstructions.
|
||||
* @param town_id The town to check.
|
||||
|
||||
@@ -71,6 +71,7 @@ void SQAITown_Register(Squirrel *engine)
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::HasStatue, "HasStatue", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::IsCity, "IsCity", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetRoadReworkDuration, "GetRoadReworkDuration", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsCompany, "GetExclusiveRightsCompany", 2, ".i");
|
||||
SQAITown.DefSQStaticMethod(engine, &AITown::GetExclusiveRightsDuration, "GetExclusiveRightsDuration", 2, ".i");
|
||||
|
||||
@@ -26,31 +26,9 @@ enum AircraftSubType {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handle Aircraft specific tasks when an Aircraft enters a hangar
|
||||
* @param *v Vehicle that enters the hangar
|
||||
*/
|
||||
void HandleAircraftEnterHangar(Aircraft *v);
|
||||
|
||||
/**
|
||||
* Get the size of the sprite of an aircraft sprite heading west (used for lists)
|
||||
* @param engine The engine to get the sprite from
|
||||
* @param width The width of the sprite
|
||||
* @param height The height of the sprite
|
||||
*/
|
||||
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
|
||||
|
||||
/**
|
||||
* Updates the status of the Aircraft heading or in the station
|
||||
* @param st Station been updated
|
||||
*/
|
||||
void UpdateAirplanesOnNewStation(const Station *st);
|
||||
|
||||
/**
|
||||
* Update cached values of an aircraft.
|
||||
* Currently caches callback 36 max speed.
|
||||
* @param v Vehicle
|
||||
*/
|
||||
void UpdateAircraftCache(Aircraft *v);
|
||||
|
||||
void AircraftLeaveHangar(Aircraft *v);
|
||||
|
||||
@@ -533,6 +533,11 @@ static void PlayAircraftSound(const Vehicle *v)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update cached values of an aircraft.
|
||||
* Currently caches callback 36 max speed.
|
||||
* @param v Vehicle
|
||||
*/
|
||||
void UpdateAircraftCache(Aircraft *v)
|
||||
{
|
||||
uint max_speed = GetVehicleProperty(v, PROP_AIRCRAFT_SPEED, 0);
|
||||
@@ -1664,7 +1669,7 @@ static bool AirportSetBlocks(Aircraft *v, const AirportFTA *current_pos, const A
|
||||
break;
|
||||
}
|
||||
current = current->next;
|
||||
};
|
||||
}
|
||||
|
||||
/* if the block to be checked is in the next position, then exclude that from
|
||||
* checking, because it has been set by the airplane before */
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ AirportFTAClass::~AirportFTAClass()
|
||||
AirportFTA *next = current->next;
|
||||
free(current);
|
||||
current = next;
|
||||
};
|
||||
}
|
||||
}
|
||||
free(layout);
|
||||
}
|
||||
|
||||
+2
-2
@@ -89,14 +89,14 @@ struct BuildAirToolbarWindow : Window {
|
||||
{
|
||||
switch (widget) {
|
||||
case ATW_AIRPORT:
|
||||
if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT, NULL)) {
|
||||
if (HandlePlacePushButton(this, ATW_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
|
||||
ShowBuildAirportPicker(this);
|
||||
this->last_user_action = widget;
|
||||
}
|
||||
break;
|
||||
|
||||
case ATW_DEMOLISH:
|
||||
HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
|
||||
HandlePlacePushButton(this, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
this->last_user_action = widget;
|
||||
break;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts
|
||||
* @param mirrored Returns whether the part shall be flipped.
|
||||
* @return engine to add or INVALID_ENGINE
|
||||
*/
|
||||
static EngineID GetNextArticPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
|
||||
static EngineID GetNextArticulatedPart(uint index, EngineID front_type, Vehicle *front = NULL, bool *mirrored = NULL)
|
||||
{
|
||||
assert(front == NULL || front->engine_type == front_type);
|
||||
|
||||
@@ -55,7 +55,7 @@ uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
|
||||
|
||||
uint i;
|
||||
for (i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
if (GetNextArticPart(i, engine_type, v) == INVALID_ENGINE) break;
|
||||
if (GetNextArticulatedPart(i, engine_type, v) == INVALID_ENGINE) break;
|
||||
}
|
||||
|
||||
delete v;
|
||||
@@ -113,7 +113,7 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
||||
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||
if (artic_engine == INVALID_ENGINE) break;
|
||||
|
||||
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
|
||||
@@ -138,7 +138,7 @@ bool IsArticulatedVehicleRefittable(EngineID engine)
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return false;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
||||
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||
if (artic_engine == INVALID_ENGINE) break;
|
||||
|
||||
if (IsEngineRefittable(artic_engine)) return true;
|
||||
@@ -165,7 +165,7 @@ void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type,
|
||||
if (!HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
EngineID artic_engine = GetNextArticPart(i, engine);
|
||||
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||
if (artic_engine == INVALID_ENGINE) break;
|
||||
|
||||
veh_cargos = GetAvailableVehicleCargoTypes(artic_engine, include_initial_cargo_type);
|
||||
@@ -223,7 +223,7 @@ bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *carg
|
||||
|
||||
switch (v->type) {
|
||||
case VEH_TRAIN:
|
||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticPart() : NULL;
|
||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
|
||||
break;
|
||||
|
||||
case VEH_ROAD:
|
||||
@@ -270,7 +270,7 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
|
||||
|
||||
switch (v->type) {
|
||||
case VEH_TRAIN:
|
||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticPart() : NULL;
|
||||
v = Train::From(v)->HasArticulatedPart() ? Train::From(v)->GetNextArticulatedPart() : NULL;
|
||||
break;
|
||||
|
||||
case VEH_ROAD:
|
||||
@@ -306,7 +306,7 @@ void AddArticulatedParts(Vehicle *first)
|
||||
Vehicle *v = first;
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
bool flip_image;
|
||||
EngineID engine_type = GetNextArticPart(i, first->engine_type, first, &flip_image);
|
||||
EngineID engine_type = GetNextArticulatedPart(i, first->engine_type, first, &flip_image);
|
||||
if (engine_type == INVALID_ENGINE) return;
|
||||
|
||||
/* In the (very rare) case the GRF reported wrong number of articulated parts
|
||||
|
||||
@@ -33,6 +33,11 @@ static EngineRenew *GetEngineReplacement(EngineRenewList erl, EngineID engine, G
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all engine replacement settings for the company.
|
||||
* @param erl The renewlist for a given company.
|
||||
* @return The new renewlist for the company.
|
||||
*/
|
||||
void RemoveAllEngineReplacement(EngineRenewList *erl)
|
||||
{
|
||||
EngineRenew *er = (EngineRenew *)(*erl);
|
||||
@@ -46,6 +51,14 @@ void RemoveAllEngineReplacement(EngineRenewList *erl)
|
||||
*erl = NULL; // Empty list
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the engine replacement in a given renewlist for an original engine type.
|
||||
* @param erl The renewlist to search in.
|
||||
* @param engine Engine type to be replaced.
|
||||
* @param group The group related to this replacement.
|
||||
* @return The engine type to replace with, or INVALID_ENGINE if no
|
||||
* replacement is in the list.
|
||||
*/
|
||||
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group)
|
||||
{
|
||||
const EngineRenew *er = GetEngineReplacement(erl, engine, group);
|
||||
@@ -56,6 +69,15 @@ EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group)
|
||||
return er == NULL ? INVALID_ENGINE : er->to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an engine replacement to the given renewlist.
|
||||
* @param erl The renewlist to add to.
|
||||
* @param old_engine The original engine type.
|
||||
* @param new_engine The replacement engine type.
|
||||
* @param group The group related to this replacement.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags)
|
||||
{
|
||||
/* Check if the old vehicle is already in the list */
|
||||
@@ -79,6 +101,14 @@ CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, Engi
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an engine replacement from a given renewlist.
|
||||
* @param erl The renewlist from which to remove the replacement
|
||||
* @param engine The original engine type.
|
||||
* @param group The group related to this replacement.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags)
|
||||
{
|
||||
EngineRenew *er = (EngineRenew *)(*erl);
|
||||
|
||||
@@ -17,42 +17,9 @@
|
||||
#include "engine_type.h"
|
||||
#include "group_type.h"
|
||||
|
||||
/**
|
||||
* Remove all engine replacement settings for the company.
|
||||
* @param erl The renewlist for a given company.
|
||||
* @return The new renewlist for the company.
|
||||
*/
|
||||
void RemoveAllEngineReplacement(EngineRenewList *erl);
|
||||
|
||||
/**
|
||||
* Retrieve the engine replacement in a given renewlist for an original engine type.
|
||||
* @param erl The renewlist to search in.
|
||||
* @param engine Engine type to be replaced.
|
||||
* @param group The group related to this replacement.
|
||||
* @return The engine type to replace with, or INVALID_ENGINE if no
|
||||
* replacement is in the list.
|
||||
*/
|
||||
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
|
||||
|
||||
/**
|
||||
* Add an engine replacement to the given renewlist.
|
||||
* @param erl The renewlist to add to.
|
||||
* @param old_engine The original engine type.
|
||||
* @param new_engine The replacement engine type.
|
||||
* @param group The group related to this replacement.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
CommandCost AddEngineReplacement(EngineRenewList *erl, EngineID old_engine, EngineID new_engine, GroupID group, DoCommandFlag flags);
|
||||
|
||||
/**
|
||||
* Remove an engine replacement from a given renewlist.
|
||||
* @param erl The renewlist from which to remove the replacement
|
||||
* @param engine The original engine type.
|
||||
* @param group The group related to this replacement.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
CommandCost RemoveEngineReplacement(EngineRenewList *erl, EngineID engine, GroupID group, DoCommandFlag flags);
|
||||
|
||||
/**
|
||||
|
||||
+3
-11
@@ -25,6 +25,7 @@
|
||||
#include "engine_gui.h"
|
||||
#include "settings_func.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "rail_gui.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -420,18 +421,9 @@ public:
|
||||
this->SetDirty();
|
||||
break;
|
||||
|
||||
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: { // Railtype selection dropdown menu
|
||||
const Company *c = Company::Get(_local_company);
|
||||
DropDownList *list = new DropDownList();
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
/* Skip rail type if it has no label */
|
||||
if (rti->label == 0) continue;
|
||||
list->push_back(new DropDownListStringItem(rti->strings.replace_text, rt, !HasBit(c->avail_railtypes, rt)));
|
||||
}
|
||||
ShowDropDownList(this, list, sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN);
|
||||
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu
|
||||
ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
|
||||
DoCommandP(0, GetCompanySettingIndex("company.renew_keep_length"), Company::Get(_local_company)->settings.renew_keep_length ? 0 : 1, CMD_CHANGE_COMPANY_SETTING);
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
#include "group_type.h"
|
||||
#include "vehicle_type.h"
|
||||
|
||||
/**
|
||||
* When an engine is made buildable or is removed from being buildable, add/remove it from the build/autoreplace lists
|
||||
* @param type The type of engine
|
||||
*/
|
||||
void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type);
|
||||
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g);
|
||||
void ShowReplaceGroupVehicleWindow(GroupID group, VehicleType veh);
|
||||
|
||||
@@ -104,14 +104,6 @@ struct BaseSet {
|
||||
return Tnum_files - this->valid_files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the set information from a loaded ini.
|
||||
* @param ini the ini to read from
|
||||
* @param path the path to this ini file (for filenames)
|
||||
* @param full_filename the full filename of the loaded file (for error reporting purposes)
|
||||
* @param allow_empty_filename empty filenames are valid
|
||||
* @return true if loading was successful.
|
||||
*/
|
||||
bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename = true);
|
||||
|
||||
/**
|
||||
@@ -177,42 +169,11 @@ public:
|
||||
return fs.Scan(GetExtension(), Tbase_set::SUBDIR, Tbase_set::SUBDIR != GM_DIR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set to be used.
|
||||
* @param name of the set to use
|
||||
* @return true if it could be loaded
|
||||
*/
|
||||
static bool SetSet(const char *name);
|
||||
|
||||
/**
|
||||
* Returns a list with the sets.
|
||||
* @param p where to print to
|
||||
* @param last the last character to print to
|
||||
* @return the last printed character
|
||||
*/
|
||||
static char *GetSetsList(char *p, const char *last);
|
||||
|
||||
/**
|
||||
* Count the number of available graphics sets.
|
||||
* @return the number of sets
|
||||
*/
|
||||
static int GetNumSets();
|
||||
|
||||
/**
|
||||
* Get the index of the currently active graphics set
|
||||
* @return the current set's index
|
||||
*/
|
||||
static int GetIndexOfUsedSet();
|
||||
|
||||
/**
|
||||
* Get the name of the graphics set at the specified index
|
||||
* @return the name of the set
|
||||
*/
|
||||
static const Tbase_set *GetSet(int index);
|
||||
/**
|
||||
* Return the used set.
|
||||
* @return the used set.
|
||||
*/
|
||||
static const Tbase_set *GetUsedSet();
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,14 @@ template <class Tbase_set> /* static */ Tbase_set *BaseMedia<Tbase_set>::duplica
|
||||
return false; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the set information from a loaded ini.
|
||||
* @param ini the ini to read from
|
||||
* @param path the path to this ini file (for filenames)
|
||||
* @param full_filename the full filename of the loaded file (for error reporting purposes)
|
||||
* @param allow_empty_filename empty filenames are valid
|
||||
* @return true if loading was successful.
|
||||
*/
|
||||
template <class T, size_t Tnum_files, Subdirectory Tsubdir>
|
||||
bool BaseSet<T, Tnum_files, Tsubdir>::FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool allow_empty_filename)
|
||||
{
|
||||
@@ -208,6 +216,11 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set to be used.
|
||||
* @param name of the set to use
|
||||
* @return true if it could be loaded
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ bool BaseMedia<Tbase_set>::SetSet(const char *name)
|
||||
{
|
||||
@@ -229,6 +242,12 @@ template <class Tbase_set>
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list with the sets.
|
||||
* @param p where to print to
|
||||
* @param last the last character to print to
|
||||
* @return the last printed character
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ char *BaseMedia<Tbase_set>::GetSetsList(char *p, const char *last)
|
||||
{
|
||||
@@ -293,6 +312,10 @@ template <class Tbase_set>
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/**
|
||||
* Count the number of available graphics sets.
|
||||
* @return the number of sets
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ int BaseMedia<Tbase_set>::GetNumSets()
|
||||
{
|
||||
@@ -304,6 +327,10 @@ template <class Tbase_set>
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index of the currently active graphics set
|
||||
* @return the current set's index
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ int BaseMedia<Tbase_set>::GetIndexOfUsedSet()
|
||||
{
|
||||
@@ -316,6 +343,10 @@ template <class Tbase_set>
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the graphics set at the specified index
|
||||
* @return the name of the set
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ const Tbase_set *BaseMedia<Tbase_set>::GetSet(int index)
|
||||
{
|
||||
@@ -327,6 +358,10 @@ template <class Tbase_set>
|
||||
error("Base" SET_TYPE "::GetSet(): index %d out of range", index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the used set.
|
||||
* @return the used set.
|
||||
*/
|
||||
template <class Tbase_set>
|
||||
/* static */ const Tbase_set *BaseMedia<Tbase_set>::GetUsedSet()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 32; }
|
||||
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
// /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||
|
||||
@@ -255,7 +255,7 @@ static const SpriteLoader::Sprite *ResizeSprite(const SpriteLoader::Sprite *spri
|
||||
return sprite;
|
||||
}
|
||||
|
||||
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
/* streams of pixels (a, r, g, b channels)
|
||||
*
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
};
|
||||
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
|
||||
DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
|
||||
}
|
||||
|
||||
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
SpriteLoader::CommonPixel *dst;
|
||||
|
||||
@@ -19,7 +19,7 @@ class Blitter_32bppSimple : public Blitter_32bppBase {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetName() { return "32bpp-simple"; }
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||
// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||
|
||||
@@ -41,7 +41,7 @@ void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
class Blitter_8bppDebug : public Blitter_8bppBase {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetName() { return "8bpp-debug"; }
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
/* Make memory for all zoom-levels */
|
||||
uint memory = sizeof(SpriteData);
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
};
|
||||
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
|
||||
}
|
||||
}
|
||||
|
||||
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
class Blitter_8bppSimple : public Blitter_8bppBase {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
|
||||
/* virtual */ const char *GetName() { return "8bpp-simple"; }
|
||||
};
|
||||
|
||||
@@ -46,8 +46,6 @@ public:
|
||||
PALETTE_ANIMATION_BLITTER, ///< The blitter takes care of the palette animation
|
||||
};
|
||||
|
||||
typedef void *AllocatorProc(size_t size);
|
||||
|
||||
/**
|
||||
* Get the screen depth this blitter works for.
|
||||
* This is either: 8, 16, 24 or 32.
|
||||
@@ -73,7 +71,7 @@ public:
|
||||
/**
|
||||
* Convert a sprite from the loader to our own format.
|
||||
*/
|
||||
virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
|
||||
virtual Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
|
||||
|
||||
/**
|
||||
* Move the destination pointer the requested amount x and y, keeping in mind
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
static FBlitter_Null iFBlitter_Null;
|
||||
|
||||
Sprite *Blitter_Null::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
|
||||
Sprite *Blitter_Null::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Sprite *dest_sprite;
|
||||
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 0; }
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
|
||||
|
||||
+26
-7
@@ -22,6 +22,10 @@
|
||||
#include "sortlist_type.h"
|
||||
#include "widgets/dropdown_func.h"
|
||||
#include "core/geometry_func.hpp"
|
||||
#include "openttd.h"
|
||||
#include "cmd_helper.h"
|
||||
#include "tunnelbridge_map.h"
|
||||
#include "road_gui.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -45,13 +49,27 @@ typedef GUIList<BuildBridgeData> GUIBridgeList; ///< List of bridges, used in #B
|
||||
* Callback executed after a build Bridge CMD has been called
|
||||
*
|
||||
* @param result Whether the build succeeded
|
||||
* @param tile The tile where the command has been executed
|
||||
* @param p1 not used
|
||||
* @param p2 not used
|
||||
* @param end_tile End tile of the bridge.
|
||||
* @param p1 packed start tile coords (~ dx)
|
||||
* @param p2 various bitstuffed elements
|
||||
* - p2 = (bit 0- 7) - bridge type (hi bh)
|
||||
* - p2 = (bit 8-11) - rail type or road types.
|
||||
* - p2 = (bit 15-16) - transport type.
|
||||
*/
|
||||
void CcBuildBridge(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
||||
void CcBuildBridge(const CommandCost &result, TileIndex end_tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (result.Succeeded()) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
|
||||
if (result.Failed()) return;
|
||||
SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, end_tile);
|
||||
|
||||
TransportType transport_type = Extract<TransportType, 15, 2>(p2);
|
||||
|
||||
if (transport_type == TRANSPORT_ROAD) {
|
||||
DiagDirection end_direction = ReverseDiagDir(GetTunnelBridgeDirection(end_tile));
|
||||
ConnectRoadToStructure(end_tile, end_direction);
|
||||
|
||||
DiagDirection start_direction = ReverseDiagDir(GetTunnelBridgeDirection(p1));
|
||||
ConnectRoadToStructure(p1, start_direction);
|
||||
}
|
||||
}
|
||||
|
||||
/** Names of the widgets of the build-bridge selection window. */
|
||||
@@ -190,7 +208,7 @@ public:
|
||||
SetDParam(2, this->bridges->Get(i)->cost);
|
||||
SetDParam(1, b->speed);
|
||||
SetDParam(0, b->material);
|
||||
text_dim = maxdim(text_dim, GetStringBoundingBox(STR_SELECT_BRIDGE_INFO));
|
||||
text_dim = maxdim(text_dim, GetStringBoundingBox(_game_mode == GM_EDITOR ? STR_SELECT_BRIDGE_SCENEDIT_INFO : STR_SELECT_BRIDGE_INFO));
|
||||
}
|
||||
sprite_dim.height++; // Sprite is rendered one pixel down in the matrix field.
|
||||
text_dim.height++; // Allowing the bottom row pixels to be rendered on the edge of the matrix field.
|
||||
@@ -231,7 +249,8 @@ public:
|
||||
SetDParam(0, b->material);
|
||||
|
||||
DrawSprite(b->sprite, b->pal, r.left + WD_MATRIX_LEFT, y + this->resize.step_height - 1 - GetSpriteSize(b->sprite).height);
|
||||
DrawStringMultiLine(r.left + this->bridgetext_offset, r.right, y + 2, y + this->resize.step_height, STR_SELECT_BRIDGE_INFO);
|
||||
DrawStringMultiLine(r.left + this->bridgetext_offset, r.right, y + 2, y + this->resize.step_height,
|
||||
_game_mode == GM_EDITOR ? STR_SELECT_BRIDGE_SCENEDIT_INFO : STR_SELECT_BRIDGE_INFO);
|
||||
y += this->resize.step_height;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -32,24 +32,41 @@ static TileIndex GetBridgeEnd(TileIndex tile, DiagDirection dir)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the northern end of a bridge starting at a middle tile
|
||||
* @param t the bridge tile to find the bridge ramp for
|
||||
*/
|
||||
TileIndex GetNorthernBridgeEnd(TileIndex t)
|
||||
{
|
||||
return GetBridgeEnd(t, ReverseDiagDir(AxisToDiagDir(GetBridgeAxis(t))));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the southern end of a bridge starting at a middle tile
|
||||
* @param t the bridge tile to find the bridge ramp for
|
||||
*/
|
||||
TileIndex GetSouthernBridgeEnd(TileIndex t)
|
||||
{
|
||||
return GetBridgeEnd(t, AxisToDiagDir(GetBridgeAxis(t)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starting at one bridge end finds the other bridge end
|
||||
* @param t the bridge ramp tile to find the other bridge ramp for
|
||||
*/
|
||||
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
||||
{
|
||||
assert(IsBridgeTile(tile));
|
||||
return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height ('z') of a bridge in pixels.
|
||||
* @param tile the bridge ramp tile to get the bridge height from
|
||||
* @return the height of the bridge in pixels
|
||||
*/
|
||||
uint GetBridgeHeight(TileIndex t)
|
||||
{
|
||||
uint h;
|
||||
|
||||
@@ -85,30 +85,10 @@ static inline Axis GetBridgeAxis(TileIndex t)
|
||||
return (Axis)(GB(_m[t].m6, 6, 2) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the northern end of a bridge starting at a middle tile
|
||||
* @param t the bridge tile to find the bridge ramp for
|
||||
*/
|
||||
TileIndex GetNorthernBridgeEnd(TileIndex t);
|
||||
|
||||
/**
|
||||
* Finds the southern end of a bridge starting at a middle tile
|
||||
* @param t the bridge tile to find the bridge ramp for
|
||||
*/
|
||||
TileIndex GetSouthernBridgeEnd(TileIndex t);
|
||||
|
||||
|
||||
/**
|
||||
* Starting at one bridge end finds the other bridge end
|
||||
* @param t the bridge ramp tile to find the other bridge ramp for
|
||||
*/
|
||||
TileIndex GetOtherBridgeEnd(TileIndex t);
|
||||
|
||||
/**
|
||||
* Get the height ('z') of a bridge in pixels.
|
||||
* @param tile the bridge ramp tile to get the bridge height from
|
||||
* @return the height of the bridge in pixels
|
||||
*/
|
||||
uint GetBridgeHeight(TileIndex tile);
|
||||
|
||||
/**
|
||||
|
||||
@@ -609,7 +609,7 @@ static int DrawRailEnginePurchaseInfo(int left, int right, int y, EngineID engin
|
||||
SetDParam(1, rvi->pow_wag_weight);
|
||||
DrawString(left, right, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT);
|
||||
y += FONT_HEIGHT_NORMAL;
|
||||
};
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
+128
-21
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file cargopacket.cpp Implementation of the cargo packets */
|
||||
/** @file cargopacket.cpp Implementation of the cargo packets. */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "core/pool_func.hpp"
|
||||
@@ -25,14 +25,26 @@ void InitializeCargoPackets()
|
||||
_cargopacket_pool.CleanPool();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new packet for savegame loading.
|
||||
*/
|
||||
CargoPacket::CargoPacket()
|
||||
{
|
||||
this->source_type = ST_INDUSTRY;
|
||||
this->source_id = INVALID_SOURCE;
|
||||
}
|
||||
|
||||
/* NOTE: We have to zero memory ourselves here because we are using a 'new'
|
||||
* that, in contrary to all other pools, does not memset to 0. */
|
||||
/**
|
||||
* Creates a new cargo packet.
|
||||
* @param source Source station of the packet.
|
||||
* @param source_xy Source location of the packet.
|
||||
* @param count Number of cargo entities to put in this packet.
|
||||
* @param source_type 'Type' of source the packet comes from (for subsidies).
|
||||
* @param source_id Actual source of the packet (for subsidies).
|
||||
* @pre count != 0
|
||||
* @note We have to zero memory ourselves here because we are using a 'new'
|
||||
* that, in contrary to all other pools, does not memset to 0.
|
||||
*/
|
||||
CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) :
|
||||
feeder_share(0),
|
||||
count(count),
|
||||
@@ -46,6 +58,20 @@ CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, So
|
||||
this->source_type = source_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cargo packet. Initializes the fields that cannot be changed later.
|
||||
* Used when loading or splitting packets.
|
||||
* @param count Number of cargo entities to put in this packet.
|
||||
* @param days_in_transit Number of days the cargo has been in transit.
|
||||
* @param source Station the cargo was initially loaded.
|
||||
* @param source_xy Station location the cargo was initially loaded.
|
||||
* @param loaded_at_xy Location the cargo was loaded last.
|
||||
* @param feeder_share Feeder share the packet has already accumulated.
|
||||
* @param source_type 'Type' of source the packet comes from (for subsidies).
|
||||
* @param source_id Actual source of the packet (for subsidies).
|
||||
* @note We have to zero memory ourselves here because we are using a 'new'
|
||||
* that, in contrary to all other pools, does not memset to 0.
|
||||
*/
|
||||
CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share, SourceType source_type, SourceID source_id) :
|
||||
feeder_share(feeder_share),
|
||||
count(count),
|
||||
@@ -60,9 +86,34 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, T
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates (sets source_id to INVALID_SOURCE) all cargo packets from given source
|
||||
* @param src_type type of source
|
||||
* @param src index of source
|
||||
* Split this packet in two and return the split off part.
|
||||
* @param new_size Size of the remaining part.
|
||||
* @return Split off part.
|
||||
*/
|
||||
FORCEINLINE CargoPacket *CargoPacket::Split(uint new_size)
|
||||
{
|
||||
Money fs = this->feeder_share * new_size / static_cast<uint>(this->count);
|
||||
CargoPacket *cp_new = new CargoPacket(new_size, this->days_in_transit, this->source, this->source_xy, this->loaded_at_xy, fs, this->source_type, this->source_id);
|
||||
this->feeder_share -= fs;
|
||||
this->count -= new_size;
|
||||
return cp_new;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge another packet into this one.
|
||||
* @param cp Packet to be merged in.
|
||||
*/
|
||||
FORCEINLINE void CargoPacket::Merge(CargoPacket *cp)
|
||||
{
|
||||
this->count += cp->count;
|
||||
this->feeder_share += cp->feeder_share;
|
||||
delete cp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates (sets source_id to INVALID_SOURCE) all cargo packets from given source.
|
||||
* @param src_type Type of source.
|
||||
* @param src Index of source.
|
||||
*/
|
||||
/* static */ void CargoPacket::InvalidateAllFrom(SourceType src_type, SourceID src)
|
||||
{
|
||||
@@ -73,8 +124,8 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, T
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates (sets source to INVALID_STATION) all cargo packets from given station
|
||||
* @param sid the station that gets removed
|
||||
* Invalidates (sets source to INVALID_STATION) all cargo packets from given station.
|
||||
* @param sid Station that gets removed.
|
||||
*/
|
||||
/* static */ void CargoPacket::InvalidateAllFrom(StationID sid)
|
||||
{
|
||||
@@ -90,6 +141,9 @@ CargoPacket::CargoPacket(uint16 count, byte days_in_transit, StationID source, T
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Destroy the cargolist ("frees" all cargo packets).
|
||||
*/
|
||||
template <class Tinst>
|
||||
CargoList<Tinst>::~CargoList()
|
||||
{
|
||||
@@ -98,6 +152,11 @@ CargoList<Tinst>::~CargoList()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the cached values to reflect the removal of this packet.
|
||||
* Decreases count and days_in_transit.
|
||||
* @param cp Packet to be removed from cache.
|
||||
*/
|
||||
template <class Tinst>
|
||||
void CargoList<Tinst>::RemoveFromCache(const CargoPacket *cp)
|
||||
{
|
||||
@@ -105,6 +164,11 @@ void CargoList<Tinst>::RemoveFromCache(const CargoPacket *cp)
|
||||
this->cargo_days_in_transit -= cp->days_in_transit * cp->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the cache to reflect adding of this packet.
|
||||
* Increases count and days_in_transit.
|
||||
* @param cp New packet to be inserted.
|
||||
*/
|
||||
template <class Tinst>
|
||||
void CargoList<Tinst>::AddToCache(const CargoPacket *cp)
|
||||
{
|
||||
@@ -112,6 +176,14 @@ void CargoList<Tinst>::AddToCache(const CargoPacket *cp)
|
||||
this->cargo_days_in_transit += cp->days_in_transit * cp->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given cargo packet. Tries to merge it with another one in the
|
||||
* packets list. If no fitting packet is found, appends it.
|
||||
* @warning After appending this packet may not exist anymore!
|
||||
* @note Do not use the cargo packet anymore after it has been appended to this CargoList!
|
||||
* @param cp Cargo packet to add.
|
||||
* @pre cp != NULL
|
||||
*/
|
||||
template <class Tinst>
|
||||
void CargoList<Tinst>::Append(CargoPacket *cp)
|
||||
{
|
||||
@@ -121,10 +193,7 @@ void CargoList<Tinst>::Append(CargoPacket *cp)
|
||||
for (List::reverse_iterator it(this->packets.rbegin()); it != this->packets.rend(); it++) {
|
||||
CargoPacket *icp = *it;
|
||||
if (Tinst::AreMergable(icp, cp) && icp->count + cp->count <= CargoPacket::MAX_COUNT) {
|
||||
icp->count += cp->count;
|
||||
icp->feeder_share += cp->feeder_share;
|
||||
|
||||
delete cp;
|
||||
icp->Merge(cp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +202,11 @@ void CargoList<Tinst>::Append(CargoPacket *cp)
|
||||
this->packets.push_back(cp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Truncates the cargo in this list to the given amount. It leaves the
|
||||
* first count cargo entities and removes the rest.
|
||||
* @param max_remaining Maximum amount of entities to be in the list after the command.
|
||||
*/
|
||||
template <class Tinst>
|
||||
void CargoList<Tinst>::Truncate(uint max_remaining)
|
||||
{
|
||||
@@ -161,6 +234,27 @@ void CargoList<Tinst>::Truncate(uint max_remaining)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the given amount of cargo to another list.
|
||||
* Depending on the value of mta the side effects of this function differ:
|
||||
* - MTA_FINAL_DELIVERY: Destroys the packets that do not originate from a specific station.
|
||||
* - MTA_CARGO_LOAD: Sets the loaded_at_xy value of the moved packets.
|
||||
* - MTA_TRANSFER: Just move without side effects.
|
||||
* - MTA_UNLOAD: Just move without side effects.
|
||||
* @param dest Destination to move the cargo to.
|
||||
* @param count Amount of cargo entities to move.
|
||||
* @param mta How to handle the moving (side effects).
|
||||
* @param data Depending on mta the data of this variable differs:
|
||||
* - MTA_FINAL_DELIVERY - Station ID of packet's origin not to remove.
|
||||
* - MTA_CARGO_LOAD - Station's tile index of load.
|
||||
* - MTA_TRANSFER - Unused.
|
||||
* - MTA_UNLOAD - Unused.
|
||||
* @param payment The payment helper.
|
||||
*
|
||||
* @pre mta == MTA_FINAL_DELIVERY || dest != NULL
|
||||
* @pre mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL
|
||||
* @return True if there are still packets that might be moved from this cargo list.
|
||||
*/
|
||||
template <class Tinst>
|
||||
template <class Tother_inst>
|
||||
bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta, CargoPayment *payment, uint data)
|
||||
@@ -219,16 +313,15 @@ bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta
|
||||
cp->count = left;
|
||||
} else {
|
||||
/* But... the rest needs package splitting. */
|
||||
Money fs = cp->feeder_share * max_move / static_cast<uint>(cp->count);
|
||||
cp->feeder_share -= fs;
|
||||
cp->count -= max_move;
|
||||
CargoPacket *cp_new = cp->Split(max_move);
|
||||
|
||||
CargoPacket *cp_new = new CargoPacket(max_move, cp->days_in_transit, cp->source, cp->source_xy, (mta == MTA_CARGO_LOAD) ? data : cp->loaded_at_xy, fs, cp->source_type, cp->source_id);
|
||||
static_cast<Tinst *>(this)->RemoveFromCache(cp_new); // this reflects the changes in cp.
|
||||
|
||||
if (mta == MTA_TRANSFER) {
|
||||
/* Add the feeder share before inserting in dest. */
|
||||
cp_new->feeder_share += payment->PayTransfer(cp_new, max_move);
|
||||
} else if (mta == MTA_CARGO_LOAD) {
|
||||
cp_new->loaded_at_xy = data;
|
||||
}
|
||||
|
||||
dest->Append(cp_new);
|
||||
@@ -240,6 +333,7 @@ bool CargoList<Tinst>::MoveTo(Tother_inst *dest, uint max_move, MoveToAction mta
|
||||
return it != packets.end();
|
||||
}
|
||||
|
||||
/** Invalidates the cached data and rebuilds it. */
|
||||
template <class Tinst>
|
||||
void CargoList<Tinst>::InvalidateCache()
|
||||
{
|
||||
@@ -251,19 +345,31 @@ void CargoList<Tinst>::InvalidateCache()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the cached values to reflect the removal of this packet.
|
||||
* Decreases count, feeder share and days_in_transit.
|
||||
* @param cp Packet to be removed from cache.
|
||||
*/
|
||||
void VehicleCargoList::RemoveFromCache(const CargoPacket *cp)
|
||||
{
|
||||
this->feeder_share -= cp->feeder_share;
|
||||
this->Parent::RemoveFromCache(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the cache to reflect adding of this packet.
|
||||
* Increases count, feeder share and days_in_transit.
|
||||
* @param cp New packet to be inserted.
|
||||
*/
|
||||
void VehicleCargoList::AddToCache(const CargoPacket *cp)
|
||||
{
|
||||
this->feeder_share += cp->feeder_share;
|
||||
this->Parent::AddToCache(cp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ages the all cargo in this list.
|
||||
*/
|
||||
void VehicleCargoList::AgeCargo()
|
||||
{
|
||||
for (ConstIterator it(this->packets.begin()); it != this->packets.end(); it++) {
|
||||
@@ -276,6 +382,7 @@ void VehicleCargoList::AgeCargo()
|
||||
}
|
||||
}
|
||||
|
||||
/** Invalidates the cached data and rebuild it. */
|
||||
void VehicleCargoList::InvalidateCache()
|
||||
{
|
||||
this->feeder_share = 0;
|
||||
@@ -288,9 +395,9 @@ void VehicleCargoList::InvalidateCache()
|
||||
template class CargoList<VehicleCargoList>;
|
||||
template class CargoList<StationCargoList>;
|
||||
|
||||
/** Autoreplace Vehicle -> Vehicle 'transfer' */
|
||||
/** Autoreplace Vehicle -> Vehicle 'transfer'. */
|
||||
template bool CargoList<VehicleCargoList>::MoveTo(VehicleCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);
|
||||
/** Cargo unloading at a station */
|
||||
/** Cargo unloading at a station. */
|
||||
template bool CargoList<VehicleCargoList>::MoveTo(StationCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);
|
||||
/** Cargo loading at a station */
|
||||
/** Cargo loading at a station. */
|
||||
template bool CargoList<StationCargoList>::MoveTo(VehicleCargoList *, uint max_move, MoveToAction mta, CargoPayment *payment, uint data);
|
||||
|
||||
+67
-151
@@ -25,25 +25,25 @@ struct CargoPacket;
|
||||
|
||||
/** Type of the pool for cargo packets for a little over 16 million packets. */
|
||||
typedef Pool<CargoPacket, CargoPacketID, 1024, 0xFFF000, true, false> CargoPacketPool;
|
||||
/** The actual pool with cargo packets */
|
||||
/** The actual pool with cargo packets. */
|
||||
extern CargoPacketPool _cargopacket_pool;
|
||||
|
||||
template <class Tinst> class CargoList;
|
||||
extern const struct SaveLoad *GetCargoPacketDesc();
|
||||
|
||||
/**
|
||||
* Container for cargo from the same location and time
|
||||
* Container for cargo from the same location and time.
|
||||
*/
|
||||
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
|
||||
private:
|
||||
Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo
|
||||
uint16 count; ///< The amount of cargo in this packet
|
||||
byte days_in_transit; ///< Amount of days this packet has been in transit
|
||||
SourceTypeByte source_type; ///< Type of \c source_id
|
||||
SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid
|
||||
StationID source; ///< The station where the cargo came from first
|
||||
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain)
|
||||
TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle
|
||||
Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo.
|
||||
uint16 count; ///< The amount of cargo in this packet.
|
||||
byte days_in_transit; ///< Amount of days this packet has been in transit.
|
||||
SourceTypeByte source_type; ///< Type of \c source_id.
|
||||
SourceID source_id; ///< Index of source, INVALID_SOURCE if unknown/invalid.
|
||||
StationID source; ///< The station where the cargo came from first.
|
||||
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain).
|
||||
TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle.
|
||||
|
||||
/** The CargoList caches, thus needs to know about it. */
|
||||
template <class Tinst> friend class CargoList;
|
||||
@@ -55,43 +55,19 @@ public:
|
||||
/** Maximum number of items in a single cargo packet. */
|
||||
static const uint16 MAX_COUNT = UINT16_MAX;
|
||||
|
||||
/**
|
||||
* Create a new packet for savegame loading.
|
||||
*/
|
||||
CargoPacket();
|
||||
|
||||
/**
|
||||
* Creates a new cargo packet
|
||||
* @param source the source station of the packet
|
||||
* @param source_xy the source location of the packet
|
||||
* @param count the number of cargo entities to put in this packet
|
||||
* @param source_type the 'type' of source the packet comes from (for subsidies)
|
||||
* @param source_id the actual source of the packet (for subsidies)
|
||||
* @pre count != 0
|
||||
*/
|
||||
CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id);
|
||||
|
||||
/**
|
||||
* Creates a new cargo packet. Initializes the fields that cannot be changed later.
|
||||
* Used when loading or splitting packets.
|
||||
* @param count the number of cargo entities to put in this packet
|
||||
* @param days_in_transit number of days the cargo has been in transit
|
||||
* @param source the station the cargo was initially loaded
|
||||
* @param source_xy the station location the cargo was initially loaded
|
||||
* @param loaded_at_xy the location the cargo was loaded last
|
||||
* @param feeder_share feeder share the packet has already accumulated
|
||||
* @param source_type the 'type' of source the packet comes from (for subsidies)
|
||||
* @param source_id the actual source of the packet (for subsidies)
|
||||
*/
|
||||
CargoPacket(uint16 count, byte days_in_transit, StationID source, TileIndex source_xy, TileIndex loaded_at_xy, Money feeder_share = 0, SourceType source_type = ST_INDUSTRY, SourceID source_id = INVALID_SOURCE);
|
||||
|
||||
/** Destroy the packet */
|
||||
/** Destroy the packet. */
|
||||
~CargoPacket() { }
|
||||
|
||||
CargoPacket *Split(uint new_size);
|
||||
void Merge(CargoPacket *cp);
|
||||
|
||||
/**
|
||||
* Gets the number of 'items' in this packet.
|
||||
* @return the item count
|
||||
* @return Item count.
|
||||
*/
|
||||
FORCEINLINE uint16 Count() const
|
||||
{
|
||||
@@ -101,7 +77,7 @@ public:
|
||||
/**
|
||||
* Gets the amount of money already paid to earlier vehicles in
|
||||
* the feeder chain.
|
||||
* @return the feeder share
|
||||
* @return Feeder share.
|
||||
*/
|
||||
FORCEINLINE Money FeederShare() const
|
||||
{
|
||||
@@ -112,7 +88,7 @@ public:
|
||||
* Gets the number of days this cargo has been in transit.
|
||||
* This number isn't really in days, but in 2.5 days (185 ticks) and
|
||||
* it is capped at 255.
|
||||
* @return the length this cargo has been in transit
|
||||
* @return Length this cargo has been in transit.
|
||||
*/
|
||||
FORCEINLINE byte DaysInTransit() const
|
||||
{
|
||||
@@ -120,8 +96,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of the cargo's source. industry, town or head quarter
|
||||
* @return the source type
|
||||
* Gets the type of the cargo's source. industry, town or head quarter.
|
||||
* @return Source type.
|
||||
*/
|
||||
FORCEINLINE SourceType SourceSubsidyType() const
|
||||
{
|
||||
@@ -129,8 +105,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of the cargo's source. An IndustryID, TownID or CompanyID
|
||||
* @return the source ID
|
||||
* Gets the ID of the cargo's source. An IndustryID, TownID or CompanyID.
|
||||
* @return Source ID.
|
||||
*/
|
||||
FORCEINLINE SourceID SourceSubsidyID() const
|
||||
{
|
||||
@@ -138,8 +114,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of the station where the cargo was loaded for the first time
|
||||
* @return the StationID
|
||||
* Gets the ID of the station where the cargo was loaded for the first time.
|
||||
* @return StationID.
|
||||
*/
|
||||
FORCEINLINE SourceID SourceStation() const
|
||||
{
|
||||
@@ -147,8 +123,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the coordinates of the cargo's source station
|
||||
* @return the source station's coordinates
|
||||
* Gets the coordinates of the cargo's source station.
|
||||
* @return Source station's coordinates.
|
||||
*/
|
||||
FORCEINLINE TileIndex SourceStationXY() const
|
||||
{
|
||||
@@ -156,8 +132,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the coordinates of the cargo's last loading station
|
||||
* @return the last loading station's coordinates
|
||||
* Gets the coordinates of the cargo's last loading station.
|
||||
* @return Last loading station's coordinates.
|
||||
*/
|
||||
FORCEINLINE TileIndex LoadedAtXY() const
|
||||
{
|
||||
@@ -171,69 +147,59 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Iterate over all _valid_ cargo packets from the given start
|
||||
* @param var the variable used as "iterator"
|
||||
* @param start the cargo packet ID of the first packet to iterate over
|
||||
* Iterate over all _valid_ cargo packets from the given start.
|
||||
* @param var Variable used as "iterator".
|
||||
* @param start Cargo packet ID of the first packet to iterate over.
|
||||
*/
|
||||
#define FOR_ALL_CARGOPACKETS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPacket, cargopacket_index, var, start)
|
||||
|
||||
/**
|
||||
* Iterate over all _valid_ cargo packets from the begin of the pool
|
||||
* @param var the variable used as "iterator"
|
||||
* Iterate over all _valid_ cargo packets from the begin of the pool.
|
||||
* @param var Variable used as "iterator".
|
||||
*/
|
||||
#define FOR_ALL_CARGOPACKETS(var) FOR_ALL_CARGOPACKETS_FROM(var, 0)
|
||||
|
||||
/**
|
||||
* Simple collection class for a list of cargo packets
|
||||
* @tparam Tinst The actual instantation of this cargo list
|
||||
* Simple collection class for a list of cargo packets.
|
||||
* @tparam Tinst Actual instantation of this cargo list.
|
||||
*/
|
||||
template <class Tinst>
|
||||
class CargoList {
|
||||
public:
|
||||
/** Container with cargo packets */
|
||||
/** Container with cargo packets. */
|
||||
typedef std::list<CargoPacket *> List;
|
||||
/** The iterator for our container */
|
||||
/** The iterator for our container. */
|
||||
typedef List::iterator Iterator;
|
||||
/** The const iterator for our container */
|
||||
/** The const iterator for our container. */
|
||||
typedef List::const_iterator ConstIterator;
|
||||
|
||||
/** Kind of actions that could be done with packets on move */
|
||||
/** Kind of actions that could be done with packets on move. */
|
||||
enum MoveToAction {
|
||||
MTA_FINAL_DELIVERY, ///< "Deliver" the packet to the final destination, i.e. destroy the packet
|
||||
MTA_CARGO_LOAD, ///< Load the packet onto a vehicle, i.e. set the last loaded station ID
|
||||
MTA_TRANSFER, ///< The cargo is moved as part of a transfer
|
||||
MTA_UNLOAD, ///< The cargo is moved as part of a forced unload
|
||||
MTA_FINAL_DELIVERY, ///< "Deliver" the packet to the final destination, i.e. destroy the packet.
|
||||
MTA_CARGO_LOAD, ///< Load the packet onto a vehicle, i.e. set the last loaded station ID.
|
||||
MTA_TRANSFER, ///< The cargo is moved as part of a transfer.
|
||||
MTA_UNLOAD, ///< The cargo is moved as part of a forced unload.
|
||||
};
|
||||
|
||||
protected:
|
||||
uint count; ///< Cache for the number of cargo entities
|
||||
uint cargo_days_in_transit; ///< Cache for the sum of number of days in transit of each entity; comparable to man-hours
|
||||
uint count; ///< Cache for the number of cargo entities.
|
||||
uint cargo_days_in_transit; ///< Cache for the sum of number of days in transit of each entity; comparable to man-hours.
|
||||
|
||||
List packets; ///< The cargo packets in this list
|
||||
List packets; ///< The cargo packets in this list.
|
||||
|
||||
/**
|
||||
* Update the cache to reflect adding of this packet.
|
||||
* Increases count and days_in_transit
|
||||
* @param cp a new packet to be inserted
|
||||
*/
|
||||
void AddToCache(const CargoPacket *cp);
|
||||
|
||||
/**
|
||||
* Update the cached values to reflect the removal of this packet.
|
||||
* Decreases count and days_in_transit
|
||||
* @param cp Packet to be removed from cache
|
||||
*/
|
||||
void RemoveFromCache(const CargoPacket *cp);
|
||||
|
||||
public:
|
||||
/** Create the cargo list */
|
||||
/** Create the cargo list. */
|
||||
CargoList() {}
|
||||
/** And destroy it ("frees" all cargo packets) */
|
||||
|
||||
~CargoList();
|
||||
|
||||
/**
|
||||
* Returns a pointer to the cargo packet list (so you can iterate over it etc).
|
||||
* @return pointer to the packet list
|
||||
* @return Pointer to the packet list.
|
||||
*/
|
||||
FORCEINLINE const List *Packets() const
|
||||
{
|
||||
@@ -241,8 +207,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this list is empty
|
||||
* @return true if and only if the list is empty
|
||||
* Checks whether this list is empty.
|
||||
* @return True if and only if the list is empty.
|
||||
*/
|
||||
FORCEINLINE bool Empty() const
|
||||
{
|
||||
@@ -250,8 +216,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of cargo entities in this list
|
||||
* @return the before mentioned number
|
||||
* Returns the number of cargo entities in this list.
|
||||
* @return The before mentioned number.
|
||||
*/
|
||||
FORCEINLINE uint Count() const
|
||||
{
|
||||
@@ -259,8 +225,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns source of the first cargo packet in this list
|
||||
* @return the before mentioned source
|
||||
* Returns source of the first cargo packet in this list.
|
||||
* @return The before mentioned source.
|
||||
*/
|
||||
FORCEINLINE StationID Source() const
|
||||
{
|
||||
@@ -268,8 +234,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns average number of days in transit for a cargo entity
|
||||
* @return the before mentioned number
|
||||
* Returns average number of days in transit for a cargo entity.
|
||||
* @return The before mentioned number.
|
||||
*/
|
||||
FORCEINLINE uint DaysInTransit() const
|
||||
{
|
||||
@@ -277,47 +243,12 @@ public:
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Appends the given cargo packet
|
||||
* @warning After appending this packet may not exist anymore!
|
||||
* @note Do not use the cargo packet anymore after it has been appended to this CargoList!
|
||||
* @param cp the cargo packet to add
|
||||
* @pre cp != NULL
|
||||
*/
|
||||
void Append(CargoPacket *cp);
|
||||
|
||||
/**
|
||||
* Truncates the cargo in this list to the given amount. It leaves the
|
||||
* first count cargo entities and removes the rest.
|
||||
* @param max_remaining the maximum amount of entities to be in the list after the command
|
||||
*/
|
||||
void Truncate(uint max_remaining);
|
||||
|
||||
/**
|
||||
* Moves the given amount of cargo to another list.
|
||||
* Depending on the value of mta the side effects of this function differ:
|
||||
* - MTA_FINAL_DELIVERY: destroys the packets that do not originate from a specific station
|
||||
* - MTA_CARGO_LOAD: sets the loaded_at_xy value of the moved packets
|
||||
* - MTA_TRANSFER: just move without side effects
|
||||
* - MTA_UNLOAD: just move without side effects
|
||||
* @param dest the destination to move the cargo to
|
||||
* @param count the amount of cargo entities to move
|
||||
* @param mta how to handle the moving (side effects)
|
||||
* @param data Depending on mta the data of this variable differs:
|
||||
* - MTA_FINAL_DELIVERY - station ID of packet's origin not to remove
|
||||
* - MTA_CARGO_LOAD - station's tile index of load
|
||||
* - MTA_TRANSFER - unused
|
||||
* - MTA_UNLOAD - unused
|
||||
* @param payment The payment helper
|
||||
*
|
||||
* @pre mta == MTA_FINAL_DELIVERY || dest != NULL
|
||||
* @pre mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL
|
||||
* @return true if there are still packets that might be moved from this cargo list
|
||||
*/
|
||||
template <class Tother_inst>
|
||||
bool MoveTo(Tother_inst *dest, uint count, MoveToAction mta, CargoPayment *payment, uint data = 0);
|
||||
|
||||
/** Invalidates the cached data and rebuild it */
|
||||
void InvalidateCache();
|
||||
};
|
||||
|
||||
@@ -326,54 +257,39 @@ public:
|
||||
*/
|
||||
class VehicleCargoList : public CargoList<VehicleCargoList> {
|
||||
protected:
|
||||
/** The (direct) parent of this class */
|
||||
/** The (direct) parent of this class. */
|
||||
typedef CargoList<VehicleCargoList> Parent;
|
||||
|
||||
Money feeder_share; ///< Cache for the feeder share
|
||||
Money feeder_share; ///< Cache for the feeder share.
|
||||
|
||||
/**
|
||||
* Update the cache to reflect adding of this packet.
|
||||
* Increases count, feeder share and days_in_transit
|
||||
* @param cp a new packet to be inserted
|
||||
*/
|
||||
void AddToCache(const CargoPacket *cp);
|
||||
|
||||
/**
|
||||
* Update the cached values to reflect the removal of this packet.
|
||||
* Decreases count, feeder share and days_in_transit
|
||||
* @param cp Packet to be removed from cache
|
||||
*/
|
||||
void RemoveFromCache(const CargoPacket *cp);
|
||||
|
||||
public:
|
||||
/** The super class ought to know what it's doing */
|
||||
/** The super class ought to know what it's doing. */
|
||||
friend class CargoList<VehicleCargoList>;
|
||||
/** The vehicles have a cargo list (and we want that saved). */
|
||||
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
|
||||
|
||||
/**
|
||||
* Returns total sum of the feeder share for all packets
|
||||
* @return the before mentioned number
|
||||
* Returns total sum of the feeder share for all packets.
|
||||
* @return The before mentioned number.
|
||||
*/
|
||||
FORCEINLINE Money FeederShare() const
|
||||
{
|
||||
return this->feeder_share;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ages the all cargo in this list
|
||||
*/
|
||||
void AgeCargo();
|
||||
|
||||
/** Invalidates the cached data and rebuild it */
|
||||
void InvalidateCache();
|
||||
|
||||
/**
|
||||
* Are two the two CargoPackets mergeable in the context of
|
||||
* a list of CargoPackets for a Vehicle?
|
||||
* @param cp1 the first CargoPacket
|
||||
* @param cp2 the second CargoPacket
|
||||
* @return true if they are mergeable
|
||||
* @param cp1 First CargoPacket.
|
||||
* @param cp2 Second CargoPacket.
|
||||
* @return True if they are mergeable.
|
||||
*/
|
||||
static bool AreMergable(const CargoPacket *cp1, const CargoPacket *cp2)
|
||||
{
|
||||
@@ -390,7 +306,7 @@ public:
|
||||
*/
|
||||
class StationCargoList : public CargoList<StationCargoList> {
|
||||
public:
|
||||
/** The super class ought to know what it's doing */
|
||||
/** The super class ought to know what it's doing. */
|
||||
friend class CargoList<StationCargoList>;
|
||||
/** The stations, via GoodsEntry, have a CargoList. */
|
||||
friend const struct SaveLoad *GetGoodsDesc();
|
||||
@@ -398,9 +314,9 @@ public:
|
||||
/**
|
||||
* Are two the two CargoPackets mergeable in the context of
|
||||
* a list of CargoPackets for a Vehicle?
|
||||
* @param cp1 the first CargoPacket
|
||||
* @param cp2 the second CargoPacket
|
||||
* @return true if they are mergeable
|
||||
* @param cp1 First CargoPacket.
|
||||
* @param cp2 Second CargoPacket.
|
||||
* @return True if they are mergeable.
|
||||
*/
|
||||
static bool AreMergable(const CargoPacket *cp1, const CargoPacket *cp2)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,10 @@ void InitializeCheats()
|
||||
memset(&_cheats, 0, sizeof(Cheats));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if any cheat has been used, false otherwise
|
||||
* @return has a cheat been used?
|
||||
*/
|
||||
bool CheatHasBeenUsed()
|
||||
{
|
||||
/* Cannot use lengthof because _cheats is of type Cheats, not Cheat */
|
||||
|
||||
@@ -18,10 +18,6 @@ extern Cheats _cheats;
|
||||
|
||||
void ShowCheatWindow();
|
||||
|
||||
/**
|
||||
* Return true if any cheat has been used, false otherwise
|
||||
* @return has a cheat been used?
|
||||
*/
|
||||
bool CheatHasBeenUsed();
|
||||
|
||||
#endif /* CHEAT_FUNC_H */
|
||||
|
||||
@@ -34,47 +34,24 @@ static const CommandCost CMD_ERROR = CommandCost(INVALID_STRING_ID);
|
||||
*/
|
||||
#define return_cmd_error(errcode) return CommandCost(errcode);
|
||||
|
||||
/**
|
||||
* Execute a command
|
||||
*/
|
||||
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text = NULL);
|
||||
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags);
|
||||
|
||||
/**
|
||||
* Execute a network safe DoCommand function
|
||||
*/
|
||||
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback = NULL, const char *text = NULL, bool my_cmd = true);
|
||||
bool DoCommandP(const CommandContainer *container, bool my_cmd = true);
|
||||
|
||||
/** Internal helper function for DoCommandP. Do not use. */
|
||||
CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only);
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/**
|
||||
* Send a command over the network
|
||||
*/
|
||||
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company);
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
extern Money _additional_cash_required;
|
||||
|
||||
/**
|
||||
* Checks if a integer value belongs to a command.
|
||||
*/
|
||||
bool IsValidCommand(uint32 cmd);
|
||||
/**
|
||||
* Returns the flags from a given command.
|
||||
*/
|
||||
byte GetCommandFlags(uint32 cmd);
|
||||
/**
|
||||
* Returns the name of a given command.
|
||||
*/
|
||||
const char *GetCommandName(uint32 cmd);
|
||||
/**
|
||||
* Returns the current money available which can be used for a command.
|
||||
*/
|
||||
Money GetAvailableMoneyForCommand();
|
||||
|
||||
bool IsCommandAllowedWhilePaused(uint32 cmd);
|
||||
|
||||
/**
|
||||
|
||||
@@ -269,6 +269,8 @@ enum Commands {
|
||||
CMD_SET_VEHICLE_ON_TIME, ///< set the vehicle on time feature (timetable)
|
||||
CMD_AUTOFILL_TIMETABLE, ///< autofill the timetable
|
||||
CMD_SET_TIMETABLE_START, ///< set the date that a timetable should start
|
||||
|
||||
CMD_END ///< Must ALWAYS be on the end of this list!! (period)
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,6 +69,9 @@ struct CompanyProperties {
|
||||
int16 bankrupt_timeout; ///< If bigger than \c 0, amount of time to wait for an answer on an offer to buy this company.
|
||||
Money bankrupt_value;
|
||||
|
||||
uint32 terraform_limit; ///< Amount of tileheights we can (still) terraform (times 65536).
|
||||
uint32 clear_limit; ///< Amount of tiles we can (still) clear (times 65536).
|
||||
|
||||
/**
|
||||
* If \c true, the company is (also) controlled by the computer (a NoAI program).
|
||||
* @note It is possible that the user is also participating in such a company.
|
||||
|
||||
+30
-5
@@ -34,6 +34,7 @@
|
||||
#include "vehicle_base.h"
|
||||
#include "vehicle_func.h"
|
||||
#include "sprite.h"
|
||||
#include "smallmap_gui.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -57,6 +58,9 @@ Company::Company(uint16 name_1, bool is_ai)
|
||||
this->name_1 = name_1;
|
||||
this->location_of_HQ = INVALID_TILE;
|
||||
this->is_ai = is_ai;
|
||||
this->terraform_limit = _settings_game.construction.terraform_frame_burst << 16;
|
||||
this->clear_limit = _settings_game.construction.clear_frame_burst << 16;
|
||||
|
||||
for (uint j = 0; j < 4; j++) this->share_owners[j] = COMPANY_SPECTATOR;
|
||||
InvalidateWindowData(WC_PERFORMANCE_DETAIL, 0, INVALID_COMPANY);
|
||||
}
|
||||
@@ -116,10 +120,10 @@ void SetLocalCompany(CompanyID new_company)
|
||||
* @param company Company to get the colour of.
|
||||
* @return Colour of \a company.
|
||||
*/
|
||||
uint16 GetDrawStringCompanyColour(CompanyID company)
|
||||
TextColour GetDrawStringCompanyColour(CompanyID company)
|
||||
{
|
||||
if (!Company::IsValidID(company)) return _colour_gradient[COLOUR_WHITE][4] | IS_PALETTE_COLOUR;
|
||||
return (_colour_gradient[_company_colours[company]][4]) | IS_PALETTE_COLOUR;
|
||||
if (!Company::IsValidID(company)) return (TextColour)_colour_gradient[COLOUR_WHITE][4] | TC_IS_PALETTE_COLOUR;
|
||||
return (TextColour)_colour_gradient[_company_colours[company]][4] | TC_IS_PALETTE_COLOUR;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,6 +255,16 @@ void SubtractMoneyFromCompanyFract(CompanyID company, CommandCost cst)
|
||||
if (cost != 0) SubtractMoneyFromAnyCompany(c, CommandCost(cst.GetExpensesType(), cost));
|
||||
}
|
||||
|
||||
/** Update the landscaping limits per company. */
|
||||
void UpdateLandscapingLimits()
|
||||
{
|
||||
Company *c;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
c->terraform_limit = min(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, (uint32)_settings_game.construction.terraform_frame_burst << 16);
|
||||
c->clear_limit = min(c->clear_limit + _settings_game.construction.clear_per_64k_frames, (uint32)_settings_game.construction.clear_frame_burst << 16);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the right DParams to get the name of an owner.
|
||||
* @param owner the owner to get the name of.
|
||||
@@ -423,7 +437,7 @@ static Colours GenerateCompanyColour()
|
||||
Swap(colours[j - 1], colours[j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* Move the colours that look similar to each company's colour to the side */
|
||||
Company *c;
|
||||
@@ -487,6 +501,11 @@ restart:;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the livery schemes to the company's primary colour.
|
||||
* This is used on loading games without livery information and on new company start up.
|
||||
* @param c Company to reset.
|
||||
*/
|
||||
void ResetCompanyLivery(Company *c)
|
||||
{
|
||||
for (LiveryScheme scheme = LS_BEGIN; scheme < LS_END; scheme++) {
|
||||
@@ -539,6 +558,8 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY)
|
||||
SetWindowDirty(WC_GRAPH_LEGEND, 0);
|
||||
SetWindowDirty(WC_TOOLBAR_MENU, 0);
|
||||
SetWindowDirty(WC_CLIENT_LIST, 0);
|
||||
BuildOwnerLegend();
|
||||
InvalidateWindowData(WC_SMALLMAP, 0, 1);
|
||||
|
||||
if (is_ai && (!_networking || _network_server)) AI::StartNew(c->index);
|
||||
|
||||
@@ -814,7 +835,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
assert(_local_company == COMPANY_SPECTATOR);
|
||||
SetLocalCompany(c->index);
|
||||
if (!StrEmpty(_settings_client.network.default_company_pass)) {
|
||||
NetworkChangeCompanyPassword(_settings_client.network.default_company_pass);
|
||||
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
|
||||
}
|
||||
|
||||
/* Now that we have a new company, broadcast our company settings to
|
||||
@@ -896,6 +917,10 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
default: return CMD_ERROR;
|
||||
}
|
||||
|
||||
InvalidateWindowClassesData(WC_GAME_OPTIONS);
|
||||
InvalidateWindowClassesData(WC_AI_SETTINGS);
|
||||
InvalidateWindowClassesData(WC_AI_LIST);
|
||||
|
||||
return CommandCost();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ void SetLocalCompany(CompanyID new_company);
|
||||
void ShowBuyCompanyDialog(CompanyID company);
|
||||
void CompanyAdminUpdate(const Company *company);
|
||||
void CompanyAdminBankrupt(CompanyID company_id);
|
||||
void UpdateLandscapingLimits();
|
||||
|
||||
extern CompanyByte _local_company;
|
||||
extern CompanyByte _current_company;
|
||||
|
||||
+2
-1
@@ -13,8 +13,9 @@
|
||||
#define COMPANY_GUI_H
|
||||
|
||||
#include "company_type.h"
|
||||
#include "gfx_type.h"
|
||||
|
||||
uint16 GetDrawStringCompanyColour(CompanyID company);
|
||||
TextColour GetDrawStringCompanyColour(CompanyID company);
|
||||
void DrawCompanyIcon(CompanyID c, int x, int y);
|
||||
|
||||
void ShowCompanyStations(CompanyID company);
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ enum Owner {
|
||||
};
|
||||
DECLARE_POSTFIX_INCREMENT(Owner)
|
||||
|
||||
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 31; ///< The maximum length of a president name in characters including '\0'
|
||||
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0'
|
||||
static const uint MAX_LENGTH_PRESIDENT_NAME_PIXELS = 94; ///< The maximum length of a president name in pixels
|
||||
static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0'
|
||||
static const uint MAX_LENGTH_COMPANY_NAME_PIXELS = 150; ///< The maximum length of a company name in pixels
|
||||
|
||||
+8
-9
@@ -20,13 +20,8 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define ICON_BUFFER 79
|
||||
#define ICON_HISTORY_SIZE 20
|
||||
#define ICON_LINE_HEIGHT 12
|
||||
#define ICON_RIGHT_BORDERWIDTH 10
|
||||
#define ICON_BOTTOM_BORDERWIDTH 12
|
||||
#define ICON_MAX_ALIAS_LINES 40
|
||||
#define ICON_TOKEN_COUNT 20
|
||||
static const uint ICON_TOKEN_COUNT = 20; ///< Maximum number of tokens in one command
|
||||
static const uint ICON_MAX_ALIAS_LINES = 40; ///< Maximum number of commands executed by one alias
|
||||
|
||||
/* console parser */
|
||||
IConsoleCmd *_iconsole_cmds; ///< list of registered commands
|
||||
@@ -89,8 +84,10 @@ void IConsoleFree()
|
||||
* @param colour_code the colour of the command. Red in case of errors, etc.
|
||||
* @param string the message entered or output on the console (notice, error, etc.)
|
||||
*/
|
||||
void IConsolePrint(ConsoleColour colour_code, const char *string)
|
||||
void IConsolePrint(TextColour colour_code, const char *string)
|
||||
{
|
||||
assert(IsValidConsoleColour(colour_code));
|
||||
|
||||
char *str;
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_redirect_console_to_client != INVALID_CLIENT_ID) {
|
||||
@@ -131,8 +128,10 @@ void IConsolePrint(ConsoleColour colour_code, const char *string)
|
||||
* by any other means. Uses printf() style format, for more information look
|
||||
* at IConsolePrint()
|
||||
*/
|
||||
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *format, ...)
|
||||
void CDECL IConsolePrintF(TextColour colour_code, const char *format, ...)
|
||||
{
|
||||
assert(IsValidConsoleColour(colour_code));
|
||||
|
||||
va_list va;
|
||||
char buf[ICON_MAX_STREAMSIZE];
|
||||
|
||||
|
||||
+58
-28
@@ -161,17 +161,6 @@ DEF_CONSOLE_CMD(ConResetTile)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConStopAllVehicles)
|
||||
{
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Stops all vehicles in the game. For debugging only! Use at your own risk... Usage: 'stopall'");
|
||||
return true;
|
||||
}
|
||||
|
||||
StopAllVehicles();
|
||||
return true;
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
DEF_CONSOLE_CMD(ConScrollToTile)
|
||||
@@ -958,7 +947,7 @@ DEF_CONSOLE_CMD(ConEchoC)
|
||||
}
|
||||
|
||||
if (argc < 3) return false;
|
||||
IConsolePrint((ConsoleColour)atoi(argv[1]), argv[2]);
|
||||
IConsolePrint((TextColour)Clamp(atoi(argv[1]), TC_BEGIN, TC_END - 1), argv[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -995,21 +984,40 @@ DEF_CONSOLE_CMD(ConRestart)
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AI
|
||||
DEF_CONSOLE_CMD(ConListAI)
|
||||
/**
|
||||
* Print a text buffer line by line to the console. Lines are seperated by '\n'.
|
||||
* @param buf The buffer to print.
|
||||
* @note All newlines are replace by '\0' characters.
|
||||
*/
|
||||
static void PrintLineByLine(char *buf)
|
||||
{
|
||||
char buf[4096];
|
||||
char *p = &buf[0];
|
||||
p = AI::GetConsoleList(p, lastof(buf));
|
||||
|
||||
p = &buf[0];
|
||||
char *p = buf;
|
||||
/* Print output line by line */
|
||||
for (char *p2 = &buf[0]; *p2 != '\0'; p2++) {
|
||||
for (char *p2 = buf; *p2 != '\0'; p2++) {
|
||||
if (*p2 == '\n') {
|
||||
*p2 = '\0';
|
||||
IConsolePrintF(CC_DEFAULT, "%s", p);
|
||||
p = p2 + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConListAILibs)
|
||||
{
|
||||
char buf[4096];
|
||||
AI::GetConsoleLibraryList(buf, lastof(buf));
|
||||
|
||||
PrintLineByLine(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConListAI)
|
||||
{
|
||||
char buf[4096];
|
||||
AI::GetConsoleList(buf, lastof(buf));
|
||||
|
||||
PrintLineByLine(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1507,24 +1515,46 @@ DEF_CONSOLE_CMD(ConSayClient)
|
||||
return true;
|
||||
}
|
||||
|
||||
extern void HashCurrentCompanyPassword(const char *password);
|
||||
|
||||
DEF_CONSOLE_CMD(ConCompanyPassword)
|
||||
{
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Change the password of your company. Usage: 'company_pw \"<password>\"'");
|
||||
const char *helpmsg;
|
||||
|
||||
if (_network_dedicated) {
|
||||
helpmsg = "Change the password of a company. Usage: 'company_pw <company-no> \"<password>\"";
|
||||
} else if (_network_server) {
|
||||
helpmsg = "Change the password of your or any other company. Usage: 'company_pw [<company-no>] \"<password>\"'";
|
||||
} else {
|
||||
helpmsg = "Change the password of your company. Usage: 'company_pw \"<password>\"'";
|
||||
}
|
||||
|
||||
IConsoleHelp(helpmsg);
|
||||
IConsoleHelp("Use \"*\" to disable the password.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argc != 2) return false;
|
||||
CompanyID company_id;
|
||||
const char *password;
|
||||
const char *errormsg;
|
||||
|
||||
if (!Company::IsValidID(_local_company)) {
|
||||
IConsoleError("You have to own a company to make use of this command.");
|
||||
if (argc == 2) {
|
||||
company_id = _local_company;
|
||||
password = argv[1];
|
||||
errormsg = "You have to own a company to make use of this command.";
|
||||
} else if (argc == 3 && _network_server) {
|
||||
company_id = (CompanyID)(atoi(argv[1]) - 1);
|
||||
password = argv[2];
|
||||
errormsg = "You have to specify the ID of a valid human controlled company.";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *password = NetworkChangeCompanyPassword(argv[1]);
|
||||
if (!Company::IsValidHumanID(company_id)) {
|
||||
IConsoleError(errormsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
password = NetworkChangeCompanyPassword(company_id, password, false);
|
||||
|
||||
if (StrEmpty(password)) {
|
||||
IConsolePrintF(CC_WARNING, "Company password cleared");
|
||||
@@ -1628,7 +1658,7 @@ DEF_CONSOLE_CMD(ConContent)
|
||||
static const char * const types[] = { "Base graphics", "NewGRF", "AI", "AI library", "Scenario", "Heightmap", "Base sound", "Base music" };
|
||||
assert_compile(lengthof(types) == CONTENT_TYPE_END - CONTENT_TYPE_BEGIN);
|
||||
static const char * const states[] = { "Not selected", "Selected", "Dep Selected", "Installed", "Unknown" };
|
||||
static const ConsoleColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR };
|
||||
static const TextColour state_to_colour[] = { CC_COMMAND, CC_INFO, CC_INFO, CC_WHITE, CC_ERROR };
|
||||
|
||||
const ContentInfo *ci = *iter;
|
||||
IConsolePrintF(state_to_colour[ci->state], "%d, %s, %s, %s", ci->id, types[ci->type - 1], states[ci->state], ci->name);
|
||||
@@ -1725,7 +1755,6 @@ DEF_CONSOLE_CMD(ConNewGRFReload)
|
||||
static void IConsoleDebugLibRegister()
|
||||
{
|
||||
IConsoleCmdRegister("resettile", ConResetTile);
|
||||
IConsoleCmdRegister("stopall", ConStopAllVehicles);
|
||||
IConsoleAliasRegister("dbg_echo", "echo %A; echo %B");
|
||||
IConsoleAliasRegister("dbg_echo2", "echo %!");
|
||||
}
|
||||
@@ -1782,6 +1811,7 @@ void IConsoleStdLibRegister()
|
||||
IConsoleAliasRegister("developer", "setting developer %+");
|
||||
|
||||
#ifdef ENABLE_AI
|
||||
IConsoleCmdRegister("list_ai_libs", ConListAILibs);
|
||||
IConsoleCmdRegister("list_ai", ConListAI);
|
||||
IConsoleCmdRegister("reload_ai", ConReloadAI);
|
||||
IConsoleCmdRegister("rescan_ai", ConRescanAI);
|
||||
|
||||
+4
-2
@@ -23,8 +23,8 @@ void IConsoleFree();
|
||||
void IConsoleClose();
|
||||
|
||||
/* console output */
|
||||
void IConsolePrint(ConsoleColour colour_code, const char *string);
|
||||
void CDECL IConsolePrintF(ConsoleColour colour_code, const char *format, ...) WARN_FORMAT(2, 3);
|
||||
void IConsolePrint(TextColour colour_code, const char *string);
|
||||
void CDECL IConsolePrintF(TextColour colour_code, const char *format, ...) WARN_FORMAT(2, 3);
|
||||
void IConsoleDebug(const char *dbg, const char *string);
|
||||
void IConsoleWarning(const char *string);
|
||||
void IConsoleError(const char *string);
|
||||
@@ -32,4 +32,6 @@ void IConsoleError(const char *string);
|
||||
/* Parser */
|
||||
void IConsoleCmdExec(const char *cmdstr);
|
||||
|
||||
bool IsValidConsoleColour(TextColour c);
|
||||
|
||||
#endif /* CONSOLE_FUNC_H */
|
||||
|
||||
+23
-2
@@ -489,8 +489,29 @@ static void IConsoleHistoryNavigate(int direction)
|
||||
* @param colour_code the colour of the command. Red in case of errors, etc.
|
||||
* @param str the message entered or output on the console (notice, error, etc.)
|
||||
*/
|
||||
void IConsoleGUIPrint(ConsoleColour colour_code, char *str)
|
||||
void IConsoleGUIPrint(TextColour colour_code, char *str)
|
||||
{
|
||||
new IConsoleLine(str, (TextColour)colour_code);
|
||||
new IConsoleLine(str, colour_code);
|
||||
SetWindowDirty(WC_CONSOLE, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check whether the given TextColour is valid for console usage.
|
||||
* @param c The text colour to compare to.
|
||||
* @return true iff the TextColour is valid for console usage.
|
||||
*/
|
||||
bool IsValidConsoleColour(TextColour c)
|
||||
{
|
||||
/* A normal text colour is used. */
|
||||
if (!(c & TC_IS_PALETTE_COLOUR)) return TC_BEGIN <= c && c < TC_END;
|
||||
|
||||
/* A text colour from the palette is used; must be the company
|
||||
* colour gradient, so it must be one of those. */
|
||||
c &= ~TC_IS_PALETTE_COLOUR;
|
||||
for (uint i = TC_BEGIN; i < TC_END; i++) {
|
||||
if (_colour_gradient[i][4] == c) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ bool GetArgumentInteger(uint32 *value, const char *arg);
|
||||
|
||||
void IConsoleGUIInit();
|
||||
void IConsoleGUIFree();
|
||||
void IConsoleGUIPrint(ConsoleColour colour_code, char *string);
|
||||
void IConsoleGUIPrint(TextColour colour_code, char *string);
|
||||
char *RemoveUnderscores(char *name);
|
||||
|
||||
#endif /* CONSOLE_INTERNAL_H */
|
||||
|
||||
+10
-10
@@ -12,6 +12,8 @@
|
||||
#ifndef CONSOLE_TYPE_H
|
||||
#define CONSOLE_TYPE_H
|
||||
|
||||
#include "gfx_type.h"
|
||||
|
||||
/** Modes of the in-game console. */
|
||||
enum IConsoleModes {
|
||||
ICONSOLE_FULL, ///< In-game console is closed.
|
||||
@@ -19,15 +21,13 @@ enum IConsoleModes {
|
||||
ICONSOLE_CLOSED ///< In-game console is opened, whole screen.
|
||||
};
|
||||
|
||||
/** Colours of the console messages. */
|
||||
enum ConsoleColour {
|
||||
CC_DEFAULT = 1,
|
||||
CC_ERROR = 3,
|
||||
CC_WARNING = 13,
|
||||
CC_INFO = 8,
|
||||
CC_DEBUG = 5,
|
||||
CC_COMMAND = 2,
|
||||
CC_WHITE = 12,
|
||||
};
|
||||
/* Colours of the console messages. */
|
||||
static const TextColour CC_DEFAULT = TC_SILVER; ///< Default colour of the console.
|
||||
static const TextColour CC_ERROR = TC_RED; ///< Colour for error lines.
|
||||
static const TextColour CC_WARNING = TC_LIGHT_BLUE; ///< Colour for warning lines.
|
||||
static const TextColour CC_INFO = TC_YELLOW; ///< Colour for information lines.
|
||||
static const TextColour CC_DEBUG = TC_LIGHT_BROWN; ///< Colour for debug output.
|
||||
static const TextColour CC_COMMAND = TC_GOLD; ///< Colour for the console's commands.
|
||||
static const TextColour CC_WHITE = TC_WHITE; ///< White console lines for various things such as the welcome.
|
||||
|
||||
#endif /* CONSOLE_TYPE_H */
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
#include "smallvec_type.hpp"
|
||||
#include "sort_func.hpp"
|
||||
|
||||
/** Simple pair of data. Both types have to be POD ("Plain Old Data")! */
|
||||
/**
|
||||
* Simple pair of data. Both types have to be POD ("Plain Old Data")!
|
||||
* @tvar T Key type.
|
||||
* @tvar U Value type.
|
||||
*/
|
||||
template <typename T, typename U>
|
||||
struct SmallPair {
|
||||
T first;
|
||||
@@ -28,6 +32,10 @@ struct SmallPair {
|
||||
/**
|
||||
* Implementation of simple mapping class. Both types have to be POD ("Plain Old Data")!
|
||||
* It has inherited accessors from SmallVector().
|
||||
* @tvar T Key type.
|
||||
* @tvar U Value type.
|
||||
* @tvar S Unit of allocation.
|
||||
*
|
||||
* @see SmallVector
|
||||
*/
|
||||
template <typename T, typename U, uint S = 16>
|
||||
|
||||
@@ -73,6 +73,12 @@ char *CrashLog::LogCompiler(char *buffer, const char *last) const
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes OpenTTD's version to the buffer.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const
|
||||
{
|
||||
return buffer + seprintf(buffer, last,
|
||||
@@ -105,6 +111,13 @@ char *CrashLog::LogOpenTTDVersion(char *buffer, const char *last) const
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the (important) configuration settings to the buffer.
|
||||
* E.g. graphics set, sound set, blitter and AIs.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::LogConfiguration(char *buffer, const char *last) const
|
||||
{
|
||||
buffer += seprintf(buffer, last,
|
||||
@@ -181,6 +194,12 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
|
||||
# include <zlib.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Writes information (versions) of the used libraries.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::LogLibraries(char *buffer, const char *last) const
|
||||
{
|
||||
buffer += seprintf(buffer, last, "Libraries:\n");
|
||||
@@ -243,11 +262,21 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for printing the gamelog.
|
||||
* @param s the string to print.
|
||||
*/
|
||||
/* static */ void CrashLog::GamelogFillCrashLog(const char *s)
|
||||
{
|
||||
CrashLog::gamelog_buffer += seprintf(CrashLog::gamelog_buffer, CrashLog::gamelog_last, "%s\n", s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the gamelog data to the buffer.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::LogGamelog(char *buffer, const char *last) const
|
||||
{
|
||||
CrashLog::gamelog_buffer = buffer;
|
||||
@@ -256,6 +285,12 @@ char *CrashLog::LogGamelog(char *buffer, const char *last) const
|
||||
return CrashLog::gamelog_buffer + seprintf(CrashLog::gamelog_buffer, last, "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill the crash log buffer with all data of a crash log.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *CrashLog::FillCrashLog(char *buffer, const char *last) const
|
||||
{
|
||||
time_t cur_time = time(NULL);
|
||||
@@ -281,6 +316,15 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the crash log to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* crash log file. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param buffer The begin of the buffer to write to the disk.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash log was successfully written.
|
||||
*/
|
||||
bool CrashLog::WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const
|
||||
{
|
||||
seprintf(filename, filename_last, "%scrash.log", _personal_dir);
|
||||
@@ -301,6 +345,14 @@ bool CrashLog::WriteCrashLog(const char *buffer, char *filename, const char *fil
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the (crash) savegame to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* crash save file. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash save was successfully made.
|
||||
*/
|
||||
bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
|
||||
{
|
||||
/* If the map array doesn't exist, saving will fail too. If the map got
|
||||
@@ -319,6 +371,14 @@ bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the (crash) screenshot to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* screenshot. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash screenshot was successfully made.
|
||||
*/
|
||||
bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const
|
||||
{
|
||||
/* Don't draw when we have invalid screen size */
|
||||
@@ -329,6 +389,12 @@ bool CrashLog::WriteScreenshot(char *filename, const char *filename_last) const
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the crash log, writes it to a file and then subsequently tries
|
||||
* to make a crash dump and crash savegame. It uses DEBUG to write
|
||||
* information like paths to the console.
|
||||
* @return true when everything is made successfully.
|
||||
*/
|
||||
bool CrashLog::MakeCrashLog() const
|
||||
{
|
||||
/* Don't keep looping logging crashes. */
|
||||
@@ -384,11 +450,19 @@ bool CrashLog::MakeCrashLog() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a message for the error message handler.
|
||||
* @param message The error message of the error.
|
||||
*/
|
||||
/* static */ void CrashLog::SetErrorMessage(const char *message)
|
||||
{
|
||||
CrashLog::message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to close the sound/video stuff so it doesn't keep lingering around
|
||||
* incorrect video states or so, e.g. keeping dpmi disabled.
|
||||
*/
|
||||
/* static */ void CrashLog::AfterCrashLogCleanup()
|
||||
{
|
||||
if (_music_driver != NULL) _music_driver->Stop();
|
||||
|
||||
@@ -26,10 +26,6 @@ private:
|
||||
/** Temporary 'local' location of the end of the buffer. */
|
||||
static const char *gamelog_last;
|
||||
|
||||
/**
|
||||
* Helper function for printing the gamelog.
|
||||
* @param s the string to print.
|
||||
*/
|
||||
static void GamelogFillCrashLog(const char *s);
|
||||
protected:
|
||||
/**
|
||||
@@ -85,60 +81,16 @@ protected:
|
||||
virtual char *LogModules(char *buffer, const char *last) const;
|
||||
|
||||
|
||||
/**
|
||||
* Writes OpenTTD's version to the buffer.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *LogOpenTTDVersion(char *buffer, const char *last) const;
|
||||
|
||||
/**
|
||||
* Writes the (important) configuration settings to the buffer.
|
||||
* E.g. graphics set, sound set, blitter and AIs.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *LogConfiguration(char *buffer, const char *last) const;
|
||||
|
||||
/**
|
||||
* Writes information (versions) of the used libraries.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *LogLibraries(char *buffer, const char *last) const;
|
||||
|
||||
/**
|
||||
* Writes the gamelog data to the buffer.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *LogGamelog(char *buffer, const char *last) const;
|
||||
|
||||
public:
|
||||
/** Stub destructor to silence some compilers. */
|
||||
virtual ~CrashLog() {}
|
||||
|
||||
/**
|
||||
* Fill the crash log buffer with all data of a crash log.
|
||||
* @param buffer The begin where to write at.
|
||||
* @param last The last position in the buffer to write to.
|
||||
* @return the position of the \c '\0' character after the buffer.
|
||||
*/
|
||||
char *FillCrashLog(char *buffer, const char *last) const;
|
||||
|
||||
/**
|
||||
* Write the crash log to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* crash log file. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param buffer The begin of the buffer to write to the disk.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash log was successfully written.
|
||||
*/
|
||||
bool WriteCrashLog(const char *buffer, char *filename, const char *filename_last) const;
|
||||
|
||||
/**
|
||||
@@ -151,33 +103,9 @@ public:
|
||||
* was successful (not all OSes support dumping files).
|
||||
*/
|
||||
virtual int WriteCrashDump(char *filename, const char *filename_last) const;
|
||||
|
||||
/**
|
||||
* Write the (crash) savegame to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* crash save file. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash save was successfully made.
|
||||
*/
|
||||
bool WriteSavegame(char *filename, const char *filename_last) const;
|
||||
|
||||
/**
|
||||
* Write the (crash) screenshot to a file.
|
||||
* @note On success the filename will be filled with the full path of the
|
||||
* screenshot. Make sure filename is at least \c MAX_PATH big.
|
||||
* @param filename Output for the filename of the written file.
|
||||
* @param filename_last The last position in the filename buffer.
|
||||
* @return true when the crash screenshot was successfully made.
|
||||
*/
|
||||
bool WriteScreenshot(char *filename, const char *filename_last) const;
|
||||
|
||||
/**
|
||||
* Makes the crash log, writes it to a file and then subsequently tries
|
||||
* to make a crash dump and crash savegame. It uses DEBUG to write
|
||||
* information like paths to the console.
|
||||
* @return true when everything is made successfully.
|
||||
*/
|
||||
bool MakeCrashLog() const;
|
||||
|
||||
/**
|
||||
@@ -187,16 +115,7 @@ public:
|
||||
*/
|
||||
static void InitialiseCrashLog();
|
||||
|
||||
/**
|
||||
* Sets a message for the error message handler.
|
||||
* @param message The error message of the error.
|
||||
*/
|
||||
static void SetErrorMessage(const char *message);
|
||||
|
||||
/**
|
||||
* Try to close the sound/video stuff so it doesn't keep lingering around
|
||||
* incorrect video states or so, e.g. keeping dpmi disabled.
|
||||
*/
|
||||
static void AfterCrashLogCleanup();
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = {
|
||||
{ 3, "", CF_NOEURO, "", NBSP"TL", 1, STR_GAME_OPTIONS_CURRENCY_TRY }, ///< turkish lira
|
||||
{ 52, "", 2009, "", NBSP"Sk", 1, STR_GAME_OPTIONS_CURRENCY_SKK }, ///< slovak koruna
|
||||
{ 4, "", CF_NOEURO, "R$"NBSP, "", 0, STR_GAME_OPTIONS_CURRENCY_BRL }, ///< brazil real
|
||||
{ 20, "", CF_NOEURO, "", NBSP"EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni
|
||||
{ 20, "", 2011, "", NBSP"EEK", 1, STR_GAME_OPTIONS_CURRENCY_EEK }, ///< estonian krooni
|
||||
{ 1, "", CF_NOEURO, "", "", 2, STR_GAME_OPTIONS_CURRENCY_CUSTOM }, ///< custom currency
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ extern CurrencySpec _currency_specs[NUM_CURRENCY];
|
||||
|
||||
/* XXX small hack, but makes the rest of the code a bit nicer to read */
|
||||
#define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
|
||||
#define _currency ((const CurrencySpec*)&_currency_specs[_game_mode == GM_MENU ? _settings_newgame.locale.currency : _settings_game.locale.currency])
|
||||
#define _currency ((const CurrencySpec*)&_currency_specs[GetGameSettings().locale.currency])
|
||||
|
||||
uint GetMaskOfAllowedCurrencies();
|
||||
void CheckSwitchToEuro();
|
||||
|
||||
+1
-1
@@ -849,7 +849,7 @@ struct DepotWindow : Window {
|
||||
this->sel = INVALID_VEHICLE;
|
||||
this->vehicle_over = INVALID_VEHICLE;
|
||||
this->SetWidgetDirty(DEPOT_WIDGET_MATRIX);
|
||||
};
|
||||
}
|
||||
|
||||
virtual void OnMouseDrag(Point pt, int widget)
|
||||
{
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
typedef uint16 DepotID;
|
||||
struct Depot;
|
||||
|
||||
static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 31; ///< The maximum length of a depot name in characters including '\0'
|
||||
static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 32; ///< The maximum length of a depot name in characters including '\0'
|
||||
static const uint MAX_LENGTH_DEPOT_NAME_PIXELS = 180; ///< The maximum length of a depot name in pixels
|
||||
|
||||
#endif /* DEPOT_TYPE_H */
|
||||
|
||||
@@ -307,7 +307,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
|
||||
|
||||
RoadVehicle *u;
|
||||
FOR_ALL_ROADVEHICLES(u) {
|
||||
if (u->IsRoadVehFront()) {
|
||||
if (u->IsFrontEngine()) {
|
||||
v->dest_tile = u->index;
|
||||
v->age = 0;
|
||||
return true;
|
||||
@@ -319,7 +319,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
|
||||
} else {
|
||||
/* Target a vehicle */
|
||||
RoadVehicle *u = RoadVehicle::Get(v->dest_tile);
|
||||
assert(u != NULL && u->type == VEH_ROAD && u->IsRoadVehFront());
|
||||
assert(u != NULL && u->type == VEH_ROAD && u->IsFrontEngine());
|
||||
|
||||
uint dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);
|
||||
|
||||
|
||||
+9
-9
@@ -134,39 +134,39 @@ struct BuildDocksToolbarWindow : Window {
|
||||
this->last_clicked_widget = (DockToolbarWidgets)widget;
|
||||
switch (widget) {
|
||||
case DTW_CANAL: // Build canal button
|
||||
HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT, NULL);
|
||||
HandlePlacePushButton(this, DTW_CANAL, SPR_CURSOR_CANAL, HT_RECT);
|
||||
break;
|
||||
|
||||
case DTW_LOCK: // Build lock button
|
||||
HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL, NULL);
|
||||
HandlePlacePushButton(this, DTW_LOCK, SPR_CURSOR_LOCK, HT_SPECIAL);
|
||||
break;
|
||||
|
||||
case DTW_DEMOLISH: // Demolish aka dynamite button
|
||||
HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL, NULL);
|
||||
HandlePlacePushButton(this, DTW_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
|
||||
break;
|
||||
|
||||
case DTW_DEPOT: // Build depot button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT, NULL)) ShowBuildDocksDepotPicker(this);
|
||||
if (HandlePlacePushButton(this, DTW_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this);
|
||||
break;
|
||||
|
||||
case DTW_STATION: // Build station button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL, NULL)) ShowBuildDockStationPicker(this);
|
||||
if (HandlePlacePushButton(this, DTW_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this);
|
||||
break;
|
||||
|
||||
case DTW_BUOY: // Build buoy button
|
||||
if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return;
|
||||
HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BOUY, HT_RECT, NULL);
|
||||
HandlePlacePushButton(this, DTW_BUOY, SPR_CURSOR_BUOY, HT_RECT);
|
||||
break;
|
||||
|
||||
case DTW_RIVER: // Build river button (in scenario editor)
|
||||
if (_game_mode != GM_EDITOR) return;
|
||||
HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT, NULL);
|
||||
HandlePlacePushButton(this, DTW_RIVER, SPR_CURSOR_RIVER, HT_RECT);
|
||||
break;
|
||||
|
||||
case DTW_BUILD_AQUEDUCT: // Build aqueduct button
|
||||
HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL, NULL);
|
||||
HandlePlacePushButton(this, DTW_BUILD_AQUEDUCT, SPR_CURSOR_AQUEDUCT, HT_SPECIAL);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
@@ -318,7 +318,7 @@ static const NWidgetPart _nested_build_docks_toolbar_widgets[] = {
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEMOLISH), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_DEPOT), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DEPOT, STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_STATION), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_SHIP_DOCK, STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BOUY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUOY), SetMinimalSize(22, 22), SetFill(0, 1), SetDataTip(SPR_IMG_BUOY, STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP),
|
||||
NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, DTW_BUILD_AQUEDUCT), SetMinimalSize(23, 22), SetFill(0, 1), SetDataTip(SPR_IMG_AQUEDUCT, STR_WATERWAYS_TOOLBAR_BUILD_AQUEDUCT_TOOLTIP),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
+1
-1
@@ -677,7 +677,7 @@ void RecomputePrices()
|
||||
SetWindowClassesDirty(WC_BUILD_VEHICLE);
|
||||
SetWindowClassesDirty(WC_REPLACE_VEHICLE);
|
||||
SetWindowClassesDirty(WC_VEHICLE_DETAILS);
|
||||
SetWindowDirty(WC_PAYMENT_RATES, 0);
|
||||
InvalidateWindowData(WC_PAYMENT_RATES, 0);
|
||||
}
|
||||
|
||||
/** Let all companies pay the monthly interest on their loan. */
|
||||
|
||||
@@ -473,6 +473,13 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws wires on a tunnel tile
|
||||
*
|
||||
* DrawTile_TunnelBridge() calls this function to draw the wires on the bridge.
|
||||
*
|
||||
* @param ti The Tileinfo to draw the tile for
|
||||
*/
|
||||
void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||
{
|
||||
TileIndex end = GetSouthernBridgeEnd(ti->tile);
|
||||
@@ -530,6 +537,11 @@ void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws overhead wires and pylons for electric railways.
|
||||
* @param ti The TileInfo struct of the tile being drawn
|
||||
* @see DrawCatenaryRailway
|
||||
*/
|
||||
void DrawCatenary(const TileInfo *ti)
|
||||
{
|
||||
switch (GetTileType(ti->tile)) {
|
||||
|
||||
@@ -34,11 +34,6 @@ static inline bool HasCatenaryDrawn(RailType rt)
|
||||
return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws overhead wires and pylons for electric railways.
|
||||
* @param ti The TileInfo struct of the tile being drawn
|
||||
* @see DrawCatenaryRailway
|
||||
*/
|
||||
void DrawCatenary(const TileInfo *ti);
|
||||
void DrawCatenaryOnTunnel(const TileInfo *ti);
|
||||
void DrawCatenaryOnBridge(const TileInfo *ti);
|
||||
|
||||
+45
-3
@@ -44,6 +44,11 @@ EngineOverrideManager _engine_mngr;
|
||||
*/
|
||||
static Year _year_engine_aging_stops;
|
||||
|
||||
/**
|
||||
* The railtypes that have been or never will be introduced, or
|
||||
* an inverse bitmap of rail types that have to be introduced. */
|
||||
static uint16 _introduced_railtypes;
|
||||
|
||||
/** Number of engines of each vehicle type in original engine data */
|
||||
const uint8 _engine_counts[4] = {
|
||||
lengthof(_orig_rail_vehicle_info),
|
||||
@@ -195,7 +200,7 @@ uint Engine::GetDisplayDefaultCapacity(uint16 *mail_capacity) const
|
||||
return GetEngineProperty(this->index, PROP_SHIP_CARGO_CAPACITY, this->u.ship.capacity);
|
||||
|
||||
case VEH_AIRCRAFT: {
|
||||
uint capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_PASSENGER_CAPACITY, this->u.air.passenger_capacity);;
|
||||
uint capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_PASSENGER_CAPACITY, this->u.air.passenger_capacity);
|
||||
CargoID cargo = this->GetDefaultCargoType();
|
||||
if (IsCargoInClass(cargo, CC_PASSENGERS)) {
|
||||
if (mail_capacity != NULL) *mail_capacity = GetEngineProperty(this->index, PROP_AIRCRAFT_MAIL_CAPACITY, this->u.air.mail_capacity);
|
||||
@@ -474,8 +479,30 @@ void SetupEngines()
|
||||
const Engine *e = new Engine(eid->type, eid->internal_id);
|
||||
assert(e->index == index);
|
||||
}
|
||||
|
||||
_introduced_railtypes = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the railtypes should be introduced.
|
||||
*/
|
||||
static void CheckRailIntroduction()
|
||||
{
|
||||
/* All railtypes have been introduced. */
|
||||
if (_introduced_railtypes == UINT16_MAX || Company::GetPoolSize() == 0) return;
|
||||
|
||||
/* We need to find the railtypes that are known to all companies. */
|
||||
RailTypes rts = (RailTypes)UINT16_MAX;
|
||||
|
||||
/* We are at, or past the introduction date of the rail. */
|
||||
Company *c;
|
||||
FOR_ALL_COMPANIES(c) {
|
||||
c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes, _date);
|
||||
rts &= c->avail_railtypes;
|
||||
}
|
||||
|
||||
_introduced_railtypes |= rts;
|
||||
}
|
||||
|
||||
void ShowEnginePreviewWindow(EngineID engine);
|
||||
|
||||
@@ -602,6 +629,19 @@ void StartupEngines()
|
||||
c->avail_roadtypes = GetCompanyRoadtypes(c->index);
|
||||
}
|
||||
|
||||
/* Rail types that are invalid or never introduced are marked as
|
||||
* being introduced upon start. That way we can easily check whether
|
||||
* there is any date related introduction that is still going to
|
||||
* happen somewhere in the future. */
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
const RailtypeInfo *rti = GetRailTypeInfo(rt);
|
||||
if (rti->label != 0 && IsInsideMM(rti->introduction_date, 0, MAX_DAY)) continue;
|
||||
|
||||
SetBit(_introduced_railtypes, rt);
|
||||
}
|
||||
|
||||
CheckRailIntroduction();
|
||||
|
||||
/* Invalidate any open purchase lists */
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE);
|
||||
}
|
||||
@@ -614,7 +654,7 @@ static void AcceptEnginePreview(EngineID eid, CompanyID company)
|
||||
SetBit(e->company_avail, company);
|
||||
if (e->type == VEH_TRAIN) {
|
||||
assert(e->u.rail.railtype < RAILTYPE_END);
|
||||
SetBit(c->avail_railtypes, e->u.rail.railtype);
|
||||
c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes | GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes, _date);
|
||||
} else if (e->type == VEH_ROAD) {
|
||||
SetBit(c->avail_roadtypes, HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
|
||||
}
|
||||
@@ -663,6 +703,8 @@ static CompanyID GetBestCompany(uint8 pp)
|
||||
/** Daily check to offer an exclusive engine preview to the companies. */
|
||||
void EnginesDailyLoop()
|
||||
{
|
||||
CheckRailIntroduction();
|
||||
|
||||
if (_cur_year >= _year_engine_aging_stops) return;
|
||||
|
||||
Engine *e;
|
||||
@@ -760,7 +802,7 @@ static void NewVehicleAvailable(Engine *e)
|
||||
/* maybe make another rail type available */
|
||||
RailType railtype = e->u.rail.railtype;
|
||||
assert(railtype < RAILTYPE_END);
|
||||
FOR_ALL_COMPANIES(c) SetBit(c->avail_railtypes, railtype);
|
||||
FOR_ALL_COMPANIES(c) c->avail_railtypes = AddDateIntroducedRailTypes(c->avail_railtypes | GetRailTypeInfo(e->u.rail.railtype)->introduces_railtypes, _date);
|
||||
} else if (e->type == VEH_ROAD) {
|
||||
/* maybe make another road type available */
|
||||
FOR_ALL_COMPANIES(c) SetBit(c->avail_roadtypes, HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ enum EngineFlags {
|
||||
};
|
||||
|
||||
static const uint NUM_VEHICLE_TYPES = 6;
|
||||
static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 31; ///< The maximum length of an engine name in characters including '\0'
|
||||
static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32; ///< The maximum length of an engine name in characters including '\0'
|
||||
static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160; ///< The maximum length of an engine name in pixels
|
||||
|
||||
static const EngineID INVALID_ENGINE = 0xFFFF;
|
||||
|
||||
+16
-4
@@ -1007,10 +1007,22 @@ const Sprite *GetGlyph(FontSize size, WChar key)
|
||||
|
||||
FT_UInt glyph_index = FT_Get_Char_Index(face, key);
|
||||
if (glyph_index == 0) {
|
||||
GetGlyph(size, '?');
|
||||
glyph = GetGlyphPtr(size, '?');
|
||||
SetGlyphPtr(size, key, glyph, true);
|
||||
return glyph->sprite;
|
||||
if (key == '?') {
|
||||
/* The font misses the '?' character. Use sprite font. */
|
||||
SpriteID sprite = GetUnicodeGlyph(size, key);
|
||||
Sprite *spr = (Sprite*)GetRawSprite(sprite, ST_FONT, AllocateFont);
|
||||
assert(spr != NULL);
|
||||
new_glyph.sprite = spr;
|
||||
new_glyph.width = spr->width + (size != FS_NORMAL);
|
||||
SetGlyphPtr(size, key, &new_glyph, false);
|
||||
return new_glyph.sprite;
|
||||
} else {
|
||||
/* Use '?' for missing characters. */
|
||||
GetGlyph(size, '?');
|
||||
glyph = GetGlyphPtr(size, '?');
|
||||
SetGlyphPtr(size, key, glyph, true);
|
||||
return glyph->sprite;
|
||||
}
|
||||
}
|
||||
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
|
||||
FT_Render_Glyph(face->glyph, aa ? FT_RENDER_MODE_NORMAL : FT_RENDER_MODE_MONO);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user