Skip to content

Commit 5d78634

Browse files
author
abstrct
committed
starting to chip away at struct refactoring
1 parent b97c7d2 commit 5d78634

4 files changed

Lines changed: 64 additions & 436 deletions

File tree

x/structs/keeper/fleet_cache.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,17 @@ func (cache *FleetCache) PeaceDeal() (){
259259
cache.SetLocationToPlanet(cache.GetOwner().GetPlanet())
260260
}
261261

262-
func (cache *FleetCache) BuildInitiateReadiness(structure *types.Struct, structType *types.StructType, ambit types.Ambit, ambitSlot uint64) (error) {
262+
func (cache *FleetCache) BuildInitiateReadiness(structure *types.Struct, structType *StructTypeCache, ambit types.Ambit, ambitSlot uint64) (error) {
263263
if structure.GetOwner() != cache.GetOwnerId() {
264-
return types.NewStructOwnershipError(structure.Id, cache.GetOwnerId(), structure.GetOwner()).WithLocation("fleet", cache.GetFleetId())
264+
return types.NewStructOwnershipError(structure.GetStructId(), cache.GetOwnerId(), structure.GetOwner()).WithLocation("fleet", cache.GetFleetId())
265265
}
266266

267267
if cache.IsAway() {
268268
return types.NewFleetStateError(cache.GetFleetId(), "away", "build")
269269
}
270270

271271

272-
if structType.Type != types.CommandStruct {
272+
if structType.GetStructType().Type != types.CommandStruct {
273273
if !cache.HasCommandStruct() {
274274
return types.NewFleetCommandError(cache.GetFleetId(), "no_command_struct")
275275
}
@@ -279,7 +279,7 @@ func (cache *FleetCache) BuildInitiateReadiness(structure *types.Struct, structT
279279
}
280280
}
281281

282-
if (structType.Category != types.ObjectType_fleet) {
282+
if (structType.GetStructType().Category != types.ObjectType_fleet) {
283283
return types.NewStructLocationError(structType.GetId(), ambit.String(), "outside_planet")
284284
}
285285

@@ -288,7 +288,7 @@ func (cache *FleetCache) BuildInitiateReadiness(structure *types.Struct, structT
288288
return types.NewStructLocationError(structType.GetId(), ambit.String(), "invalid_ambit")
289289
}
290290

291-
if structType.Type == types.CommandStruct {
291+
if structType.GetStructType().Type == types.CommandStruct {
292292
if cache.HasCommandStruct() {
293293
return types.NewStructBuildError(structType.GetId(), "fleet", cache.GetFleetId(), "command_exists")
294294
}

x/structs/keeper/planet_cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ func (cache *PlanetCache) IsSuccessful(successRate fraction.Fraction) bool {
303303
return randomnessCheck
304304
}
305305

306-
func (cache *PlanetCache) BuildInitiateReadiness(structure *types.Struct, structType *types.StructType, ambit types.Ambit, ambitSlot uint64) (error) {
306+
func (cache *PlanetCache) BuildInitiateReadiness(structure *types.Struct, structType *StructTypeCache, ambit types.Ambit, ambitSlot uint64) (error) {
307307
if structure.GetOwner() != cache.GetOwnerId() {
308-
return types.NewStructOwnershipError(structure.Id, cache.GetOwnerId(), structure.GetOwner()).WithLocation("planet", cache.GetPlanetId())
308+
return types.NewStructOwnershipError(structure.GetStructId(), cache.GetOwnerId(), structure.GetOwner()).WithLocation("planet", cache.GetPlanetId())
309309
}
310310

311-
if structType.Type == types.CommandStruct {
311+
if structType.GetStructType().Type == types.CommandStruct {
312312
return types.NewStructLocationError(structType.GetId(), ambit.String(), "command_struct_fleet_only")
313313
}
314314

@@ -324,7 +324,7 @@ func (cache *PlanetCache) BuildInitiateReadiness(structure *types.Struct, struct
324324
return types.NewFleetCommandError(cache.GetOwner().GetFleetId(), "command_offline")
325325
}
326326

327-
if (structType.Category != types.ObjectType_planet) {
327+
if (structType.GetStructType().Category != types.ObjectType_planet) {
328328
return types.NewStructLocationError(structType.GetId(), ambit.String(), "outside_planet")
329329
}
330330

0 commit comments

Comments
 (0)