]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/surface_ufoai/surfdlg_plugin.cpp
fix warning: unused variable 'foo'
[xonotic/netradiant.git] / plugins / surface_ufoai / surfdlg_plugin.cpp
1 /*
2    Copyright (c) 2001, Loki software, inc.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms, with or without modification,
6    are permitted provided that the following conditions are met:
7
8    Redistributions of source code must retain the above copyright notice, this list
9    of conditions and the following disclaimer.
10
11    Redistributions in binary form must reproduce the above copyright notice, this
12    list of conditions and the following disclaimer in the documentation and/or
13    other materials provided with the distribution.
14
15    Neither the name of Loki software nor the names of its contributors may be used
16    to endorse or promote products derived from this software without specific prior
17    written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
20    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22    DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
23    DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include <stdio.h>
32 #include "surfdlg_plugin.h"
33 #include "surfacedialog.h"
34
35 #include "synapse.h"
36
37 class CSynapseClient_SurfDLG : public CSynapseClient
38 {
39 public:
40 // CSynapseClient API
41 bool RequestAPI( APIDescriptor_t *pAPI );
42 const char* GetInfo();
43 const char* GetName();
44 bool OnActivate();
45
46 CSynapseClient_SurfDLG() { }
47 virtual ~CSynapseClient_SurfDLG() { }
48 };
49
50 // =============================================================================
51 // SYNAPSE
52
53 _QERFuncTable_1 g_FuncTable;
54 _QERUndoTable g_UndoTable;
55 _QERAppSurfaceTable g_AppSurfaceTable;
56 _QERSelectedFaceTable g_SelectedFaceTable;
57 _QERShadersTable g_ShadersTable;
58 _QERAppShadersTable g_AppShadersTable;
59 _QERAppDataTable g_AppDataTable;
60
61 CSynapseServer* g_pSynapseServer = NULL;
62 CSynapseClient_SurfDLG g_SynapseClient;
63
64 #if __GNUC__ >= 4
65 #pragma GCC visibility push(default)
66 #endif
67 extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
68 #if __GNUC__ >= 4
69 #pragma GCC visibility pop
70 #endif
71         if ( strcmp( version, SYNAPSE_VERSION ) ) {
72                 Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version );
73                 return NULL;
74         }
75         g_pSynapseServer = pServer;
76         g_pSynapseServer->IncRef();
77         Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
78
79         g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "ufoai", sizeof( _QERPlugSurfaceTable ) );
80         g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable );
81         g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable );
82         g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable );
83         g_SynapseClient.AddAPI( SELECTEDFACE_MAJOR, NULL, sizeof( _QERSelectedFaceTable ), SYN_REQUIRE, &g_SelectedFaceTable );
84         g_SynapseClient.AddAPI( SHADERS_MAJOR, "ufoai", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable );
85         g_SynapseClient.AddAPI( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable );
86         g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable );
87
88         return &g_SynapseClient;
89 }
90
91 bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){
92         if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) {
93                 _QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable );
94                 if ( !strcmp( pAPI->minor_name, "ufoai" ) ) {
95                         pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface;
96                         pSurfDialogTable->m_pfnDoSurface = &DoSurface;
97                         pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog;
98                         pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll;
99                         pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget;
100                         return true;
101                 }
102         }
103
104         Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() );
105         return false;
106 }
107
108 #include "version.h"
109
110 const char* CSynapseClient_SurfDLG::GetInfo(){
111         return "Surface Dialog (UFO: Alien Invasion) module built " __DATE__ " " RADIANT_VERSION;
112 }
113
114 const char* CSynapseClient_SurfDLG::GetName(){
115         return "surface";
116 }
117
118 bool CSynapseClient_SurfDLG::OnActivate(){
119         return true;
120 }