Rename protocol_version to hedgewars_engine_protocol_version to ensure use of correct library
authorunC0Rr
Fri, 07 Dec 2018 13:04:00 +0100
changeset 14375 ef2fc0210362
parent 14365 0f5223894914
child 14376 90bd2c331703
Rename protocol_version to hedgewars_engine_protocol_version to ensure use of correct library
qmlfrontend/engine_interface.h
qmlfrontend/main.cpp
rust/lib-hedgewars-engine/src/lib.rs
--- a/qmlfrontend/engine_interface.h	Mon Dec 03 18:35:32 2018 +0100
+++ b/qmlfrontend/engine_interface.h	Fri Dec 07 13:04:00 2018 +0100
@@ -18,7 +18,7 @@
   unsigned char* land;
 } PreviewInfo;
 
-typedef uint32_t protocol_version_t();
+typedef uint32_t hedgewars_engine_protocol_version_t();
 typedef EngineInstance* start_engine_t();
 typedef void generate_preview_t(EngineInstance* engine_state,
                                 PreviewInfo* preview);
@@ -36,7 +36,7 @@
 
 typedef bool advance_simulation_t(EngineInstance* engine_state, uint32_t ticks);
 
-extern protocol_version_t* protocol_version;
+extern hedgewars_engine_protocol_version_t* hedgewars_engine_protocol_version;
 extern start_engine_t* start_engine;
 extern generate_preview_t* generate_preview;
 extern cleanup_t* cleanup;
--- a/qmlfrontend/main.cpp	Mon Dec 03 18:35:32 2018 +0100
+++ b/qmlfrontend/main.cpp	Fri Dec 07 13:04:00 2018 +0100
@@ -7,7 +7,7 @@
 #include "hwengine.h"
 
 namespace Engine {
-protocol_version_t* protocol_version;
+hedgewars_engine_protocol_version_t* hedgewars_engine_protocol_version;
 start_engine_t* start_engine;
 generate_preview_t* generate_preview;
 cleanup_t* cleanup;
@@ -28,8 +28,9 @@
   if (!hwlib.load())
     qWarning() << "Engine library not found" << hwlib.errorString();
 
-  Engine::protocol_version = reinterpret_cast<Engine::protocol_version_t*>(
-      hwlib.resolve("protocol_version"));
+  Engine::hedgewars_engine_protocol_version =
+      reinterpret_cast<Engine::hedgewars_engine_protocol_version_t*>(
+          hwlib.resolve("hedgewars_engine_protocol_version"));
   Engine::start_engine =
       reinterpret_cast<Engine::start_engine_t*>(hwlib.resolve("start_engine"));
   Engine::generate_preview = reinterpret_cast<Engine::generate_preview_t*>(
@@ -50,9 +51,9 @@
   Engine::advance_simulation = reinterpret_cast<Engine::advance_simulation_t*>(
       hwlib.resolve("advance_simulation"));
 
-  if (Engine::protocol_version)
+  if (Engine::hedgewars_engine_protocol_version)
     qDebug() << "Loaded engine library with protocol version"
-             << Engine::protocol_version();
+             << Engine::hedgewars_engine_protocol_version();
 }
 
 int main(int argc, char* argv[]) {
--- a/rust/lib-hedgewars-engine/src/lib.rs	Mon Dec 03 18:35:32 2018 +0100
+++ b/rust/lib-hedgewars-engine/src/lib.rs	Fri Dec 07 13:04:00 2018 +0100
@@ -25,8 +25,8 @@
 }
 
 #[no_mangle]
-pub extern "C" fn protocol_version() -> u32 {
-    56
+pub extern "C" fn hedgewars_engine_protocol_version() -> u32 {
+    58
 }
 
 #[no_mangle]