patch-0.5.1.r1_2 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. diff -ruN ./CMakeLists.txt ../c/CMakeLists.txt
  2. --- ./CMakeLists.txt 2012-03-26 02:50:49.000000000 +0200
  3. +++ ../c/CMakeLists.txt 2020-09-03 16:25:55.870086658 +0200
  4. @@ -10,7 +10,7 @@
  5. project (vsUTCS)
  6. -
  7. +include(GNUInstallDirs)
  8. include_directories(${vsUTCS_SOURCE_DIR}/src
  9. ${vsUTCS_SOURCE_DIR}/src/cmd
  10. @@ -828,33 +828,33 @@
  11. #Find FFMpeg
  12. -find_package(FFMPEG)
  13. -IF(FFMPEG_FOUND)
  14. - SET(TST_INCLUDES ${TST_INCLUDES} ${FFMPEG_INCLUDE_DIRS})
  15. - SET(TST_LIBS ${TST_LIBS} ${FFMPEG_LIBRARIES})
  16. - add_definitions(${FFMPEG_DEFINITIONS})
  17. - SET(HAVE_FFMPEG 1 )
  18. - IF(swscale1_FOUND)
  19. - message("++ FFmpeg's libswscale found.")
  20. - ELSE(swscale1_FOUND)
  21. - message("-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.")
  22. - ENDIF(swscale1_FOUND)
  23. -ELSE(FFMPEG_FOUND)
  24. - message("-- FFMPEG Not Found")
  25. -ENDIF(FFMPEG_FOUND)
  26. +#find_package(FFMPEG)
  27. +#IF(FFMPEG_FOUND)
  28. +# SET(TST_INCLUDES ${TST_INCLUDES} ${FFMPEG_INCLUDE_DIRS})
  29. +# SET(TST_LIBS ${TST_LIBS} ${FFMPEG_LIBRARIES})
  30. +# add_definitions(${FFMPEG_DEFINITIONS})
  31. +# SET(HAVE_FFMPEG 1 )
  32. +# IF(swscale1_FOUND)
  33. +# message("++ FFmpeg's libswscale found.")
  34. +# ELSE(swscale1_FOUND)
  35. +# message("-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.")
  36. +# ENDIF(swscale1_FOUND)
  37. +#ELSE(FFMPEG_FOUND)
  38. +# message("-- FFMPEG Not Found")
  39. +#ENDIF(FFMPEG_FOUND)
  40. #Find Ogre
  41. -find_package(OGRE)
  42. -IF(OGRE_FOUND)
  43. - SET(TST_INCLUDES ${TST_INCLUDES} ${OGRE_INCLUDE_DIR})
  44. - SET(TST_LIBS ${TST_LIBS} ${OGRE_LIBRARY})
  45. - add_definitions(${OGRE_DEFINITIONS})
  46. - SET(HAVE_OGRE 1)
  47. - message("++ Found Ogre: ${OGRE_VERSION}")
  48. -ELSE(OGRE_FOUND)
  49. - message("-- Ogre Not Found: compiling without")
  50. -ENDIF(OGRE_FOUND)
  51. +#find_package(OGRE)
  52. +#IF(OGRE_FOUND)
  53. +# SET(TST_INCLUDES ${TST_INCLUDES} ${OGRE_INCLUDE_DIR})
  54. +# SET(TST_LIBS ${TST_LIBS} ${OGRE_LIBRARY})
  55. +# add_definitions(${OGRE_DEFINITIONS})
  56. +# SET(HAVE_OGRE 1)
  57. +# message("++ Found Ogre: ${OGRE_VERSION}")
  58. +#ELSE(OGRE_FOUND)
  59. +# message("-- Ogre Not Found: compiling without")
  60. +#ENDIF(OGRE_FOUND)
  61. IF(NOT BEOS)
  62. FIND_LIBRARY(UTIL_LIB util)
  63. @@ -977,12 +977,12 @@
  64. HAVE_AVFORMAT_H
  65. HAVE_AVCODEC_H
  66. HAVE_AVIO_H
  67. - HAVE_FFMPEG_SWSCALE_H
  68. +# HAVE_FFMPEG_SWSCALE_H
  69. CMAKE_BACKWARDS_COMPATIBILITY
  70. - FFMPEG_INCLUDE_DIR
  71. - FFMPEG_FOUND
  72. - FFMPEG_LIBRARIES
  73. - FFMPEG_DEFINITIONS
  74. +# FFMPEG_INCLUDE_DIR
  75. +# FFMPEG_FOUND
  76. +# FFMPEG_LIBRARIES
  77. +# FFMPEG_DEFINITIONS
  78. GTK2_ATK_INCLUDE_DIR
  79. GTK2_ATK_LIBRARY
  80. GTK2_CAIRO_INCLUDE_DIR
  81. diff -ruN ./objconv/basemaker/base_maker_texture.cpp ../c/objconv/basemaker/base_maker_texture.cpp
  82. --- ./objconv/basemaker/base_maker_texture.cpp 2010-03-10 03:56:23.000000000 +0100
  83. +++ ../c/objconv/basemaker/base_maker_texture.cpp 2020-09-03 16:25:55.871086646 +0200
  84. @@ -6,9 +6,12 @@
  85. #define XMD_H
  86. #define HAVE_BOOLEAN
  87. #endif
  88. +
  89. extern "C" {
  90. //YUCK it doesn't even have extern c in the headers!
  91. #include <jpeglib.h>
  92. +#include <string.h>
  93. +
  94. }
  95. #define strip_16 true
  96. diff -ruN ./objconv/mesher/to_OgreMesh.cpp ../c/objconv/mesher/to_OgreMesh.cpp
  97. --- ./objconv/mesher/to_OgreMesh.cpp 2011-06-02 01:47:36.000000000 +0200
  98. +++ ../c/objconv/mesher/to_OgreMesh.cpp 2020-09-03 16:25:55.872086633 +0200
  99. @@ -1078,10 +1078,15 @@
  100. Ogre::VertexDeclaration *newDcl =
  101. data->vertexDeclaration->getAutoOrganisedDeclaration(
  102. mesh->hasSkeleton() );
  103. -#else
  104. +#elif (OGRE_VERSION_MAJOR == 1) && (OGRE_VERSION_MINOR < 8)
  105. Ogre::VertexDeclaration *newDcl =
  106. data->vertexDeclaration->getAutoOrganisedDeclaration(
  107. mesh->hasSkeleton(), mesh->hasVertexAnimation() || (mesh->getPoseCount() > 0) );
  108. +#else
  109. + Ogre::VertexDeclaration *newDcl =
  110. + data->vertexDeclaration->getAutoOrganisedDeclaration(
  111. + mesh->hasSkeleton(), mesh->hasVertexAnimation() || (mesh->getPoseCount() > 0),
  112. + mesh->getSharedVertexDataAnimationIncludesNormals()); // what about Pose objects?
  113. #endif
  114. if ( *newDcl != *(data->vertexDeclaration) ) {
  115. //Usages don't matter here since we're onlly exporting
  116. @@ -1109,35 +1114,35 @@
  117. }
  118. }
  119. -void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance )
  120. -{
  121. - struct outputContext *ctxt = (struct outputContext*) outputcontext;
  122. - MeshPtr newMesh = ctxt->top;
  123. - if ( force || (newMesh->getNumLodLevels() <= 1) ) {
  124. - if (newMesh->getNumLodLevels() <= 1)
  125. - newMesh->removeLodLevels();
  126. - const Ogre::ProgressiveMesh::VertexReductionQuota quota = Ogre::ProgressiveMesh::VRQ_PROPORTIONAL;
  127. - const Real reduction = Real( 1-reductionFactor );
  128. -
  129. - Real currDist = refDistance;
  130. -
  131. - #if (OGRE_VERSION >= 0x010700)
  132. - Ogre::Mesh::LodValueList distanceList;
  133. -
  134. - // pixel area is squared length, and length is proportional to triangle count
  135. - const Real distFactor = reductionFactor * reductionFactor;
  136. - newMesh->setLodStrategy(Ogre::LodStrategyManager::getSingletonPtr()->
  137. - getStrategy( "PixelCount" ) );
  138. - #else
  139. - Ogre::Mesh::LodDistanceList distanceList;
  140. - const Real distFactor = ( (reduction > 0.00001) ? 1/reduction : 1 );
  141. - #endif
  142. -
  143. - for (int iLod = 0; iLod < numLod; ++iLod, currDist *= distFactor)
  144. - distanceList.push_back( currDist );
  145. - newMesh->generateLodLevels( distanceList, quota, reduction );
  146. - }
  147. -}
  148. +//void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance )
  149. +//{
  150. +// struct outputContext *ctxt = (struct outputContext*) outputcontext;
  151. +// MeshPtr newMesh = ctxt->top;
  152. +// if ( force || (newMesh->getNumLodLevels() <= 1) ) {
  153. +// if (newMesh->getNumLodLevels() <= 1)
  154. +// newMesh->removeLodLevels();
  155. +// const Ogre::ProgressiveMesh::VertexReductionQuota quota = Ogre::ProgressiveMesh::VRQ_PROPORTIONAL;
  156. +// const Real reduction = Real( 1-reductionFactor );
  157. +//
  158. +// Real currDist = refDistance;
  159. +//
  160. +// #if (OGRE_VERSION >= 0x010700)
  161. +// Ogre::Mesh::LodValueList distanceList;
  162. +//
  163. +// // pixel area is squared length, and length is proportional to triangle count
  164. +// const Real distFactor = reductionFactor * reductionFactor;
  165. +// newMesh->setLodStrategy(Ogre::LodStrategyManager::getSingletonPtr()->
  166. +// getStrategy( "PixelCount" ) );
  167. +// #else
  168. +// Ogre::Mesh::LodDistanceList distanceList;
  169. +// const Real distFactor = ( (reduction > 0.00001) ? 1/reduction : 1 );
  170. +// #endif
  171. +//
  172. +// for (int iLod = 0; iLod < numLod; ++iLod, currDist *= distFactor)
  173. +// distanceList.push_back( currDist );
  174. +// newMesh->generateLodLevels( distanceList, quota, reduction );
  175. +// }
  176. +//}
  177. void DoneMeshes( void *outputcontext )
  178. {
  179. diff -ruN ./objconv/mesher/to_OgreMesh.h ../c/objconv/mesher/to_OgreMesh.h
  180. --- ./objconv/mesher/to_OgreMesh.h 2010-02-25 16:22:25.000000000 +0100
  181. +++ ../c/objconv/mesher/to_OgreMesh.h 2020-09-03 16:25:55.873086621 +0200
  182. @@ -20,7 +20,7 @@
  183. float RadialSize( void *outputcontext ); //returns the size of the resulting mesh (it's maximum distance from 0,0,0). Useful for LODding.
  184. void Optimize( void *outputcontext ); //a good idea - reorganizes internal buffers so that the output mesh is more efficient
  185. -void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance ); //autogenerates LOD levels - if force==true, will discard current LOD data
  186. +//void AutoLOD( void *outputcontext, bool force, int numLod, float reductionFactor, float refDistance ); //autogenerates LOD levels - if force==true, will discard current LOD data
  187. void AutoEdgeList( void *outputcontext ); //a good idea - prepares the mesh for stencil shadows
  188. void AutoTangents( void *outputcontext ); //prepares the mesh for normal mapping (only needed if the material uses normal mapping)
  189. }
  190. diff -ruN ./setup/src/c/setup.cpp ../c/setup/src/c/setup.cpp
  191. --- ./setup/src/c/setup.cpp 2011-03-15 01:28:47.000000000 +0100
  192. +++ ../c/setup/src/c/setup.cpp 2020-09-03 16:25:55.873086621 +0200
  193. @@ -110,10 +110,22 @@
  194. return 1;
  195. }
  196. }
  197. -
  198. +
  199. #ifdef DATA_DIR
  200. data_paths.push_back( DATA_DIR );
  201. #endif
  202. + /* whatever the plan was, it does not work on Linux - at least
  203. + * not at this stage. Hence, use fixed absolute paths to
  204. + * find data directory
  205. + */
  206. + data_paths.push_back( "/usr/share/games/vegastrike/data");
  207. + data_paths.push_back( "/usr/share/vegastrike/data");
  208. + data_paths.push_back( "/usr/games/vegastrike/data");
  209. + data_paths.push_back( "/usr/local/share/games/vegastrike/data");
  210. + data_paths.push_back( "/usr/local/share/vegastrike/data");
  211. + data_paths.push_back( "/usr/local/games/vegastrike/data");
  212. + data_paths.push_back( "/opt/vegastrike/data");
  213. +
  214. data_paths.push_back( origpath );
  215. data_paths.push_back( string( origpath )+"/.." );
  216. data_paths.push_back( string( origpath )+"/../data4.x" );
  217. @@ -133,22 +145,7 @@
  218. data_paths.push_back( "../Resources" );
  219. data_paths.push_back( "../Resources/data" );
  220. data_paths.push_back( "../Resources/data4.x" );
  221. -/*
  222. - * data_paths.push_back( "/usr/share/local/vegastrike/data");
  223. - * data_paths.push_back( "/usr/local/share/vegastrike/data");
  224. - * data_paths.push_back( "/usr/local/vegastrike/data");
  225. - * data_paths.push_back( "/usr/share/vegastrike/data");
  226. - * data_paths.push_back( "/usr/local/games/vegastrike/data");
  227. - * data_paths.push_back( "/usr/games/vegastrike/data");
  228. - * data_paths.push_back( "/opt/share/vegastrike/data");
  229. - * data_paths.push_back( "/usr/share/local/vegastrike/data4.x");
  230. - * data_paths.push_back( "/usr/local/share/vegastrike/data4.x");
  231. - * data_paths.push_back( "/usr/local/vegastrike/data4.x");
  232. - * data_paths.push_back( "/usr/share/vegastrike/data4.x");
  233. - * data_paths.push_back( "/usr/local/games/vegastrike/data4.x");
  234. - * data_paths.push_back( "/usr/games/vegastrike/data4.x");
  235. - * data_paths.push_back( "/opt/share/vegastrike/data4.x");
  236. - */
  237. +
  238. //Win32 data should be "."
  239. char tmppath[16384];
  240. for (vector< string >::iterator vsit = data_paths.begin(); vsit != data_paths.end(); vsit++) {
  241. diff -ruN ./setup/src/include/central.cpp ../c/setup/src/include/central.cpp
  242. --- ./setup/src/include/central.cpp 2004-10-25 04:27:13.000000000 +0200
  243. +++ ../c/setup/src/include/central.cpp 2020-09-03 17:45:35.786329482 +0200
  244. @@ -20,6 +20,8 @@
  245. struct group GROUPS;
  246. struct global_settings CONFIG;
  247. +static char EMPTY_STR[] = "";
  248. +
  249. // Primary initialization function. Sets everything up and takes care of the program
  250. void Start(int * argc, char ***argv) {
  251. LoadMainConfig();
  252. @@ -65,7 +67,7 @@
  253. if (CUR->name == NULL) { continue; }
  254. if (strcmp(CUR->name, group) == 0) { return CUR->setting; }
  255. } while ((CUR = CUR->next) > 0);
  256. - return '\0';
  257. + return EMPTY_STR;
  258. }
  259. struct catagory *GetCatStruct(char *name) {
  260. diff -ruN ./src/cmd/music.cpp ../c/src/cmd/music.cpp
  261. --- ./src/cmd/music.cpp 2012-03-19 09:20:14.000000000 +0100
  262. +++ ../c/src/cmd/music.cpp 2020-09-03 16:25:55.874086608 +0200
  263. @@ -448,7 +448,9 @@
  264. if (foundcache) {
  265. *me->music_load_info = wherecache->second;
  266. me->freeWav = false;
  267. - }
  268. + } else if ( ! AUDLoadSoundFile(songname, me->music_load_info, true)) {
  269. + VSFileSystem::vs_dprintf(1, "Failed to load music file \"%s\"", songname);
  270. + }
  271. }
  272. if (me->freeWav && docacheme) {
  273. me->freeWav = false;
  274. diff -ruN ./src/cmd/unit.cpp ../c/src/cmd/unit.cpp
  275. --- ./src/cmd/unit.cpp 2012-03-19 09:20:14.000000000 +0100
  276. +++ ../c/src/cmd/unit.cpp 2020-09-03 16:25:55.875086596 +0200
  277. @@ -80,6 +80,7 @@
  278. template < class UnitType >GameUnit< UnitType >::GameUnit( int ) : sparkle_accum( 0 )
  279. , phalos( new HaloSystem() )
  280. {
  281. + VSFileSystem::vs_dprintf(3, "Unit created by Constructor: template < class UnitType >GameUnit< UnitType >::GameUnit( int ) : sparkle_accum( 0 ), phalos( new HaloSystem() )\n");
  282. this->Unit::Init();
  283. }
  284. @@ -99,6 +100,14 @@
  285. , phalos( new HaloSystem() )
  286. {
  287. Unit::Init( filename, SubU, faction, unitModifications, flightgrp, fg_subnumber, netxml );
  288. +
  289. + std::string fn = string(filename);
  290. + std::string str_faction = string(FactionUtil::GetFaction(faction));
  291. + std::string objtype = UniverseUtil::LookupUnitStat( fn, str_faction, "Object_Type");
  292. + if (objtype.compare("Vessel") == 0) {
  293. + VSFileSystem::vs_dprintf(3, "Recomputing upgrades for (units.csv) Object_Type: %s\n", objtype.c_str());
  294. + UnitUtil::RecomputeUnitUpgrades(this);
  295. + }
  296. }
  297. template < class UnitType >GameUnit< UnitType >::~GameUnit()
  298. diff -ruN ./src/cmd/unit_collide.h ../c/src/cmd/unit_collide.h
  299. --- ./src/cmd/unit_collide.h 2012-03-19 09:20:14.000000000 +0100
  300. +++ ../c/src/cmd/unit_collide.h 2020-09-03 17:34:09.178913256 +0200
  301. @@ -94,9 +94,9 @@
  302. {
  303. if ( !hugeobjects.empty() )
  304. hugeobjects.clear();
  305. - if ( this->active_huge.size() )
  306. + if ( this->active_huge->size() )
  307. ha.clear();
  308. - if ( this->accum_huge.size() )
  309. + if ( this->accum_huge->size() )
  310. hb.clear();
  311. acc_huge.clear();
  312. act_huge.clear();
  313. diff -ruN ./src/cmd/unit_generic.cpp ../c/src/cmd/unit_generic.cpp
  314. --- ./src/cmd/unit_generic.cpp 2012-03-19 09:20:14.000000000 +0100
  315. +++ ../c/src/cmd/unit_generic.cpp 2020-09-03 16:25:55.879086546 +0200
  316. @@ -4903,16 +4903,26 @@
  317. static const string LOAD_FAILED = "LOAD_FAILED";
  318. +//const Unit * makeFinalBlankUpgrade( string name, int faction )
  319. +//{
  320. +// char *unitdir = GetUnitDir( name.c_str() );
  321. +// string limiternam = name;
  322. +// if (unitdir != name)
  323. +// limiternam = string( unitdir )+string( ".blank" );
  324. +// free( unitdir );
  325. +// const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( limiternam, faction ) );
  326. +// if (!lim)
  327. +// lim = UnitConstCache::setCachedConst( StringIntKey( limiternam, faction ), makeBlankUpgrade( limiternam, faction ) );
  328. +// if (lim->name == LOAD_FAILED)
  329. +// lim = NULL;
  330. +// return lim;
  331. +//}
  332. +
  333. const Unit * makeFinalBlankUpgrade( string name, int faction )
  334. {
  335. - char *unitdir = GetUnitDir( name.c_str() );
  336. - string limiternam = name;
  337. - if (unitdir != name)
  338. - limiternam = string( unitdir )+string( ".blank" );
  339. - free( unitdir );
  340. - const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( limiternam, faction ) );
  341. + const Unit *lim = UnitConstCache::getCachedConst( StringIntKey( name, faction ) );
  342. if (!lim)
  343. - lim = UnitConstCache::setCachedConst( StringIntKey( limiternam, faction ), makeBlankUpgrade( limiternam, faction ) );
  344. + lim = UnitConstCache::setCachedConst( StringIntKey( name, faction ), makeBlankUpgrade( name, faction ) );
  345. if (lim->name == LOAD_FAILED)
  346. lim = NULL;
  347. return lim;
  348. @@ -6387,21 +6397,48 @@
  349. int tmpammo = mounts[jmod].ammo;
  350. if (mounts[jmod].ammo != -1 && up->mounts[i].ammo != -1) {
  351. tmpammo += up->mounts[i].ammo;
  352. - if (templ) {
  353. - if (templ->GetNumMounts() > jmod) {
  354. - if (templ->mounts[jmod].volume != -1) {
  355. - if (templ->mounts[jmod].volume < mounts[jmod].type->volume*tmpammo) {
  356. - tmpammo =
  357. - (int) floor( .125
  358. - +( (0
  359. - +templ->mounts[jmod].volume)
  360. - /mounts[jmod].type->volume ) );
  361. + if (ismissiletype) {
  362. + if (templ) {
  363. + if (templ->GetNumMounts() > jmod) {
  364. + if (templ->mounts[jmod].volume != -1) {
  365. + if (templ->mounts[jmod].volume < mounts[jmod].type->volume*tmpammo) {
  366. + tmpammo =
  367. + (int) floor( .125
  368. + +( (0
  369. + +templ->mounts[jmod].volume)
  370. + /mounts[jmod].type->volume ) );
  371. + }
  372. }
  373. }
  374. }
  375. + if (tmpammo*mounts[jmod].type->volume > mounts[jmod].volume)
  376. + tmpammo = (int) floor( .125+( (0+mounts[jmod].volume)/mounts[jmod].type->volume ) );
  377. + } else {
  378. + std::string ammoname = up->name.get();
  379. + std::size_t ammopos = ammoname.find("_ammo");
  380. + std::string weaponname = ammoname.substr(0, ammopos);
  381. +
  382. + /* Do NOT delete this Unit because it will be either fetched
  383. + * from a cache or - if it has to be created - it will
  384. + * be automatically put in a cache.
  385. + * Deletion will corrupt the cache!
  386. + */
  387. + const Unit * weapon = getUnitFromUpgradeName(weaponname);
  388. +
  389. + if (weapon == NULL || weapon->name == LOAD_FAILED) {
  390. + // this should not happen
  391. + VSFileSystem::vs_dprintf(1, "UpgradeMount(): FAILED to obtain weapon: %s\n", weaponname.c_str());
  392. + cancompletefully = false;
  393. + break;
  394. + }
  395. +
  396. + int maxammo = weapon->mounts[0].ammo;
  397. +
  398. + if (tmpammo > maxammo) {
  399. + tmpammo = maxammo;
  400. + }
  401. }
  402. - if (tmpammo*mounts[jmod].type->volume > mounts[jmod].volume)
  403. - tmpammo = (int) floor( .125+( (0+mounts[jmod].volume)/mounts[jmod].type->volume ) );
  404. +
  405. if (tmpammo > mounts[jmod].ammo) {
  406. cancompletefully = true;
  407. if (touchme)
  408. diff -ruN ./src/cmd/unit_jump.h ../c/src/cmd/unit_jump.h
  409. --- ./src/cmd/unit_jump.h 2012-03-19 09:20:14.000000000 +0100
  410. +++ ../c/src/cmd/unit_jump.h 2020-09-03 16:25:55.880086533 +0200
  411. @@ -108,7 +108,7 @@
  412. (tester = *i) != NULL; ++i)
  413. if (tester->isUnit() == UNITPTR && tester != this)
  414. if ( ( this->LocalPosition()-tester->LocalPosition() ).Magnitude() < this->rSize()+tester->rSize() )
  415. - SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
  416. + this->SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
  417. *( 4*( this->rSize()+tester->rSize() ) ) );
  418. DealPossibleJumpDamage( this );
  419. static int jumparrive = AUDCreateSound( vs_config->getVariable( "unitaudio", "jumparrive", "sfx43.wav" ), false );
  420. diff -ruN ./src/gfx/cockpit_xml.cpp ../c/src/gfx/cockpit_xml.cpp
  421. --- ./src/gfx/cockpit_xml.cpp 2010-12-15 09:53:40.000000000 +0100
  422. +++ ../c/src/gfx/cockpit_xml.cpp 2020-09-03 16:30:00.313030701 +0200
  423. @@ -315,7 +315,7 @@
  424. for (counter = 0; counter < 4; ++counter)
  425. if (!replaced[counter]) {
  426. delete Pit[counter];
  427. - Pit[counter] = false;
  428. + Pit[counter] = NULL;
  429. }
  430. break;
  431. case UnitImages< void >::SHIELD4:
  432. diff -ruN ./src/gfx/quadsquare.cpp ../c/src/gfx/quadsquare.cpp
  433. --- ./src/gfx/quadsquare.cpp 2010-03-10 06:27:01.000000000 +0100
  434. +++ ../c/src/gfx/quadsquare.cpp 2020-09-03 16:25:55.881086521 +0200
  435. @@ -13,9 +13,9 @@
  436. #include <float.h>
  437. #include <math.h>
  438. #include <assert.h>
  439. -#include "quadsquare.h"
  440. #include "gfxlib.h"
  441. #include "aux_texture.h"
  442. +#include "quadsquare.h"
  443. using std::vector;
  444. unsigned int*quadsquare::VertexAllocated;
  445. diff -ruN ./src/gui/text_area.cpp ../c/src/gui/text_area.cpp
  446. --- ./src/gui/text_area.cpp 2010-02-25 15:26:53.000000000 +0100
  447. +++ ../c/src/gui/text_area.cpp 2020-09-03 17:46:51.883378138 +0200
  448. @@ -32,6 +32,8 @@
  449. * };
  450. */
  451. +static char EMPTY_STR[] = "";
  452. +
  453. TextArea::~TextArea() {}
  454. TextArea::TextArea()
  455. @@ -316,7 +318,7 @@
  456. {
  457. TextAreaItem *search;
  458. search = ItemList->FindCount( cur_selected, 0 );
  459. - if (search == 0) return '\0';
  460. + if (search == 0) return EMPTY_STR;
  461. if (type == 1) return search->name;
  462. else return search->description;
  463. diff -ruN ./src/networking/lowlevel/packetmem.cpp ../c/src/networking/lowlevel/packetmem.cpp
  464. --- ./src/networking/lowlevel/packetmem.cpp 2008-03-31 10:20:19.000000000 +0200
  465. +++ ../c/src/networking/lowlevel/packetmem.cpp 2020-09-03 16:25:55.881086521 +0200
  466. @@ -102,7 +102,7 @@
  467. }
  468. else
  469. {
  470. - _buffer.reset( 0 );
  471. + _buffer.reset();
  472. _len = 0;
  473. }
  474. }
  475. diff -ruN ./src/pk3.cpp ../c/src/pk3.cpp
  476. --- ./src/pk3.cpp 2012-03-19 09:20:14.000000000 +0100
  477. +++ ../c/src/pk3.cpp 2020-09-03 16:31:12.819124250 +0200
  478. @@ -356,7 +356,7 @@
  479. }
  480. //if the file isn't in the archive
  481. if (index == -1)
  482. - return false;
  483. + return NULL;
  484. int flength = GetFileLen( index );
  485. buffer = new char[flength];
  486. diff -ruN ./src/vsfilesystem.cpp ../c/src/vsfilesystem.cpp
  487. --- ./src/vsfilesystem.cpp 2012-03-19 09:20:14.000000000 +0100
  488. +++ ../c/src/vsfilesystem.cpp 2020-09-03 16:25:55.882086508 +0200
  489. @@ -460,13 +460,15 @@
  490. int vs_fprintf( FILE *fp, const char *format, ... )
  491. {
  492. + int ret = 0;
  493. if (!use_volumes) {
  494. va_list ap;
  495. va_start( ap, format );
  496. - return vfprintf( fp, format, ap );
  497. - } else {}
  498. - return 0;
  499. + ret = vfprintf( fp, format, ap );
  500. + va_end(ap);
  501. + }
  502. + return ret;
  503. }
  504. void vs_dprintf( char level, const char *format, ... )
  505. @@ -475,19 +477,22 @@
  506. va_list ap;
  507. va_start( ap, format );
  508. vfprintf( stderr, format, ap );
  509. + va_end(ap);
  510. }
  511. }
  512. #if 0
  513. int vs_fscanf( FILE *fp, const char *format, ... )
  514. {
  515. + int ret = 0;
  516. if (!use_volumes) {
  517. va_list arglist;
  518. va_start( arglist, format );
  519. //return _input(fp,(unsigned char*)format,arglist);
  520. - return vfscanf( fp, format, arglist );
  521. - } else {}
  522. - return 0;
  523. + ret = vfscanf( fp, format, arglist );
  524. + va_end(arglist);
  525. + }
  526. + return ret;
  527. }
  528. #endif
  529. @@ -563,6 +568,18 @@
  530. data_paths.push_back( DATA_DIR );
  531. #endif
  532. if ( !vegastrike_cwd.empty() ) {
  533. + /* whatever the plan was, it does not work on Linux - at least
  534. + * not at this stage. Hence, use fixed absolute paths to
  535. + * find data directory
  536. + */
  537. + data_paths.push_back( "/usr/share/games/vegastrike/data");
  538. + data_paths.push_back( "/usr/share/vegastrike/data");
  539. + data_paths.push_back( "/usr/games/vegastrike/data");
  540. + data_paths.push_back( "/usr/local/share/games/vegastrike/data");
  541. + data_paths.push_back( "/usr/local/share/vegastrike/data");
  542. + data_paths.push_back( "/usr/local/games/vegastrike/data");
  543. + data_paths.push_back( "/opt/vegastrike/data");
  544. +
  545. data_paths.push_back( vegastrike_cwd );
  546. data_paths.push_back( vegastrike_cwd+"/.." );
  547. data_paths.push_back( vegastrike_cwd+"/../data4.x" );
  548. @@ -1713,16 +1730,18 @@
  549. int VSFile::Fprintf( const char *format, ... )
  550. {
  551. + int ret = 0;
  552. if (!UseVolumes[alt_type] || this->volume_type == VSFSNone) {
  553. va_list ap;
  554. va_start( ap, format );
  555. - return vfprintf( this->fp, format, ap );
  556. + ret = vfprintf( this->fp, format, ap );
  557. + va_end(ap);
  558. } else {
  559. cerr<<"!!! ERROR : Writing is not supported within resource/volume files"<<endl;
  560. VSExit( 1 );
  561. }
  562. - return 0;
  563. + return ret;
  564. }
  565. #if 0
  566. @@ -1742,18 +1761,17 @@
  567. if (!UseVolumes[alt_type] || this->volume_type == VSFSNone) {
  568. //return _input(fp,(unsigned char*)format,arglist);
  569. ret = vfscanf( this->fp, newformat, arglist );
  570. - va_end( arglist );
  571. } else {
  572. if (q_volume_format == vfmtVSR) {} else if (q_volume_format == vfmtPK3) {
  573. //If the file has not been extracted yet we do now
  574. checkExtracted();
  575. ret = vsscanf( pk3_extracted_file+offset, newformat, arglist );
  576. readbytes = GetReadBytes( newformat, arglist );
  577. - va_end( arglist );
  578. cerr<<" SSCANF : Read "<<readbytes<<" bytes"<<endl;
  579. this->offset += readbytes;
  580. }
  581. }
  582. + va_end( arglist );
  583. delete[] newformat;
  584. return ret;
  585. }