summaryrefslogtreecommitdiffstats
path: root/games/vegastrike/patches/patch-0.5.1.r1_2
blob: 8f6d622177360da78d3e892662c1875181ae29a3 (plain)
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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
diff -ruN ./CMakeLists.txt ../b/CMakeLists.txt
--- ./CMakeLists.txt	2012-03-26 02:50:49.000000000 +0200
+++ ../b/CMakeLists.txt	2020-09-02 22:37:20.707393347 +0200
@@ -10,7 +10,7 @@
 
 project (vsUTCS)
 
-
+include(GNUInstallDirs)
 
 include_directories(${vsUTCS_SOURCE_DIR}/src 
 					${vsUTCS_SOURCE_DIR}/src/cmd
@@ -685,14 +685,42 @@
 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${vsUTCS_SOURCE_DIR})
 
 
-find_package(PythonLibs REQUIRED)
-IF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
-    SET(TST_INCLUDES ${PYTHON_INCLUDE_PATH})
+#find_package(PythonLibs REQUIRED)
+#IF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
+#    SET(TST_INCLUDES ${PYTHON_INCLUDE_PATH})
+#    SET(TST_LIBS ${PYTHON_LIBRARIES})
+#    SET(HAVE_PYTHON 1)
+#ELSE(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
+#    message(FATAL_ERROR "Can't find python")
+#ENDIF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
+
+# Python 3 has a SASL compatibility issue which causes an error
+# on some installations that prefer Python 3
+# -- Python 2.7 is default for now
+OPTION(USE_PYTHON_3 "Use Python 3 instead of Python 2.7 (default is 2.7)" OFF)
+IF (USE_PYTHON_3)
+    # We want at least Python 3.4, but we prefer newer versions
+    SET(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5 3.4)
+ELSE (USE_PYTHON_3)
+    SET(Python_ADDITIONAL_VERSIONS 2.7)
+ENDIF (USE_PYTHON_3)
+# If we don't unset cache variables
+# ccmake won't pick up changes to the USE_PYTHON_3 option
+UNSET(PYTHON_INCLUDE_DIR CACHE)
+UNSET(PYTHON_LIBRARY CACHE)
+# The python version we want is set via Python_ADDITIONAL_VERSIONS
+MESSAGE("++ Python release(s) searched for : ${Python_ADDITIONAL_VERSIONS}")
+FIND_PACKAGE(PythonLibs REQUIRED)
+MESSAGE("++ Python library : ${PYTHON_LIBRARY} (${PYTHONLIBS_VERSION_STRING})")
+MESSAGE("++ Python include dir : ${PYTHON_INCLUDE_DIR}")
+IF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
+    SET(TST_INCLUDES ${PYTHON_INCLUDE_DIRS})
     SET(TST_LIBS ${PYTHON_LIBRARIES})
     SET(HAVE_PYTHON 1)
