Patch: LoadNamedMissionScript() [APPLIED]

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

Moderator: Mod Contributor

Patch: LoadNamedMissionScript() [APPLIED]

Postby chuck_starchaser » Wed Mar 12, 2008 8:10 am

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 @@
Index: src/cmd/ai/navigation.cpp
--- src/cmd/ai/navigation.cpp   (revision 11957)
+++ src/cmd/ai/navigation.cpp   (working copy)
@@ -529,7 +529,7 @@
-  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 ();

Last edited by chuck_starchaser on Wed Mar 12, 2008 12:40 pm, edited 1 time in total.
User avatar
Posts: 8014
Topics: 195
Joined: Thu Sep 04, 2003 9:03 pm
Location: Montreal

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Postby ace123 » Wed Mar 12, 2008 11:52 am

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.
Lead Network Developer
Lead Network Developer
Posts: 2560
Topics: 32
Joined: Sun Jan 12, 2003 2:13 am
Location: Palo Alto CA

Postby chuck_starchaser » Wed Mar 12, 2008 12:40 pm

Thanks, Ace!
User avatar
Posts: 8014
Topics: 195
Joined: Thu Sep 04, 2003 9:03 pm
Location: Montreal

Return to Modding Engine Room

Who is online

Users browsing this forum: No registered users and 1 guest