Patch: LoadNamedMissionScript() [APPLIED]

For collaboration on developing the mod capabilities of VS; request new features, report bugs, or suggest improvements

Moderator: Mod Contributor

Post Reply
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Patch: LoadNamedMissionScript() [APPLIED]

Post by chuck_starchaser »

From Wolphin:

Code: Select all

Index: src/python/star_system_exports.h
===================================================================
--- src/python/star_system_exports.h   (revision 11957)
+++ src/python/star_system_exports.h   (working copy)
@@ -44,6 +44,7 @@
 voidEXPORT_UTIL(SetAutoStatus)
 voidEXPORT_UTIL(LoadMission)
 voidEXPORT_UTIL(LoadMissionScript)
+voidEXPORT_UTIL(LoadNamedMissionScript)
 voidEXPORT_UTIL(setMissionOwner)
 EXPORT_UTIL(getMissionOwner,1)
 EXPORT_UTIL(GetDifficulty,1)
Index: src/cmd/ai/navigation.cpp
===================================================================
--- src/cmd/ai/navigation.cpp   (revision 11957)
+++ src/cmd/ai/navigation.cpp   (working copy)
@@ -529,7 +529,7 @@
    parent->autopilotactive=false;
     return;
   }
-  static bool compensate_for_interdiction=XMLSupport::parse_bool(vs_config->getVariable("phyics","autopilot_compensate_for_interdiction","false"));
+  static bool compensate_for_interdiction=XMLSupport::parse_bool(vs_config->getVariable("physics","autopilot_compensate_for_interdiction","false"));
   static float enough_warp_for_cruise=XMLSupport::parse_float(vs_config->getVariable("physics","enough_warp_for_cruise","1000"));
   static float go_perpendicular_speed=XMLSupport::parse_float(vs_config->getVariable("physics","warp_perpendicular","80"));
   static float min_warp_orbit_radius=XMLSupport::parse_float(vs_config->getVariable("physics","min_warp_orbit_radius","100000000"));
Index: src/universe_util_generic.cpp
===================================================================
--- src/universe_util_generic.cpp   (revision 11957)
+++ src/universe_util_generic.cpp   (working copy)
@@ -570,6 +570,9 @@
    void LoadMissionScript (string missionscript) {
       ::LoadMission ("nothing.mission",missionscript,false);
    }
+   void LoadNamedMissionScript (string missionname, string missionscript) {
+      ::LoadMission (missionname.c_str(),missionscript,false);
+   }
 
    void SetAutoStatus (int global_auto, int player_auto) {
       if (global_auto==1) {
Index: src/universe_util.h
===================================================================
--- src/universe_util.h   (revision 11957)
+++ src/universe_util.h   (working copy)
@@ -190,6 +190,7 @@
    void SetAutoStatus (int global_auto, int player_auto);
    void LoadMission (std::string missionname);
    void LoadMissionScript (std::string scriptcontents);
+   void LoadNamedMissionScript (std::string missionname, std::string scriptcontents);
    QVector SafeEntrancePoint (QVector,float radial_size=-1);
    QVector SafeStarSystemEntrancePoint (StarSystem *sts, QVector,float radial_size=-1);
    float getPlanetRadiusPercent ();
See,
http://wcjunction.com/phpBB2/viewtopic.php?t=519
Last edited by chuck_starchaser on Wed Mar 12, 2008 7:40 pm, edited 1 time in total.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I have added the LoadNamedMissionScript function and I will commit it to SVN when it finishes compiling.

There might not be a windows binary that supports this for a few days, however...

The only change I made is by adding the required "#" automatically to the name, since at this point the old deprecated functionality of specifying a different script is basically useless.

Also, I noticed that it will use "internal.mission" instead of "nothing.mission" if it starts with a hash, but again I don't know if there is any difference.
Post Reply