-ELSE(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
-    message(FATAL_ERROR "Can't find python")
-ENDIF(PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_PATH)
+ELSE (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
+    MESSAGE(FATAL_ERROR "Can't find python")
+ENDIF (PYTHONLIBS_FOUND OR PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS)
+
 
 # Find Boost with boost_python library
 OPTION(USE_SYSTEM_BOOST "Use system boost" OFF)
@@ -828,33 +856,33 @@
 
 #Find FFMpeg
 
-find_package(FFMPEG)
-IF(FFMPEG_FOUND)
-	SET(TST_INCLUDES ${TST_INCLUDES} ${FFMPEG_INCLUDE_DIRS})
-	SET(TST_LIBS ${TST_LIBS} ${FFMPEG_LIBRARIES})
-	add_definitions(${FFMPEG_DEFINITIONS})
-	SET(HAVE_FFMPEG 1 )
-	IF(swscale1_FOUND)
-        message("++ FFmpeg's libswscale found.")
-	ELSE(swscale1_FOUND)
-        message("-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.")
-	ENDIF(swscale1_FOUND)
-ELSE(FFMPEG_FOUND)
-	message("-- FFMPEG Not Found")
-ENDIF(FFMPEG_FOUND)
+#find_package(FFMPEG)
+#IF(FFMPEG_FOUND)
+#	SET(TST_INCLUDES ${TST_INCLUDES} ${FFMPEG_INCLUDE_DIRS})
+#	SET(TST_LIBS ${TST_LIBS} ${FFMPEG_LIBRARIES})
+#	add_definitions(${FFMPEG_DEFINITIONS})
+#	SET(HAVE_FFMPEG 1 )
+#	IF(swscale1_FOUND)
+#        message("++ FFmpeg's libswscale found.")
+#	ELSE(swscale1_FOUND)
+#        message("-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.")
+#	ENDIF(swscale1_FOUND)
+#ELSE(FFMPEG_FOUND)
+#	message("-- FFMPEG Not Found")
+#ENDIF(FFMPEG_FOUND)
 
 #Find Ogre
 
-find_package(OGRE)
-IF(OGRE_FOUND)
-    SET(TST_INCLUDES ${TST_INCLUDES} ${OGRE_INCLUDE_DIR})
-    SET(TST_LIBS ${TST_LIBS} ${OGRE_LIBRARY})
-    add_definitions(${OGRE_DEFINITIONS})
-    SET(HAVE_OGRE 1)
-    message("++ Found Ogre: ${OGRE_VERSION}")
-ELSE(OGRE_FOUND)
-    message("-- Ogre Not Found: compiling without")
-ENDIF(OGRE_FOUND)
+#find_package(OGRE)
+#IF(OGRE_FOUND)
+#    SET(TST_INCLUDES ${TST_INCLUDES} ${OGRE_INCLUDE_DIR})
+#    SET(TST_LIBS ${TST_LIBS} ${OGRE_LIBRARY})
+#    add_definitions(${OGRE_DEFINITIONS})
+#    SET(HAVE_OGRE 1)
+#    message("++ Found Ogre: ${OGRE_VERSION}")
+#ELSE(OGRE_FOUND)
+#    message("-- Ogre Not Found: compiling without")
+#ENDIF(OGRE_FOUND)
 
 IF(NOT BEOS)
 	FIND_LIBRARY(UTIL_LIB util)
@@ -977,12 +1005,12 @@
 	HAVE_AVFORMAT_H
 	HAVE_AVCODEC_H
 	HAVE_AVIO_H
-	HAVE_FFMPEG_SWSCALE_H
+#	HAVE_FFMPEG_SWSCALE_H
 	CMAKE_BACKWARDS_COMPATIBILITY
-	FFMPEG_INCLUDE_DIR
-	FFMPEG_FOUND
-	FFMPEG_LIBRARIES
-	FFMPEG_DEFINITIONS
+#	FFMPEG_INCLUDE_DIR
+#	FFMPEG_FOUND
+#	FFMPEG_LIBRARIES
+#	FFMPEG_DEFINITIONS
 	GTK2_ATK_INCLUDE_DIR
 	GTK2_ATK_LIBRARY
 	GTK2_CAIRO_INCLUDE_DIR
diff -ruN ./objconv/basemaker/base_maker_texture.cpp ../b/objconv/basemaker/base_maker_texture.cpp
--- ./objconv/basemaker/base_maker_texture.cpp	2010-03-10 03:56:23.000000000 +0100
+++ ../b/objconv/basemaker/base_maker_texture.cpp	2020-09-02 15:08:07.760351554 +0200
@@ -6,9 +6,12 @@
 #define XMD_H
 #define HAVE_BOOLEAN
 #endif
+
 extern "C" {
 //YUCK it doesn't even have extern c in the headers!
 #include <jpeglib.h>
+#include <string.h>
+
 }
 
 #define strip_16 true
diff -ruN ./objconv/mesher/to_OgreMesh.cpp ../b/objconv/mesher/to_OgreMesh.cpp
--- ./objconv/mesher/to_OgreMesh.cpp	2011-06-02 01:47:36.000000000 +0200
+++ ../b/objconv/mesher/to_OgreMesh.cpp	2020-09-02 15:08:07.762351529 +0200
@@ -1078,10 +1078,15 @@
     Ogre::VertexDeclaration *newDcl =
         data->vertexDeclaration->getAutoOrganisedDeclaration(
             mesh->hasSkeleton() );
-#else
+#elif (OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR < 8)
     Ogre::VertexDeclaration *newDcl =
         data->vertexDeclaration->getAutoOrganisedDeclaration(
             mesh->hasSkeleton(), mesh->hasVertexAnimation() || (mesh->getPoseCount() > 0) );
+#else
+    Ogre::VertexDeclaration *newDcl =
+        data->vertexDeclaration->getAutoOrganisedDeclaration(
+            mesh->hasSkeleton(), mesh->hasVertexAnimation() || (mesh->getPoseCount() > 0),
+		    mesh->getSharedVertexDataAnimationIncludesNormals()); // what about Pose objects?
 #endif
     if ( *newDcl != *(data->vertexDeclaration) ) {
         //Usages don't matter here since we're onlly exporting
@@ -1109,35 +1114,35 @@
     }
 }
 
-void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance )
-{
-    struct outputContext *ctxt = (struct outputContext*) outputcontext;
-    MeshPtr newMesh = ctxt->top;
-    if ( force || (newMesh->getNumLodLevels() <= 1) ) {
-        if (newMesh->getNumLodLevels() <= 1)
-            newMesh->removeLodLevels();
-        const Ogre::ProgressiveMesh::VertexReductionQuota quota = Ogre::ProgressiveMesh::VRQ_PROPORTIONAL;
-        const Real reduction  = Real( 1-reductionFactor );
-        
-        Real currDist = refDistance;
-        
-    #if (OGRE_VERSION >= 0x010700)
-        Ogre::Mesh::LodValueList distanceList;
-
-        // pixel area is squared length, and length is proportional to triangle count
-        const Real distFactor = reductionFactor * reductionFactor; 
-        newMesh->setLodStrategy(Ogre::LodStrategyManager::getSingletonPtr()->
-            getStrategy( "PixelCount" ) );
-    #else
-        Ogre::Mesh::LodDistanceList distanceList;
-        const Real distFactor = ( (reduction > 0.00001) ? 1/reduction : 1 );
-    #endif
-
-        for (int iLod = 0; iLod < numLod; ++iLod, currDist *= distFactor)
-            distanceList.push_back( currDist );
-        newMesh->generateLodLevels( distanceList, quota, reduction );
-    }
-}
+//void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance )
+//{
+//    struct outputContext *ctxt = (struct outputContext*) outputcontext;
+//    MeshPtr newMesh = ctxt->top;
+//    if ( force || (newMesh->getNumLodLevels() <= 1) ) {
+//        if (newMesh->getNumLodLevels() <= 1)
+//            newMesh->removeLodLevels();
+//        const Ogre::ProgressiveMesh::VertexReductionQuota quota = Ogre::ProgressiveMesh::VRQ_PROPORTIONAL;
+//        const Real reduction  = Real( 1-reductionFactor );
+//        
+//        Real currDist = refDistance;
+//        
+//    #if (OGRE_VERSION >= 0x010700)
+//        Ogre::Mesh::LodValueList distanceList;
+//
+//        // pixel area is squared length, and length is proportional to triangle count
+//        const Real distFactor = reductionFactor * reductionFactor; 
+//        newMesh->setLodStrategy(Ogre::LodStrategyManager::getSingletonPtr()->
+//            getStrategy( "PixelCount" ) );
+//    #else
+//        Ogre::Mesh::LodDistanceList distanceList;
+//        const Real distFactor = ( (reduction > 0.00001) ? 1/reduction : 1 );
+//    #endif
+//
+//        for (int iLod = 0; iLod < numLod; ++iLod, currDist *= distFactor)
+//            distanceList.push_back( currDist );
+//        newMesh->generateLodLevels( distanceList, quota, reduction );
+//    }
+//}
 
 void DoneMeshes( void *outputcontext )
 {
diff -ruN ./objconv/mesher/to_OgreMesh.h ../b/objconv/mesher/to_OgreMesh.h
--- ./objconv/mesher/to_OgreMesh.h	2010-02-25 16:22:25.000000000 +0100
+++ ../b/objconv/mesher/to_OgreMesh.h	2020-09-02 15:08:07.763351517 +0200
@@ -20,7 +20,7 @@
 float RadialSize( void *outputcontext );     //returns the size of the resulting mesh (it's maximum distance from 0,0,0). Useful for LODding.
 
 void Optimize( void *outputcontext );     //a good idea - reorganizes internal buffers so that the output mesh is more efficient
-void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance );     //autogenerates LOD levels - if force==true, will discard current LOD data
+//void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance );     //autogenerates LOD levels - if force==true, will discard current LOD data
 void AutoEdgeList( void *outputcontext );     //a good idea - prepares the mesh for stencil shadows
 void AutoTangents( void *outputcontext );     //prepares the mesh for normal mapping (only needed if the material uses normal mapping)
 }
