-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDatConverter.sh
More file actions
executable file
·720 lines (637 loc) · 19.7 KB
/
DatConverter.sh
File metadata and controls
executable file
·720 lines (637 loc) · 19.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
#!/bin/bash
#set -e
#general functions that don't have a single purpose
trim() {
#removes unintentional white spaces
#returns the string to the command line
#acts recursive, in case there is a white space at the beginning or the end of the string it will remove that and run itself again
local String=$1
if [ ${#String} -gt 0 ]
then
if [ ${String:0:1} == ' ' ]
then
String=${String:1:${#String}}
String="$(trim $String)"
fi
if [ ${String: (( ${#String} - 1 )) :${#String}} == ' ' ]
then
String=${String:0: (( ${#String} - 1 )) }
String="$(trim $String)"
fi
fi
echo "$String"
}
#functions related to reading the goods from the goods file
readgoods() {
#opens the goods.dat file
#creates a new GoodArray including all the parameters of a single good
#runs readgoodline for each line in the file
#saves the good to an array when it's fully read
local GoodsFile=`cat pakset/buildings/factories/goods/goods.dat | tr -d '\r'`
`rm -f calculated/pakset/buildings/factories/goods/goods.dat`
declare -A GoodArray
IFS='
'
for Line in $GoodsFile; do
PosMin=`expr index "$Line" '-'`
if [ $PosMin -eq 1 ]
then
savegoodtoram
unset GoodArray
declare -A GoodArray
else
readgoodline $Line
fi
done
savegoodtoram
unset GoodArray
}
readgoodline() {
#reads a line and adds it to the ObjectArray
local Line="$1"
shift
local PosHash=`expr index "$Line" '#'`
local PosEq=`expr index "$Line" '='`
if [ $PosHash -gt 0 ]
then
Line=${Line:1:${#Line}}
PosEq=$(($PosEq - 1))
if [ $PosEq -gt 0 ] && [ `expr index "$Line" '#'` == 0 ]
then
Name=${Line:0:$((PosEq - 1))}
Name="$(trim $Name)"
Value=${Line:PosEq}
Value="$(trim $Value)"
GoodArray[$Name]=$Value
fi
Line=${Line:0:$((PosHash - 1))}
else
if [ $PosEq -gt 0 -a ${#Line} -gt 0 ]
then
Name=${Line:0:$((PosEq - 1))}
Name="$(trim $Name)"
Value=${Line:PosEq}
Value="$(trim $Value)"
GoodArray[$Name]=$Value
fi
fi
}
savegoodtoram() {
#echo ${GoodArray[@]}
if [[ ${GoodArray[name]} == "" ]]
then
return
fi
if [ ${GoodArray[catg]} -eq 0 ];then
GoodsValueArray[${GoodArray[name]}]="${GoodArray[value]}"
GoodsSpeedBonusArray[${GoodArray[name]}]="${GoodArray[speed_bonus]}"
GoodsWeigthArray[${GoodArray[name]}]="${GoodArray[weight_per_unit]}"
else
if [ "${GoodArray[name]}" == "catg${GoodArray[catg]}" ];then
GoodsValueArray[${GoodArray[name]}]=${GoodArray[value]}
GoodsSpeedBonusArray[${GoodArray[name]}]=${GoodArray[speed_bonus]}
GoodsWeigthArray[${GoodArray[name]}]=${GoodArray[weight_per_unit]}
else
GoodsValueArray[${GoodArray[name]}]=${GoodsValueArray[catg${GoodArray[catg]}]}
GoodsSpeedBonusArray[${GoodArray[name]}]=${GoodsSpeedBonusArray[catg${GoodArray[catg]}]}
GoodsWeigthArray[${GoodArray[name]}]=${GoodsWeigthArray[catg${GoodArray[catg]}]}
fi
fi
}
getspeedbonus() {
local Waytype=$1
local Year=$2
local IFS='
'
local Year1=0
local Year2=0
local Value1=0
local Value2=0
local Counter=0
local Speedbonus=0
for Line in $SpeedBonusFile; do
local PosHash=`expr index "$Line" '#'`
if [ $PosHash -gt 0 ]
then
Line=${Line:0:$((PosHash - 1))}
fi
if [ "${Line:0:${#Waytype}}" == "${Waytype}" ]
then
Line=${Line:$((${#Waytype} + 1)):${#Line}}
local IFS=','
for Number in $Line
do
if [ $Counter -eq 0 ];then
Year2=$Year1
Year1=$Number
if [ $Year1 -eq $Year ] || [ $Year1 -gt $Year ] ;then
Counter=2
else
Counter=1
fi
else
if [ $Counter -eq 1 ];then
Counter=0
Value2=$Value1
Value1=$Number
else
if [ $Counter -eq 2 ];then
Counter=3
Value2=$Value1
Value1=$Number
Speedbonus=$(( Value2 + ( Value1 - Value2 ) * ( Year - Year2 ) / ( Year1 - Year2 ) ))
fi
fi
fi
done
local IFS='
'
fi
done
if [[ $Speedbonus -eq 0 ]];then
Speedbonus=$Value1
fi
echo $Speedbonus
}
getincome() {
#returns the income multiplied by 1.000
local Good=$1
local Payload=$2
local Waytype=$3
local Year=$4
local Speed=$5
local SpeedBonus="$(getspeedbonus $Waytype $Year)"
local GoodSpeedBonus=${GoodsSpeedBonusArray[$Good]}
local GoodValue=${GoodsValueArray[$Good]}
local Income=0
GoodSpeedBonus=$(( GoodSpeedBonus + 2 ))
#echo "Speed: "$Speed" ; GoodSpeedBonus: "$GoodSpeedBonus" ; SpeedBonus: "$SpeedBonus;
#calculate the speedbonus multiplied by 10.000
if [ $SpeedBonus -eq 0 ];then
Income=10000
else
Income=$(( (( Speed * 1000 / SpeedBonus ) - 1000 ) * ( GoodSpeedBonus ) + 10000 ))
#(( 13/3 Speed <= SpeedBonus )
fi
#calculate the income
Income=$(( Income * Payload * GoodValue / 3 ))
#lowering the multiplyer to times 10
Income=$(( Income / 10 ))
if [ 0 -gt $Income ];then
Income=0
fi
echo $Income
}
readallfiles() {
local directionary=$1
IFS='
'
if [ ${#directionary[@]} -gt 0 ] ; then
for dat in $directionary ; do
if [ -f "$dat" ] ; then
echo "-- Performing Work At: $dat "
readfile $dat
fi
done
fi
}
readfile() {
#opens a file
#creates a new ObjectArray
#runs readline for each line in the file
local Filename=$1
#echo "nutze cat";
local File=`cat $Filename | tr -d '\r'`
`rm -f calculated/$Filename`
declare -A ObjectArray
local IFS='
'
for Line in $File; do
PosMin=`expr index "$Line" '-'`
if [ $PosMin -eq 1 ]
then
writeobject $Filename
unset ObjectArray
declare -A ObjectArray
else
readline $Line
fi
done
if [[ ! -z ${ObjectArray[obj]} ]] ;then
writeobject $Filename
fi
unset ObjectArray
}
readline() {
#reads a line and adds it to the ObjectArray
local Line="$1"
if [[ ! -z $Line ]];then
shift
local PosHash=`expr index "$Line" '#'`
local PosEq=`expr index "$Line" '='`
if [ $PosHash -gt 0 ]
then
Line=${Line:0:$((PosHash - 1))}
fi
if [ $PosEq -gt 0 -a ${#Line} -gt 0 ]
then
Name=${Line:0:$((PosEq - 1))}
Name="$(trim $Name)"
Name=${Name,,}
Value=${Line:PosEq}
Value="$(trim $Value)"
ObjectArray[$Name]=$Value
fi
fi
}
calculatecosts(){
local dat=$1
#get the income of the vehicle by 1000 times
local year=${ObjectArray[intro_year]}
if [[ ! -z ${ObjectArray[build_year]} && ! -z ${ObjectArray[latest_reconstruction]} ]] ;then
year=$(( ObjectArray[build_year] + ObjectArray[latest_reconstruction] ))
year=$((year / 2))
elif [[ ! -z ${ObjectArray[build_year]} ]] ;then
year=${ObjectArray[build_year]}
fi
local Income="$(getincome ${ObjectArray[freight]} ${ObjectArray[payload]} ${ObjectArray[waytype]} $year ${ObjectArray[speed]})"
#local Income="$(getincome ${ObjectArray[freight]} ${ObjectArray[payload]} ${ObjectArray[waytype]} ${ObjectArray[intro_year]} ${ObjectArray[speed]})"
#get the value of the power installed, this is essentially the income of
local PowerValue=0
if [[ ! -z ${ObjectArray[power]} ]] ;then
local EffectivePower=${ObjectArray[power]}
if [[ ! -z ${ObjectArray[gear]} ]] ;then
local Gear=${ObjectArray[gear]}
EffectivePower=$(( EffectivePower * Gear ))
else
EffectivePower=$(( EffectivePower * 100 ))
fi
PowerValue="$(getincome "None" $EffectivePower ${ObjectArray[waytype]} $year ${ObjectArray[speed]})"
#PowerValue="$(getincome "None" $EffectivePower ${ObjectArray[waytype]} ${ObjectArray[intro_year]} ${ObjectArray[speed]})"
if [[ ! -z ${ObjectArray[engine_type]} ]] ;then
if [[ ${ObjectArray[engine_type]} == "electric" ]] ;then
PowerValue=$(( PowerValue / 100 * 70 ))
fi
fi
PowerValue=$(( PowerValue / 1000 ))
fi
#malus for passenger vehicles as they usually get higher average payload
if [[ ${ObjectArray[freight]} == "Passagiere" ]] ;then
Income=$(( Income * 110 / 100 ))
fi
#bonus for post vehicles as they usually get lower average payload
if [[ ${ObjectArray[freight]} == "Post" ]] ;then
Income=$(( Income * 100 / 800 ))
fi
#calculate the runningcosts
local Cost=$(( Income + 10 * PowerValue ))
local RunningCost=$(( Income + PowerValue ))
RunningCost=$(( RunningCost / 4000 ))
local LoadingTime=$(( Income / 300 ))
#the next two lines are for the experimental implementation of fix costs. The running costs will be reduced to 10%, while the fix costs are a nice guess on what they should look like. I did some short math on them, but it's very vague.
#local FixCost=$(( RunningCost * 240 ))
local speed=${ObjectArray[speed]}
#speed=$(( speed - 10 ))
local FixCost=$(( RunningCost * speed * 5 / 3 ))
#speed=$(( speed + 150 ))
if [[ $speed -gt 160 ]] ;then
speed=160
fi
FixCost=$(( FixCost * speed / 160 ))
if [[ ${ObjectArray[waytype]} == "water" ]] ;then
FixCost=$(( FixCost * 800 / 100 ))
fi
if [[ ${ObjectArray[waytype]} == "road" ]] ;then
FixCost=$(( FixCost * 120 / 100 ))
fi
if [[ ${ObjectArray[waytype]} == "road" ]] ;then
LoadingTime=$(( LoadingTime * 200 / 100 ))
fi
#if [[ ${ObjectArray[waytype]} == "road" ]] ;then
# Cost=$(( Cost * 100 / 80 ))
#fi
RunningCost=$(( RunningCost / 10 ))
if [[ $ForcingNewValues == 1 ]];then
echo "loading_time=$LoadingTime" >> calculated/$dat
echo "runningcost=$RunningCost" >> calculated/$dat
echo "cost=$Cost" >> calculated/$dat
echo "fixed_cost=$FixCost" >> calculated/$dat
else
if [[ ! -z ${ObjectArray[loading_time]} ]] ;then
echo "loading_time=${ObjectArray[loading_time]}" >> calculated/$dat
else
echo "loading_time=$LoadingTime" >> calculated/$dat
fi
if [[ ! -z ${ObjectArray[runningcost]} ]] ;then
echo "runningcost=${ObjectArray[runningcost]}" >> calculated/$dat
else
echo "runningcost=$RunningCost" >> calculated/$dat
fi
if [[ ! -z ${ObjectArray[cost]} ]] ;then
echo "cost=${ObjectArray[cost]}" >> calculated/$dat
else
echo "cost=$Cost" >> calculated/$dat
fi
if [[ ! -z ${ObjectArray[fixed_cost]} ]] ;then
echo "fixed_cost=$FixCost" >> calculated/$dat
#echo "fixed_cost=${ObjectArray[fixed_cost]}" >> calculated/$dat
else
echo "fixed_cost=$FixCost" >> calculated/$dat
fi
fi
}
writeconstraints() {
Direction=$1
local CounterBefore=0
local CounterAfter=0
local HasToBeRemade=0
while [[ ! -z ${ObjectArray[constraint\[$Direction\]\[$CounterBefore\]]} ]] ;do
if [[ ${ObjectArray[constraint\[$Direction\]\[$CounterBefore\]]:0:1} == "!" ]] ;then
if [[ $ReConvert == 0 ]];then
if [[ $Direction == "next" ]];then
local Path="calculated/ConstraintGroupprev"${ObjectArray[constraint\[$Direction\]\[$CounterBefore\]]:1:${#ObjectArray["constraint[$Direction][$CounterBefore]"]}}".txt"
echo "${ObjectArray[name]}" >> $Path
else
local Path="calculated/ConstraintGroupnext"${ObjectArray[constraint\[$Direction\]\[$CounterBefore\]]:1:${#ObjectArray["constraint[$Direction][$CounterBefore]"]}}".txt"
echo "${ObjectArray[name]}" >> $Path
fi
else
local File=`cat $"calculated/ConstraintGroup"$Direction${ObjectArray[constraint\[$Direction\]\[$CounterBefore\]]:1:${#ObjectArray["constraint[$Direction][$CounterBefore]"]}}".txt"`
local IFS='
'
if [[ $Direction == "next" ]];then
for Line in $File; do
echo "constraint[$Direction][$CounterAfter]=$Line" >> calculated/$dat
CounterAfter=$(( CounterAfter + 1 ))
done
else
for Line in $File; do
echo "constraint[$Direction][$CounterAfter]=$Line" >> calculated/$dat
CounterAfter=$(( CounterAfter + 1 ))
done
fi
fi
HasToBeRemade=1
CounterBefore=$(( CounterBefore + 1 ))
CounterAfter=$(( CounterAfter + 1 ))
else
echo "constraint[$Direction][$CounterAfter]=${ObjectArray["constraint[$Direction][$CounterBefore]"]}" >> calculated/$dat
CounterBefore=$(( CounterBefore + 1 ))
CounterAfter=$(( CounterAfter + 1 ))
fi
done
if [[ $HasToBeRemade -eq 1 ]];then
ReConvertList[$dat]=$dat
fi
}
writeimages() {
for Key in "${!ObjectArray[@]}"; do
if [[ $Key =~ "image" ]];then
if [[ ${ObjectArray[$Key]:0:2} == './' ]]; then
ObjectArray[$Key]=${ObjectArray[$Key]:2:${#ObjectArray[$Key]}}
fi
echo "$Key=${ObjectArray[$Key]}" >> calculated/$dat
fi
done
}
writevehicle() {
local dat=$1
echo "calculated/$dat"
#Object
#the object being a vehicle is given by running this function
echo "obj=vehicle" >> calculated/$dat
#the name of the vehicle has to be given
echo "name=${ObjectArray[name]}" >> calculated/$dat
#only write the name of the author if it is given
if [[ ! -z ${ObjectArray[copyright]} ]] ;then
echo "copyright=${ObjectArray[copyright]}" >> calculated/$dat
fi
echo >> calculated/$dat
#Dates
#the intro year of the vehicle has to be given
echo "intro_year=${ObjectArray[intro_year]}" >> calculated/$dat
#only write in the intro month if it is given
if [[ ! -z ${ObjectArray[intro_month]} ]] ;then
echo "intro_month=${ObjectArray[intro_month]}" >> calculated/$dat
fi
#only write in the outro year if it is given
if [[ ! -z ${ObjectArray[retire_year]} ]] ;then
echo "retire_year=${ObjectArray[retire_year]}" >> calculated/$dat
fi
#only write in the outro month if it is given
if [[ ! -z ${ObjectArray[retire_month]} ]] ;then
echo "retire_month=${ObjectArray[retire_month]}" >> calculated/$dat
fi
echo >> calculated/$dat
#Parameters
#the waytype of the vehicle has to be given
echo "waytype=${ObjectArray[waytype]}" >> calculated/$dat
#write the speed if given, else write the speed used in the speedbonus
if [[ ! -z ${ObjectArray[speed]} ]] ;then
echo "speed=${ObjectArray[speed]}" >> calculated/$dat
else
local SpeedBonus="$(getspeedbonus ${ObjectArray[waytype]} ${ObjectArray[intro_year]} )"
echo "speed=$SpeedBonus" >> calculated/$dat
fi
#write the weigth if given, else write the 2t for every length
if [[ ! -z ${ObjectArray[weight]} ]] ;then
echo "weight=${ObjectArray[weight]}" >> calculated/$dat
else
local Weigth=${ObjectArray[length]}
Weigth=$(( 2 * Weigth ))
echo "weight=$Weigth" >> calculated/$dat
fi
#only write in the length if it is given
if [[ ! -z ${ObjectArray[length]} ]] ;then
echo "length=${ObjectArray[length]}" >> calculated/$dat
fi
#only write in the engine type if it is given
if [[ ! -z ${ObjectArray[engine_type]} ]] ;then
echo "engine_type=${ObjectArray[engine_type]}" >> calculated/$dat
fi
#only write in the power if it is given
if [[ ! -z ${ObjectArray[power]} ]] ;then
echo "power=${ObjectArray[power]}" >> calculated/$dat
fi
#only write in the gear if it is given
if [[ ! -z ${ObjectArray[gear]} ]] ;then
echo "gear=${ObjectArray[gear]}" >> calculated/$dat
fi
echo >> calculated/$dat
#Freigth
#only write in the freigth if it is given
if [[ ! -z ${ObjectArray[freight]} ]] ;then
echo "freight=${ObjectArray[freight]}" >> calculated/$dat
fi
#only write in the payload if it is given
if [[ ! -z ${ObjectArray[payload]} ]] ;then
echo "payload=${ObjectArray[payload]}" >> calculated/$dat
fi
#calculate the costs and loading time
calculatecosts $dat
echo >> calculated/$dat
writeconstraints "prev"
writeconstraints "next"
echo >> calculated/$dat
#only write in the smoke if it is given
if [[ ! -z ${ObjectArray[smoke]} ]] ;then
echo "smoke=${ObjectArray[smoke]}" >> calculated/$dat
fi
#only write in the sound if it is given
if [[ ! -z ${ObjectArray[sound]} ]] ;then
echo "sound=${ObjectArray[sound]}" >> calculated/$dat
fi
#return images
writeimages
}
copyobject() {
local FileName=$1
`cp -f $Filename calculated/$Filename`
}
writeobject() {
local FileName=$1
if [[ ! -z ${ObjectArray[obj]} ]] ;then
if [[ ${ObjectArray[obj]} == "vehicle" || ${ObjectArray[obj]} == "Vehicle" ]]; then
#`rm -f calculated/$Filename`
echo "--- Writing Object: ${ObjectArray[name]} "
# get directory where the dat file is located
local calculateddir=calculated/$(dirname "$dat")/
local calculatedextendeddir=calculatedextended/$(dirname "$dat")/
# Create folder for *.dat or delete all old dats if folder already exists
if [ ! -d $calculateddir ]; then
mkdir -p $calculateddir
fi
if [ ! -d $calculatedextendeddir ]; then
mkdir -p $calculatedextendeddir
fi
writevehicle $FileName
echo >> calculated/$1
echo "---" >> calculated/$1
else
copyobject
fi
else
copyobject
fi
}
echohelp() {
echo "DatConverter Beta Version
Copies the pakset-directionary to a new location and dds not given values to dat files
Features:
! constraint-groups: use exclamation marks in front of constraints to refer to a group
Commands:
-h displays the help and stopp the program after that
-f forcing new prices on vehicles
-a converting the whole directionary
-v converting all vehicles"
}
#main
echo "==== Dat Converter ===="
#reading the arguments
ForcingNewValues=0
ReadAll=0
AllVehicles=0
Help=0
ReConvert=0
for arg in "$@"; do
if [[ $arg == "-f" ]];then
ForcingNewValues=1
echo "- -f Forcing New Prices"
fi
if [[ $arg == "-a" ]];then
ReadAll=1
echo "- -a Converting All Files"
fi
if [[ $arg == "-v" ]];then
AllVehicles=1
echo "- -v Converting All Vehicles"
fi
if [[ $arg == "-h" ]];then
Help=1
echo "- -h Display Help"
fi
done
if [[ $Help == 1 ]];then
echohelp
else
echo "- Creating Directionaries "
IFS='
'
`rm -rf calculated/`
#`rm -rf calculatedextended/`
#mkdir -p calculatedextended/pakset
mkdir -p calculated/pakset
#mkdir -p calculatedextended/AddOn
mkdir -p calculated/AddOn
#mkdir -p calculatedextended/AddOn
mkdir -p calculated/AddOn384
#`cp -rf pakset/* calculatedextended/pakset`
`cp -rf pakset/* calculated/pakset`
#`cp -rf AddOn/* calculatedextended/AddOn`
`cp -rf AddOn/* calculated/AddOn`
#`cp -rf AddOn/* calculatedextended/AddOn`
`cp -rf AddOn384/* calculated/AddOn384`
#`cp -rf AddOn/* calculatedextended/AddOn`
`cp -rf AddOn48/* calculated/AddOn48`
declare -A ReConvertList
declare -A GoodsValueArray
declare -A GoodsSpeedBonusArray
declare -A GoodsWeigthArray
echo "- Read Meta Files"
readgoods
SpeedBonusFile=`cat pakset/trunk/config/speedbonus.tab | tr -d '\r'`
if [[ $ReadAll == 1 ]];then
echo "- Edit All .dat Files"
readallfiles 'pakset/*.dat'
readallfiles 'pakset/**/*.dat'
readallfiles 'pakset/**/**/*.dat'
readallfiles 'pakset/**/**/**/*.dat'
readallfiles 'pakset/**/**/**/**/*.dat'
readallfiles 'AddOn/*.dat'
readallfiles 'AddOn/**/*.dat'
readallfiles 'AddOn/**/**/*.dat'
readallfiles 'AddOn/**/**/**/*.dat'
readallfiles 'AddOn/**/**/**/**/*.dat'
readallfiles 'AddOn384/*.dat'
readallfiles 'AddOn384/**/*.dat'
readallfiles 'AddOn384/**/**/*.dat'
readallfiles 'AddOn384/**/**/**/*.dat'
readallfiles 'AddOn384/**/**/**/**/*.dat'
readallfiles 'AddOn48/*.dat'
readallfiles 'AddOn48/**/*.dat'
readallfiles 'AddOn48/**/**/*.dat'
readallfiles 'AddOn48/**/**/**/*.dat'
readallfiles 'AddOn48/**/**/**/**/*.dat'
else
if [[ $AllVehicles == 1 ]] ;then
echo "- Edit All Vehicle .dat Files "
readallfiles 'pakset/384/vehicles/*.dat'
readallfiles 'pakset/vehicles/**/*.dat'
readallfiles 'AddOn/**/vehicles/**/*.dat'
else
#echo "- Edit Costoum .dat Files "
#readfile "pakset/vehicles/road/W50_Sattelzug.dat"
readfile "AddOn/german/vehicles/track/Passenger_Train_2016_Locomore.dat"
readfile "AddOn/german/vehicles/track/Passenger_Train_2017_Flixtrain.dat"
readfile "AddOn/german/vehicles/track/Passenger_Train_2020_Flixtrain.dat"
#readfile "pakset/vehicles/track/Tram_DUEWAG_Grossraumwagen.dat"
#readfile "pakset/vehicles/narrowgauge/Car_1885_Piece_goods.dat"
#readallfiles 'calculated/AddOn/britain/infrastruktur/*.dat'
#readallfiles 'calculated/AddOn/belgian/**/*.dat'
#readallfiles 'calculated/AddOn/britain/vehicles/**/*.dat'
#readallfiles 'calculated/AddOn/czech/vehicles/**/*.dat'
#readallfiles 'calculated/AddOn/german/vehicles/**/*.dat'
#readallfiles 'calculated/AddOn/japanese/*.dat'
#readallfiles 'pakset/landscape/**/*.dat'
#readallfiles 'ConvertTest/*.dat'
fi
fi
echo "- Re-Converting The Files Affected By Constraint-Groups"
ReConvert=1
for ReFile in "${ReConvertList[@]}"; do
echo "-- Performing Work At: "$ReFile
readfile $ReFile
done
echo "==== Done ===="
fi
unset IFS