fix(fifa17): never schedule the club's own kit team as a season opponent

The pre-match kit clone resolves BOTH sides out of the client's own
teamkits table keyed on teamtechid, with only teamkittypetechid (0 home,
1 away) telling the strips apart:

    teamtechid        == record+0x94   (wire teamid)
    teamkittypetechid == 0 for activeHomeKit, 1 for activeAwayKit
    year              == record+0xba   (wire year)

Our club wears team 21's kit (fcc_kitcards carddbid 6300006/6400003 are
both teamid 21), and the offline-season ladder cycled a fixed opponent
list whose first entry was also 21. So round 0 put the club against the
team whose kit it wears and both sides rendered the same strip. It is
also simply wrong data: a club playing itself.

The schedule now excludes the club's own kit team, which the host derives
from Core's active kit designations via resolve_kit. An exclusion that
would empty the rotation is ignored, because an empty matches array makes
StartSeason dereference NULL at CardsDLL+0xfc5b5.

This is not a kit-pipeline change: squad.actives already produces the two
resident cardtype-7 records with the correct itemStates, and the clone
query is satisfied by that data unchanged.
This commit is contained in:
funman300
2026-08-24 18:26:01 +00:00
parent a5e5628039
commit 98f30931a0
2 changed files with 94 additions and 8 deletions
+23 -1
View File
@@ -4964,6 +4964,28 @@ impl Server {
json_status(200, &non_economy::feature_off_body())
}
/// The team whose kit this club currently wears, from its active kit items.
///
/// The pre-match kit clone resolves BOTH sides out of the client's own
/// `teamkits` table keyed on `teamtechid`, with only `teamkittypetechid`
/// distinguishing home from away. So if a season fixture names the club's own
/// kit team, the opponent renders the club's kit and both sides appear in
/// identical strips — which is also just wrong data, a club playing itself.
/// [`season_wire::season_list_body`] excludes this team from the schedule.
///
/// Best-effort: any Core hiccup yields `None` and the full rotation, which is
/// the pre-existing behaviour rather than a failed request.
fn own_kit_team_id(&self) -> Option<i64> {
let active = self.core.get_active_kits().ok()?;
let designated = active.home_owned_card_id.or(active.away_owned_card_id)?;
let page = self.core.query_owned(&[]).ok()?;
let item = page
.items
.iter()
.find(|item| item.owned_card_id == designated)?;
self.resolver.resolve_kit(item).map(|kit| kit.team_id)
}
/// `…/season…` — FIFA 17 offline Seasons.
///
/// The client will not open the mode until it has a schedule: `season/list`
@@ -4987,7 +5009,7 @@ impl Server {
let (kind, body) = match sub {
"list" => (
"list",
season_wire::season_list_body(SEASON_ID, DIVISION_ID),
season_wire::season_list_body(SEASON_ID, DIVISION_ID, self.own_kit_team_id()),
),
"user" => (
"user",