diff -ruN ./setup/src/c/setup.cpp ../b/setup/src/c/setup.cpp
--- ./setup/src/c/setup.cpp	2011-03-15 01:28:47.000000000 +0100
+++ ../b/setup/src/c/setup.cpp	2020-09-02 15:08:07.764351504 +0200
@@ -110,10 +110,22 @@
                 return 1;
             }
         }
-        
+
 #ifdef DATA_DIR
         data_paths.push_back( DATA_DIR );
 #endif
+		/* whatever the plan was, it does not work on Linux - at least
+		 * not at this stage. Hence, use fixed absolute paths to
+		 * find data directory
+		 */ 
+		data_paths.push_back( "/usr/share/games/vegastrike/data");
+		data_paths.push_back( "/usr/share/vegastrike/data");
+		data_paths.push_back( "/usr/games/vegastrike/data");
+		data_paths.push_back( "/usr/local/share/games/vegastrike/data");
+		data_paths.push_back( "/usr/local/share/vegastrike/data");
+		data_paths.push_back( "/usr/local/games/vegastrike/data");
+		data_paths.push_back( "/opt/vegastrike/data");
+
         data_paths.push_back( origpath );
         data_paths.push_back( string( origpath )+"/.." );
         data_paths.push_back( string( origpath )+"/../data4.x" );
