27
27
******************************************************************************/
28
28
#include " buildingtypeext.h"
29
29
#include " buildingtype.h"
30
+ #include " tibsun_globals.h"
30
31
#include " tibsun_defines.h"
31
32
#include " ccini.h"
32
33
#include " wwcrc.h"
@@ -50,7 +51,9 @@ BuildingTypeClassExtension::BuildingTypeClassExtension(const BuildingTypeClass *
50
51
ProduceCashBudget(0 ),
51
52
IsStartupCashOneTime(false ),
52
53
IsResetBudgetOnCapture(false ),
53
- IsEligibleForAllyBuilding(false )
54
+ IsEligibleForAllyBuilding(false ),
55
+ NumberOfDocks(0 ),
56
+ DockingOffsets()
54
57
{
55
58
// if (this_ptr) EXT_DEBUG_TRACE("BuildingTypeClassExtension::BuildingTypeClassExtension - Name: %s (0x%08X)\n", Name(), (uintptr_t)(This()));
56
59
@@ -174,6 +177,8 @@ void BuildingTypeClassExtension::Compute_CRC(WWCRCEngine &crc) const
174
177
// EXT_DEBUG_TRACE("BuildingTypeClassExtension::Compute_CRC - Name: %s (0x%08X)\n", Name(), (uintptr_t)(This()));
175
178
176
179
crc (IsEligibleForAllyBuilding);
180
+ crc (NumberOfDocks);
181
+ crc (DockingOffsets.Count ());
177
182
}
178
183
179
184
@@ -190,7 +195,14 @@ bool BuildingTypeClassExtension::Read_INI(CCINIClass &ini)
190
195
return false ;
191
196
}
192
197
198
+ char buffer[1024 ];
199
+
193
200
const char *ini_name = Name ();
201
+ const char *graphic_name = Graphic_Name ();
202
+
203
+ // if (!ArtINI.Is_Present(graphic_name)) {
204
+ // return false;
205
+ // }
194
206
195
207
GateUpSound = ini.Get_VocType (ini_name, " GateUpSound" , GateUpSound);
196
208
GateDownSound = ini.Get_VocType (ini_name, " GateDownSound" , GateDownSound);
@@ -204,6 +216,37 @@ bool BuildingTypeClassExtension::Read_INI(CCINIClass &ini)
204
216
205
217
IsEligibleForAllyBuilding = ini.Get_Bool (ini_name, " EligibleForAllyBuilding" ,
206
218
This ()->IsConstructionYard ? true : IsEligibleForAllyBuilding);
219
+
220
+ /* *
221
+ * The following structures must have at least one docking location.
222
+ */
223
+ if (This ()->IsHelipad || This ()->IsRefinery || This ()->IsWeeder ) {
224
+ NumberOfDocks = 1 ;
225
+ }
226
+
227
+ NumberOfDocks = ini.Get_Int (ini_name, " NumberOfDocks" , NumberOfDocks);
228
+
229
+ for (int i = 0 ; i < NumberOfDocks; ++i) {
230
+ std::snprintf (buffer, sizeof (buffer), " DockingOffset%d" , i);
231
+
232
+ TPoint3D<int > default_value (0 , 0 , 0 );
233
+
234
+ /* *
235
+ * Both of these refinerys have artwork specific dock locations. As we have
236
+ * reimplemented Docking_Coord, we need to ensure the original positions
237
+ * remain unmodified.
238
+ */
239
+ if (This ()->IsWeeder ) {
240
+ default_value.X += CELL_LEPTON_W * 2 ;
241
+ default_value.Y += CELL_LEPTON_H;
242
+
243
+ } else if (This ()->IsRefinery ) {
244
+ default_value.X += CELL_LEPTON_W / 2 ;
245
+ }
246
+
247
+ TPoint3D<int > offset = ArtINI.Get_Point (graphic_name, buffer, default_value);
248
+ DockingOffsets.Add (offset);
249
+ }
207
250
208
251
return true ;
209
252
}
0 commit comments