Commit MetaInfo

Révision8cb43c48b63213866e09cb89427cf5e9f0e86432 (tree)
l'heure2013-03-08 03:38:41
AuteurFace
CommiterFace

Message de Log

Genericvessel: refactored slash detection with generic code instead of duplication

Change Summary

Modification

diff -r f18cdf847b6a -r 8cb43c48b632 Orbitersdk/samples/genericvessel/GenericVessel.cpp
--- a/Orbitersdk/samples/genericvessel/GenericVessel.cpp Thu Mar 07 19:16:33 2013 +0100
+++ b/Orbitersdk/samples/genericvessel/GenericVessel.cpp Thu Mar 07 19:38:41 2013 +0100
@@ -106,16 +106,13 @@
106106 char *iniFile=NULL;
107107 char *className=GetClassName(), *cn=NULL;
108108 char *name=GetName();
109- strcpy(cn=new char[strlen(className)+1], className);
109+ strcpy(cn=new char[(k=strlen(className))+1], className);
110110 strlwr(cn);
111+ for(i=0;i<k;i++)if(cn[i]=='/')cn[i]='\\';
111112 if (strncmp(cn, SPACECRAFTCLASS, strlen(SPACECRAFTCLASS))==0){
112113 //INI file at legacy location - fixed prefix here, because it is not clear if SC3 respected custom config paths
113114 iniFile=new char[strlen(name)+strlen(SPACECRAFTINIPATH)];
114115 sprintf(iniFile, SPACECRAFTINIPATH, name);
115- }else if (strncmp(cn, SPACECRAFTCLASS2, strlen(SPACECRAFTCLASS2))==0){
116- //INI file at legacy location - fixed prefix here, because it is not clear if SC3 respected custom config paths
117- iniFile=new char[strlen(name)+strlen(SPACECRAFTINIPATH)];
118- sprintf(iniFile, SPACECRAFTINIPATH, name);
119116 }else{
120117 //configuration file is also INI file, read orbiter.cfg first to get custom config paths
121118 FILEHANDLE f=oapiOpenFile(ORBITERCONFIG, FILE_IN);
diff -r f18cdf847b6a -r 8cb43c48b632 Orbitersdk/samples/genericvessel/GenericVessel.h
--- a/Orbitersdk/samples/genericvessel/GenericVessel.h Thu Mar 07 19:16:33 2013 +0100
+++ b/Orbitersdk/samples/genericvessel/GenericVessel.h Thu Mar 07 19:38:41 2013 +0100
@@ -9,7 +9,6 @@
99 #define CUSTOMDIRSLENGTH 1024
1010 //############################################################################//
1111 #define SPACECRAFTCLASS "spacecraft\\spacecraft"
12-#define SPACECRAFTCLASS2 "spacecraft/spacecraft"
1312 #define SPACECRAFTINIPATH ".\\Config\\Spacecraft\\%s.ini"
1413 #define CONFIGDIRTAG "ConfigDir"
1514 #define MESHDIRTAG "MeshDir"
Afficher sur ancien navigateur de dépôt.