@@ -133,22 +145,7 @@
         data_paths.push_back( "../Resources" );
         data_paths.push_back( "../Resources/data" );
         data_paths.push_back( "../Resources/data4.x" );
-/*
- *               data_paths.push_back( "/usr/share/local/vegastrike/data");
- *               data_paths.push_back( "/usr/local/share/vegastrike/data");
- *               data_paths.push_back( "/usr/local/vegastrike/data");
- *               data_paths.push_back( "/usr/share/vegastrike/data");
- *               data_paths.push_back( "/usr/local/games/vegastrike/data");
- *               data_paths.push_back( "/usr/games/vegastrike/data");
- *               data_paths.push_back( "/opt/share/vegastrike/data");
- *               data_paths.push_back( "/usr/share/local/vegastrike/data4.x");
- *               data_paths.push_back( "/usr/local/share/vegastrike/data4.x");
- *               data_paths.push_back( "/usr/local/vegastrike/data4.x");
- *               data_paths.push_back( "/usr/share/vegastrike/data4.x");
- *               data_paths.push_back( "/usr/local/games/vegastrike/data4.x");
- *               data_paths.push_back( "/usr/games/vegastrike/data4.x");
- *               data_paths.push_back( "/opt/share/vegastrike/data4.x");
- */
+
         //Win32 data should be "."
         char tmppath[16384];
         for (vector< string >::iterator vsit = data_paths.begin(); vsit != data_paths.end(); vsit++) {
diff -ruN ./setup/src/include/central.cpp ../b/setup/src/include/central.cpp
--- ./setup/src/include/central.cpp	2004-10-25 04:27:13.000000000 +0200
+++ ../b/setup/src/include/central.cpp	2020-09-03 02:22:34.948442084 +0200
@@ -20,6 +20,8 @@
 struct group GROUPS;
 struct global_settings CONFIG;
 
+static char EMPTY_STR[] = "";
+
 // Primary initialization function. Sets everything up and takes care of the program
 void Start(int * argc, char ***argv) {
 	LoadMainConfig();
@@ -65,7 +67,7 @@
 		if (CUR->name == NULL) { continue; }
 		if (strcmp(CUR->name, group) == 0) { return CUR->setting; }
 	} while ((CUR = CUR->next) > 0);
-	return '\0';
+	return EMPTY_STR;
 }
 
 struct catagory *GetCatStruct(char *name) {
diff -ruN ./src/cmd/music.cpp ../b/src/cmd/music.cpp
--- ./src/cmd/music.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/music.cpp	2020-09-02 15:08:07.765351492 +0200
@@ -448,7 +448,9 @@
             if (foundcache) {
                 *me->music_load_info = wherecache->second;
                 me->freeWav = false;
-            }
+            } else if ( ! AUDLoadSoundFile(songname, me->music_load_info, true)) {
+				VSFileSystem::vs_dprintf(1, "Failed to load music file \"%s\"", songname);
+			}
         }
         if (me->freeWav && docacheme) {
             me->freeWav = false;
diff -ruN ./src/cmd/unit.cpp ../b/src/cmd/unit.cpp
--- ./src/cmd/unit.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/unit.cpp	2020-09-02 15:56:51.644797969 +0200
@@ -80,6 +80,7 @@
 template < class UnitType >GameUnit< UnitType >::GameUnit( int ) : sparkle_accum( 0 )
     , phalos( new HaloSystem() )
 {
+	VSFileSystem::vs_dprintf(3, "Unit created by Constructor: template < class UnitType >GameUnit< UnitType >::GameUnit( int ) : sparkle_accum( 0 ), phalos( new HaloSystem() )\n");
     this->Unit::Init();
 }
 
@@ -99,6 +100,14 @@
     , phalos( new HaloSystem() )
 {
     Unit::Init( filename, SubU, faction, unitModifications, flightgrp, fg_subnumber, netxml );
+
+	std::string fn = string(filename);
+	std::string str_faction = string(FactionUtil::GetFaction(faction));
+	std::string objtype = UniverseUtil::LookupUnitStat( fn, str_faction, "Object_Type");
+	if (objtype.compare("Vessel") == 0) {
+		VSFileSystem::vs_dprintf(3, "Recomputing upgrades for (units.csv) Object_Type: %s\n", objtype.c_str());
+		UnitUtil::RecomputeUnitUpgrades(this);
+	}
 }
 
 template < class UnitType >GameUnit< UnitType >::~GameUnit()
diff -ruN ./src/cmd/unit_collide.h ../b/src/cmd/unit_collide.h
--- ./src/cmd/unit_collide.h	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/unit_collide.h	2020-09-02 21:27:47.524565312 +0200
@@ -94,9 +94,9 @@
     {
         if ( !hugeobjects.empty() )
             hugeobjects.clear();
-        if ( this->active_huge.size() )
+        if ( this->active_huge->size() )
             ha.clear();
-        if ( this->accum_huge.size() )
+        if ( this->accum_huge->size() )
             hb.clear();
         acc_huge.clear();
         act_huge.clear();
diff -ruN ./src/cmd/unit_generic.cpp ../b/src/cmd/unit_generic.cpp
--- ./src/cmd/unit_generic.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/unit_generic.cpp	2020-09-02 21:47:36.695698627 +0200
@@ -630,13 +630,13 @@
         jump.drive = -1;
 }
 
-float copysign( float x, float y )
-{
-    if (y > 0)
-        return x;
-    else
-        return -x;
-}
+//float copysign( float x, float y )
+//{
+//   if (y > 0)
+//        return x;
+//    else
+//        return -x;
+//}
 
 float rand01()
 {
@@ -4903,16 +4903,26 @@
 
 static const string LOAD_FAILED = "LOAD_FAILED";
 
+//const Unit * makeFinalBlankUpgrade( string name, int faction )
+//{
+//    char  *unitdir    = GetUnitDir( name.c_str() );
+//    string limiternam = name;
+//    if (unitdir != name)
+//        limiternam = string( unitdir )+string( ".blank" );
+//    free( unitdir );
+//    const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( limiternam, faction ) );
+//    if (!lim)
+//        lim = UnitConstCache::setCachedConst( StringIntKey( limiternam, faction ), makeBlankUpgrade( limiternam, faction ) );
+//    if (lim->name == LOAD_FAILED)
+//        lim = NULL;
+//    return lim;
+//}
+
 const Unit * makeFinalBlankUpgrade( string name, int faction )
 {
-    char  *unitdir    = GetUnitDir( name.c_str() );
-    string limiternam = name;
-    if (unitdir != name)
-        limiternam = string( unitdir )+string( ".blank" );
-    free( unitdir );
-    const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( limiternam, faction ) );
+    const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( name, faction ) );
     if (!lim)
-        lim = UnitConstCache::setCachedConst( StringIntKey( limiternam, faction ), makeBlankUpgrade( limiternam, faction ) );
+        lim = UnitConstCache::setCachedConst( StringIntKey( name, faction ), makeBlankUpgrade( name, faction ) );
     if (lim->name == LOAD_FAILED)
         lim = NULL;
     return lim;
@@ -6387,21 +6397,48 @@
                                 int tmpammo = mounts[jmod].ammo;
                                 if (mounts[jmod].ammo != -1 && up->mounts[i].ammo != -1) {
                                     tmpammo += up->mounts[i].ammo;
-                                    if (templ) {
-                                        if (templ->GetNumMounts() > jmod) {
-                                            if (templ->mounts[jmod].volume != -1) {
-                                                if (templ->mounts[jmod].volume < mounts[jmod].type->volume*tmpammo) {
-                                                    tmpammo =
-                                                        (int) floor( .125
-                                                                    +( (0
-                                                                        +templ->mounts[jmod].volume)
-                                                                      /mounts[jmod].type->volume ) );
+                                    if (ismissiletype) {
+                                        if (templ) {
+                                            if (templ->GetNumMounts() > jmod) {
+                                                if (templ->mounts[jmod].volume != -1) {
+                                                    if (templ->mounts[jmod].volume < mounts[jmod].type->volume*tmpammo) {
+                                                        tmpammo =
+                                                            (int) floor( .125
+                                                                        +( (0
+                                                                            +templ->mounts[jmod].volume)
+                                                                          /mounts[jmod].type->volume ) );
+                                                    }
                                                 }
                                             }
                                         }
+                                        if (tmpammo*mounts[jmod].type->volume > mounts[jmod].volume)
+                                            tmpammo = (int) floor( .125+( (0+mounts[jmod].volume)/mounts[jmod].type->volume ) );
+                                    } else {
+                                        std::string ammoname = up->name.get();
+                                        std::size_t ammopos = ammoname.find("_ammo");
+                                        std::string weaponname = ammoname.substr(0, ammopos);
+
+                                        /* Do NOT delete this Unit because it will be either fetched
+                                        * from a cache or - if it has to be created - it will
+                                        * be automatically put in a cache.
+                                        * Deletion will corrupt the cache!
+                                        */
+                                        const Unit * weapon = getUnitFromUpgradeName(weaponname);
+
+                                        if (weapon == NULL || weapon->name == LOAD_FAILED) {
+                                            // this should not happen
+                                            VSFileSystem::vs_dprintf(1, "UpgradeMount(): FAILED to obtain weapon: %s\n", weaponname.c_str());
+                                            cancompletefully = false;
+                                            break;
+                                        }
+
+                                        int maxammo = weapon->mounts[0].ammo;
+
+                                        if (tmpammo > maxammo) {
+                                            tmpammo = maxammo;
+                                        }
                                     }
-                                    if (tmpammo*mounts[jmod].type->volume > mounts[jmod].volume)
-                                        tmpammo = (int) floor( .125+( (0+mounts[jmod].volume)/mounts[jmod].type->volume ) );
+
                                     if (tmpammo > mounts[jmod].ammo) {
                                         cancompletefully = true;
                                         if (touchme)
diff -ruN ./src/cmd/unit_jump.h ../b/src/cmd/unit_jump.h
--- ./src/cmd/unit_jump.h	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/unit_jump.h	2020-09-02 15:08:07.766351479 +0200
@@ -108,7 +108,7 @@
                      (tester = *i) != NULL; ++i)
                     if (tester->isUnit() == UNITPTR && tester != this)
                         if ( ( this->LocalPosition()-tester->LocalPosition() ).Magnitude() < this->rSize()+tester->rSize() )
-                            SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
+                            this->SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
                                            *( 4*( this->rSize()+tester->rSize() ) ) );
             DealPossibleJumpDamage( this );
             static int jumparrive = AUDCreateSound( vs_config->getVariable( "unitaudio", "jumparrive", "sfx43.wav" ), false );
diff -ruN ./src/cmd/unit_physics.h ../b/src/cmd/unit_physics.h
--- ./src/cmd/unit_physics.h	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/cmd/unit_physics.h	2020-09-03 00:27:15.498947107 +0200
@@ -41,7 +41,7 @@
 #include "networking/lowlevel/vsnet_clientstate.h"
 #include "networking/netclient.h"
 
-extern float copysign( float x, float y );
+//extern float copysign( float x, float y );
 
 extern unsigned int apply_float_to_unsigned_int( float tmp ); //short fix
 
diff -ruN ./src/gfx/cockpit_xml.cpp ../b/src/gfx/cockpit_xml.cpp
--- ./src/gfx/cockpit_xml.cpp	2010-12-15 09:53:40.000000000 +0100
+++ ../b/src/gfx/cockpit_xml.cpp	2020-09-03 00:14:13.810719555 +0200
@@ -315,7 +315,7 @@
         for (counter = 0; counter < 4; ++counter)
             if (!replaced[counter]) {
                 delete Pit[counter];
-                Pit[counter] = false;
+                Pit[counter] = NULL;
             }
         break;
     case UnitImages< void >::SHIELD4:
diff -ruN ./src/gfx/quadsquare.cpp ../b/src/gfx/quadsquare.cpp
--- ./src/gfx/quadsquare.cpp	2010-03-10 06:27:01.000000000 +0100
+++ ../b/src/gfx/quadsquare.cpp	2020-09-02 15:08:07.767351467 +0200
@@ -13,9 +13,9 @@
 #include <float.h>
 #include <math.h>
 #include <assert.h>
-#include "quadsquare.h"
 #include "gfxlib.h"
 #include "aux_texture.h"
+#include "quadsquare.h"
 using std::vector;
 
 unsigned int*quadsquare::VertexAllocated;
diff -ruN ./src/gui/text_area.cpp ../b/src/gui/text_area.cpp
--- ./src/gui/text_area.cpp	2010-02-25 15:26:53.000000000 +0100
+++ ../b/src/gui/text_area.cpp	2020-09-03 00:05:06.687559535 +0200
@@ -32,6 +32,8 @@
  *  };
  */
 
+static char EMPTY_STR[] = "";
+
 TextArea::~TextArea() {}
 
 TextArea::TextArea()
@@ -316,7 +318,7 @@
 {
     TextAreaItem *search;
     search = ItemList->FindCount( cur_selected, 0 );
-    if (search == 0) return '\0';
+    if (search == 0) return EMPTY_STR;
     if (type == 1) return search->name;
 
     else return search->description;
diff -ruN ./src/networking/lowlevel/packetmem.cpp ../b/src/networking/lowlevel/packetmem.cpp
--- ./src/networking/lowlevel/packetmem.cpp	2008-03-31 10:20:19.000000000 +0200
+++ ../b/src/networking/lowlevel/packetmem.cpp	2020-09-02 15:08:07.768351454 +0200
@@ -102,7 +102,7 @@
     }
     else
     {
-        _buffer.reset( 0 );
+        _buffer.reset();
         _len = 0;
     }
 }
diff -ruN ./src/physics.h ../b/src/physics.h
--- ./src/physics.h	2011-02-12 04:19:03.000000000 +0100
+++ ../b/src/physics.h	2020-09-02 21:32:31.049020768 +0200
@@ -27,7 +27,7 @@
 static const float oocc = (float) 0.0000000000000000111265005605; //1/c^2
 static const float c    = (float) 299792458.0;
 static const float co10 = (float) 29979245.8;
-float copysign( float x, float y );
+//float copysign( float x, float y );
 
 struct Force
 {
diff -ruN ./src/pk3.cpp ../b/src/pk3.cpp
--- ./src/pk3.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/pk3.cpp	2020-09-02 23:06:42.933362491 +0200
@@ -356,7 +356,7 @@
     }
     //if the file isn't in the archive
     if (index == -1)
-        return false;
+        return NULL;
     int flength = GetFileLen( index );
 
     buffer = new char[flength];
diff -ruN ./src/python/python_compile.h ../b/src/python/python_compile.h
--- ./src/python/python_compile.h	2010-02-25 16:44:43.000000000 +0100
+++ ../b/src/python/python_compile.h	2020-09-02 21:07:32.272758050 +0200
@@ -10,6 +10,7 @@
 #include "hashtable.h"
 #include <string>
 #include <compile.h>
+#include <boost/version.hpp>
 
 extern Hashtable< std::string, PyCodeObject, 1023 >compiled_python;
 
@@ -40,8 +41,11 @@
         switch (type)
         {
         case MYSTRING:
+#if BOOST_VERSION <= 104500
             return PyString_FromString( objects.c_str() );
-
+#else
+            return PyUnicode_FromString( objects.c_str() );
+#endif
         case MYLONG:
             return PyLong_FromLong( objecti );
 
diff -ruN ./src/ship_commands.cpp ../b/src/ship_commands.cpp
--- ./src/ship_commands.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/ship_commands.cpp	2020-09-03 00:11:42.010617317 +0200
@@ -5,14 +5,14 @@
 #include "universe_util.h"
 #include "gldrv/winsys.h"
 
-static inline float fmin( float a, float b )
-{
-    return (a < b) ? a : b;
-}
-static inline float fmax( float a, float b )
-{
-    return (a > b) ? a : b;
-}
+//static inline float fmin( float a, float b )
+//{
+//    return (a < b) ? a : b;
+//}
+//static inline float fmax( float a, float b )
+//{
+//    return (a > b) ? a : b;
+//}
 
 class ShipCommands
 {
diff -ruN ./src/vsfilesystem.cpp ../b/src/vsfilesystem.cpp
--- ./src/vsfilesystem.cpp	2012-03-19 09:20:14.000000000 +0100
+++ ../b/src/vsfilesystem.cpp	2020-09-02 16:02:24.060642199 +0200
@@ -460,13 +460,15 @@
 
 int vs_fprintf( FILE *fp, const char *format, ... )
 {
+	int ret = 0;
     if (!use_volumes) {
         va_list ap;
         va_start( ap, format );
 
-        return vfprintf( fp, format, ap );
-    } else {}
-    return 0;
+        ret = vfprintf( fp, format, ap );
+		va_end(ap);
+    }
+    return ret;
 }
 
 void vs_dprintf( char level, const char *format, ... )
@@ -475,19 +477,22 @@
         va_list ap;
         va_start( ap, format );
         vfprintf( stderr, format, ap );
+		va_end(ap);
     }
 }
 
 #if 0
 int vs_fscanf( FILE *fp, const char *format, ... )
 {
+	int ret = 0;
     if (!use_volumes) {
         va_list arglist;
         va_start( arglist, format );
         //return _input(fp,(unsigned char*)format,arglist);
-        return vfscanf( fp, format, arglist );
-    } else {}
-    return 0;
+        ret = vfscanf( fp, format, arglist );
+		va_end(arglist);
+    }
+    return ret;
 }
 #endif
 
@@ -563,6 +568,18 @@
     data_paths.push_back( DATA_DIR );
 #endif
     if ( !vegastrike_cwd.empty() ) {
+		/* whatever the plan was, it does not work on Linux - at least
+		 * not at this stage. Hence, use fixed absolute paths to
+		 * find data directory
+		 */ 
+		data_paths.push_back( "/usr/share/games/vegastrike/data");
+		data_paths.push_back( "/usr/share/vegastrike/data");
+		data_paths.push_back( "/usr/games/vegastrike/data");
+		data_paths.push_back( "/usr/local/share/games/vegastrike/data");
+		data_paths.push_back( "/usr/local/share/vegastrike/data");
+		data_paths.push_back( "/usr/local/games/vegastrike/data");
+		data_paths.push_back( "/opt/vegastrike/data");
+
         data_paths.push_back( vegastrike_cwd );
         data_paths.push_back( vegastrike_cwd+"/.." );
         data_paths.push_back( vegastrike_cwd+"/../data4.x" );
@@ -1713,16 +1730,18 @@
 
 int VSFile::Fprintf( const char *format, ... )
 {
+	int ret = 0;
     if (!UseVolumes[alt_type] || this->volume_type == VSFSNone) {
         va_list ap;
         va_start( ap, format );
 
-        return vfprintf( this->fp, format, ap );
+        ret = vfprintf( this->fp, format, ap );
+		va_end(ap);
     } else {
         cerr<<"!!! ERROR : Writing is not supported within resource/volume files"<<endl;
         VSExit( 1 );
     }
-    return 0;
+    return ret;
 }
 
 #if 0
@@ -1742,18 +1761,17 @@
     if (!UseVolumes[alt_type] || this->volume_type == VSFSNone) {
         //return _input(fp,(unsigned char*)format,arglist);
         ret = vfscanf( this->fp, newformat, arglist );
-        va_end( arglist );
     } else {
         if (q_volume_format == vfmtVSR) {} else if (q_volume_format == vfmtPK3) {
             //If the file has not been extracted yet we do now
             checkExtracted();
             ret = vsscanf( pk3_extracted_file+offset, newformat, arglist );
             readbytes     = GetReadBytes( newformat, arglist );
-            va_end( arglist );
             cerr<<" SSCANF : Read "<<readbytes<<" bytes"<<endl;
             this->offset += readbytes;
         }
     }
+	va_end( arglist );
     delete[] newformat;
     return ret;
 }