mirror of
https://github.com/PretendoNetwork/super-mario-maker.git
synced 2026-04-23 09:07:52 -05:00
Pointers aren't really used on types since types rewrite, so use indexes on for statements instead
This commit is contained in:
parent
f6f600d897
commit
56905f89df
|
|
@ -24,8 +24,8 @@ func FollowingsLatestCourseSearchObject(err error, packet nex.PacketInterface, c
|
|||
// * does some kind of check over extraData. It's unknown what this
|
||||
// * check is, so it's not done here. All other data in param seems
|
||||
// * to be unused here.
|
||||
for _, pid := range param.OwnerIDs {
|
||||
courseObjectIDs, nexError := datastore_smm_db.GetUserCourseObjectIDs(pid)
|
||||
for i := range param.OwnerIDs {
|
||||
courseObjectIDs, nexError := datastore_smm_db.GetUserCourseObjectIDs(param.OwnerIDs[i])
|
||||
if nexError != nil {
|
||||
return nil, nexError
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ func FollowingsLatestCourseSearchObject(err error, packet nex.PacketInterface, c
|
|||
// * This method seems to always use slot 0?
|
||||
results := datastore_smm_db.GetCustomRankingsByDataIDs(types.NewUInt32(0), courseObjectIDs)
|
||||
|
||||
for _, rankingResult := range results {
|
||||
for j := range results {
|
||||
// * This is kind of backwards.
|
||||
// * The database pulls this data
|
||||
// * by default, so it can be done
|
||||
|
|
@ -44,23 +44,23 @@ func FollowingsLatestCourseSearchObject(err error, packet nex.PacketInterface, c
|
|||
// * is *NOT* set and conditionally
|
||||
// * *REMOVE* the field
|
||||
if param.ResultOption&0x1 == 0 {
|
||||
rankingResult.MetaInfo.Tags = types.NewList[types.String]()
|
||||
results[j].MetaInfo.Tags = types.NewList[types.String]()
|
||||
}
|
||||
|
||||
if param.ResultOption&0x2 == 0 {
|
||||
rankingResult.MetaInfo.Ratings = types.NewList[datastore_types.DataStoreRatingInfoWithSlot]()
|
||||
results[j].MetaInfo.Ratings = types.NewList[datastore_types.DataStoreRatingInfoWithSlot]()
|
||||
}
|
||||
|
||||
if param.ResultOption&0x4 == 0 {
|
||||
rankingResult.MetaInfo.MetaBinary = types.NewQBuffer(nil)
|
||||
results[j].MetaInfo.MetaBinary = types.NewQBuffer(nil)
|
||||
}
|
||||
|
||||
// TODO - If this flag is set, extraData is checked somehow
|
||||
if param.ResultOption&0x20 == 0 {
|
||||
rankingResult.Score = 0
|
||||
results[j].Score = 0
|
||||
}
|
||||
|
||||
pRankingResults = append(pRankingResults, rankingResult)
|
||||
pRankingResults = append(pRankingResults, results[j])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ func GetMetasWithCourseRecord(err error, packet nex.PacketInterface, callID uint
|
|||
pCourseResults := make(types.List[datastore_super_mario_maker_types.DataStoreGetCourseRecordResult], 0, len(params))
|
||||
pResults := make(types.List[types.QResult], 0, len(params))
|
||||
|
||||
for _, param := range params {
|
||||
for i := range params {
|
||||
// * metaParam has a password, but it's always set to 0.
|
||||
// * It also wouldn't make much sense for the same password
|
||||
// * to be used for all objects being requested here. So
|
||||
// * just assume metaParam is ONLY used for the resultOption
|
||||
// * field?
|
||||
objectInfo, nexError := datastore_db.GetObjectInfoByDataID(param.DataID)
|
||||
objectInfo, nexError := datastore_db.GetObjectInfoByDataID(params[i].DataID)
|
||||
if nexError != nil {
|
||||
objectInfo = datastore_types.NewDataStoreMetaInfo()
|
||||
} else {
|
||||
|
|
@ -66,7 +66,7 @@ func GetMetasWithCourseRecord(err error, packet nex.PacketInterface, callID uint
|
|||
}
|
||||
|
||||
// * Ignore errors, real server sends empty struct if can't be found
|
||||
courseRecord, nexError := datastore_smm_db.GetCourseRecordByDataIDAndSlot(param.DataID, param.Slot)
|
||||
courseRecord, nexError := datastore_smm_db.GetCourseRecordByDataIDAndSlot(params[i].DataID, params[i].Slot)
|
||||
if nexError != nil || objectInfo.DataID == 0 { // * DataID == 0 means could not be found or accessed
|
||||
courseRecord = datastore_super_mario_maker_types.NewDataStoreGetCourseRecordResult()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/PretendoNetwork/nex-go/v2/types"
|
||||
datastore_super_mario_maker "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/super-mario-maker"
|
||||
datastore_super_mario_maker_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/super-mario-maker/types"
|
||||
datastore_types "github.com/PretendoNetwork/nex-protocols-go/v2/datastore/types"
|
||||
datastore_db "github.com/PretendoNetwork/super-mario-maker/database/datastore"
|
||||
"github.com/PretendoNetwork/super-mario-maker/globals"
|
||||
)
|
||||
|
|
@ -22,8 +21,8 @@ func GetObjectInfos(err error, packet nex.PacketInterface, callID uint32, dataID
|
|||
|
||||
pInfos := types.NewList[datastore_super_mario_maker_types.DataStoreFileServerObjectInfo]()
|
||||
|
||||
for _, dataID := range dataIDs {
|
||||
objectInfo, nexError := datastore_db.GetObjectInfoByDataID(dataID)
|
||||
for i := range dataIDs {
|
||||
objectInfo, nexError := datastore_db.GetObjectInfoByDataID(dataIDs[i])
|
||||
if nexError != nil {
|
||||
return nil, nexError
|
||||
}
|
||||
|
|
@ -39,7 +38,6 @@ func GetObjectInfos(err error, packet nex.PacketInterface, callID uint32, dataID
|
|||
|
||||
info := datastore_super_mario_maker_types.NewDataStoreFileServerObjectInfo()
|
||||
info.DataID = objectInfo.DataID
|
||||
info.GetInfo = datastore_types.NewDataStoreReqGetInfo()
|
||||
info.GetInfo.URL = types.NewString(URL.String())
|
||||
info.GetInfo.Size = objectInfo.Size
|
||||
info.GetInfo.DataID = objectInfo.DataID
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ func PrepareAttachFile(err error, packet nex.PacketInterface, callID uint32, par
|
|||
// TODO - Should this be moved to InitializeObjectByAttachFileParam?
|
||||
// * This never seems to have any values during normal gameplay,
|
||||
// * but just in case
|
||||
for _, ratingInitParamWithSlot := range param.PostParam.RatingInitParams {
|
||||
nexError = datastore_db.InitializeObjectRatingWithSlot(uint64(dataID), ratingInitParamWithSlot)
|
||||
for i := range param.PostParam.RatingInitParams {
|
||||
nexError = datastore_db.InitializeObjectRatingWithSlot(uint64(dataID), param.PostParam.RatingInitParams[i])
|
||||
if nexError != nil {
|
||||
globals.Logger.Errorf("Error code %d on rating init", nexError.ResultCode)
|
||||
return nil, nexError
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ func RateCustomRanking(err error, packet nex.PacketInterface, callID uint32, par
|
|||
}
|
||||
|
||||
// TODO - Check the period. The real server does check this, just unsure what it means or what the check is
|
||||
for _, param := range params {
|
||||
datastore_smm_db.InsertOrUpdateCustomRanking(param.DataID, param.ApplicationID, param.Score)
|
||||
for i := range params {
|
||||
datastore_smm_db.InsertOrUpdateCustomRanking(params[i].DataID, params[i].ApplicationID, params[i].Score)
|
||||
}
|
||||
|
||||
rmcResponse := nex.NewRMCSuccess(globals.SecureEndpoint, nil)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user