@@ -15,7 +15,7 @@ import (
1515
1616func now32 () int64 { return time .Now ().Unix () & 0x7fffffff }
1717
18- // query runs a backend SELECT and converts rows to the given columns. Integer
18+ // queryCols runs a backend SELECT and converts rows to the given columns. Integer
1919// columns are clamped to 32 bits: the game aborts on 64-bit values.
2020func (c * call ) queryCols (ctx context.Context , cols []Column , q string , args ... any ) (* result , error ) {
2121 rs , err := c .g .db .QueryContext (ctx , q , args ... )
@@ -93,8 +93,6 @@ func (c *call) backendErr(err error) error {
9393func (c * call ) uid () int64 { return int64 (c .s .acct .UserID ) }
9494func (c * call ) c4id () int64 { return int64 (c .s .acct .C4ID ) }
9595
96- // ---- Login ----
97-
9896func hStatus (ctx context.Context , c * call ) (* result , error ) {
9997 res , err := c .query (ctx , "SELECT version, status, message FROM c4_status LIMIT 1" )
10098 if err != nil {
@@ -164,8 +162,6 @@ func hChecksums(ctx context.Context, c *call) (*result, error) {
164162 return res , err
165163}
166164
167- // ---- Scenario lists ----
168-
169165func hEmpireScenarios (ctx context.Context , c * call ) (* result , error ) {
170166 return c .query (ctx , "SELECT scenario, scenid FROM c4_scenarios WHERE empire='1' ORDER BY scenario" )
171167}
@@ -213,8 +209,6 @@ func hTimeTrialGoals(ctx context.Context, c *call) (*result, error) {
213209 c .int (0 ), c .int (1 ))
214210}
215211
216- // ---- Single scenario ----
217-
218212func hScenarioID (ctx context.Context , c * call ) (* result , error ) {
219213 return c .query (ctx , "SELECT scenid FROM c4_scenarios WHERE scenario=?" , c .str (0 ))
220214}
@@ -231,8 +225,6 @@ func hScenarioChecksum(ctx context.Context, c *call) (*result, error) {
231225 return res , err
232226}
233227
234- // ---- Seasons ----
235-
236228func hSeasonID (ctx context.Context , c * call ) (* result , error ) {
237229 return c .query (ctx , "SELECT seasonid FROM c4_comp_seasons WHERE activedate < ? ORDER BY seasonid DESC LIMIT 1" , now32 ())
238230}
@@ -248,8 +240,6 @@ func hNextSeason(ctx context.Context, c *call) (*result, error) {
248240 return res , nil
249241}
250242
251- // ---- Rankings ----
252-
253243func hArenaHasRank (ctx context.Context , c * call ) (* result , error ) {
254244 return c .query (ctx , "SELECT COUNT(1) FROM c4_comp_rankings WHERE seasonid=? AND scenid=? AND userid=?" , c .int (0 ), c .int (1 ), c .uid ())
255245}
@@ -342,8 +332,6 @@ func hEmpireLeaderboard(ctx context.Context, c *call) (*result, error) {
342332 return c .leaderboard (ctx , "c4_map_cities" , "r.scenid=?" , []any {c .int (0 )}, 1 )
343333}
344334
345- // ---- Uploads ----
346-
347335// checkUpload flags stat values and targets that look wrong. Ranges are
348336// guesses, so by default problems are only logged; -enforce-uploads rejects.
349337func (c * call ) checkUpload (ctx context.Context , arena bool , seasonid , scenid int64 , stats []Value ) error {
@@ -455,8 +443,6 @@ func hEmpireUpdateRank(ctx context.Context, c *call) (*result, error) {
455443 WHERE scenid=? AND userid=?` , args ... )
456444}
457445
458- // ---- Screenshots ----
459-
460446func hArenaSSCount (ctx context.Context , c * call ) (* result , error ) {
461447 return c .query (ctx , "SELECT COUNT(1) FROM c4_comp_ss WHERE seasonid=? AND scenid=? AND userid=?" , c .int (0 ), c .int (1 ), c .uid ())
462448}
@@ -489,8 +475,6 @@ func hEmpireSSGet(ctx context.Context, c *call) (*result, error) {
489475 return c .query (ctx , "SELECT scenid, userid, screenshot FROM c4_map_ss WHERE scenid=? AND userid=?" , c .int (0 ), c .uid ())
490476}
491477
492- // ---- Building lists ----
493-
494478func hArenaBuildingsCount (ctx context.Context , c * call ) (* result , error ) {
495479 return c .query (ctx , "SELECT COUNT(1) FROM c4_comp_buildings WHERE seasonid=? AND scenid=? AND userid=?" , c .int (0 ), c .int (1 ), c .uid ())
496480}
@@ -530,8 +514,6 @@ func hEmpireBuildingsUpdate(ctx context.Context, c *call) (*result, error) {
530514 return c .exec (ctx , "UPDATE c4_map_buildings SET buildings=? WHERE scenid=? AND userid=?" , c .str (0 ), c .int (1 ), c .uid ())
531515}
532516
533- // ---- End of game ----
534-
535517func hEmpireEndgame (ctx context.Context , c * call ) (* result , error ) {
536518 return c .query (ctx , "SELECT favor, timeplayed, population, happiness, funds, treasury, culture, security, prosperity FROM c4_map_cities WHERE scenid=? AND userid=?" ,
537519 c .int (0 ), c .uid ())
0 commit comments