*/}}
Browse Source

add function declarations and missing return values, use C++17

clang is quite picky when it comes to building
Georg Gadinger 10 months ago
parent
commit
b4ff8b4bd0
10 changed files with 27 additions and 7 deletions
  1. 3 1
      .gitignore
  2. 1 0
      CMakeLists.txt
  3. 1 1
      la_animation.c
  4. 1 1
      la_audio.c
  5. 4 1
      la_data.c
  6. 2 0
      la_resource.c
  7. 1 1
      la_tns.h
  8. 3 1
      la_tns_kernel.c
  9. 4 1
      resources/la_modelling.c
  10. 7 0
      resources/la_properties.c

+ 3 - 1
.gitignore

@@ -1,4 +1,6 @@
 build/*
 .vscode/
 screenshots/
-*.udf
+*.udf
+# Qt creator-generated files
+*.user

+ 1 - 0
CMakeLists.txt

@@ -23,6 +23,7 @@ find_package(Freetype REQUIRED)
 find_package(GLEW REQUIRED)
 find_package(LuaJIT)
 find_package(PNG)
+set(CMAKE_CXX_STANDARD 17)
 
 SET(LAGUI_USE_LUAJIT true CACHE BOOL "Whether to use LuaJIT in LaGUI")
 if(${LuaJIT_FOUND} AND ${LAGUI_USE_LUAJIT})

+ 1 - 1
la_animation.c

@@ -137,7 +137,7 @@ laActionKey* laAnimationInsertKeyFrame(laAction* aa, void* hyper1, laProp* p, in
             if(error) *error=2; return 0;
         }
     }
-    laActionChannel* ac=laAnimationEnsureChannel(aa,hyper1,p); if(!ac || !ac->AP || !ac->AP->For) return;
+    laActionChannel* ac=laAnimationEnsureChannel(aa,hyper1,p); if(!ac || !ac->AP || !ac->AP->For) return 0;
     int frame=LA_ACTION_FRAME(aa);
     laActionKey* ak=laAnimationEnsureFrame(ac,frame);
     laAnimationStoreKeyValue(ac,ak);

+ 1 - 1
la_audio.c

@@ -650,5 +650,5 @@ void laInitAudio(){
 }
 
 void laAudioDummy(){
-    return 0;
+    return;
 }

+ 4 - 1
la_data.c

@@ -26,6 +26,9 @@ const char* LA_UDF_EXTENSION_STRINGS[]={
     "",
 };
 
+int la_WriteHyperRecords(laUDF *udf);
+int laIterateDB(laDBInst* parent, laPropPack* pp, laDiff* diff, laDBProp* dp);
+
 int la_IsThisProp(laProp *p, char *id){
     return (!strcmp(p->Identifier, id));
 }
@@ -1337,7 +1340,7 @@ int laSetIntArraySingle(laPropPack *pp, int index, int n){
     if (p->Base.DetachedPP.LastPs){
         p->Detached[index] = n;
         laNotifyUsersPP(pp);
-        return;
+        return 0;
     }
     if (!pp->LastPs->UseInstance) return 0;
     if (pp->LastPs->p->PropertyType & LA_PROP_INT){

+ 2 - 0
la_resource.c

@@ -89,6 +89,8 @@ laPropContainer *_LA_PROP_FILE_BROWSER;
 
 laProp _P_LA_USE_INSTANCE_ONLY;
 
+void la_RegisterViewerOperators();
+
 void la_RegisterMainOperators(){
     la_RegisterUiOperatorsBasic();
     la_RegisterViewerOperators();

+ 1 - 1
la_tns.h

@@ -1157,7 +1157,7 @@ tnsShapeObject *tnsCreateShapeSquare(tnsObject *under, char *Name, real AtX, rea
 int tnsMergeMeshObjects(tnsMeshObject* into, tnsMeshObject* mo);
 tnsInstancer* tnsDuplicateInstancer(tnsInstancer* from);
 tnsMeshObject* tnsDuplicateMeshObject(tnsMeshObject* from);
-tnsShapeObject* tnsDuplicateShappeObject(tnsShapeObject* from);
+tnsShapeObject* tnsDuplicateShapeObject(tnsShapeObject* from);
 
 void tnsInitMeshPlane(tnsMeshObject* mo, real size);
 void tnsAddMMeshPlane(tnsMeshObject* mo, real size);

+ 3 - 1
la_tns_kernel.c

@@ -107,6 +107,8 @@ tnsMatrixStackItem *tKnlGetCurrentMatStackItem();
 void tnsAttach2DOffscreenBuffer(tnsOffscreen *target, GLuint attatchment, tnsTexture *use);
 void tnsDetach2DOffscreenBuffer(tnsOffscreen *target, GLuint which_attach_point);
 
+void tns_InvalidateMeshWithMaterial(tnsMaterial* m);
+
 //=========================================================================================
 
 tnsMain *T;
@@ -1620,7 +1622,7 @@ void tnsDrawBatchInitArrayStates(tnsBatch* batch){
     tnsUniformUseTexture(cs, 0, 0);
 }
 int tnsDrawBatch(tnsBatch* batch, const char* OverrideCommand, real* OverrideUniformColor, int OverrideAsArray) {
-	if (!batch) return;
+    if (!batch) return 0;
     int Drawn=0; tnsShader *LastShader=T->BindedShader,*SaveShader=T->BindedShader; int NeedInit=1;
 
     int IsOverrideColor=0; int PointSizeChanged=0,LineWidthChanged=0;

+ 4 - 1
resources/la_modelling.c

@@ -22,6 +22,9 @@
 extern LA MAIN;
 extern struct _tnsMain *T;
 
+void tnsRemoveMaterial(tnsMaterial* mat);
+void tns_InvalidateMeshWithMaterial(tnsMaterial* m);
+
 void la_ReadGLocation(tnsOffscreen* off, int x, int y,float* xyz0){
     if(!off->pColor[2]){ tnsVectorSet3(xyz0,0,0,0); return; }
     glBindFramebuffer(GL_READ_FRAMEBUFFER, off->FboHandle);
@@ -1929,7 +1932,7 @@ int OPINV_RemoveRootObject(laOperator *a, laEvent *e){
 
 int OPINV_NewMaterial(laOperator *a, laEvent *e){
     tnsMaterial* mat=tnsCreateMaterial("Material"); laNotifyUsers("tns.world.materials");
-    if(!a->This && a->This->EndInstance) return;
+    if(!a->This && a->This->EndInstance) return LA_CANCELED;
     laPropContainer* pc=la_EnsureSubTarget(a->This->LastPs->p,a->This->EndInstance);
     if(pc==TNS_PC_OBJECT_MESH){
         tnsMeshObject* mo=a->This->EndInstance; if(mo->CurrentMaterial){

+ 7 - 0
resources/la_properties.c

@@ -21,6 +21,13 @@
 extern LA MAIN;
 extern struct _tnsMain *T;
 
+void logClear();
+void la_ConditionNodeFreeRecursive(laUiConditionNode *ucn);
+void la_AssignWindowPP(laWindow* w);
+void la_AssignPropExtras(laUiItem* ui);
+void la_AssignBlockPP(laBlock* b);
+int la_GetPropertySize(int Type);
+
 void laset_TerminalInput(void* unused, char* content){
     if((!content)||(!content[0])){ MAIN.TerminalInput[0]=0; return; }
     int len=strlen(content);