df-structures icon indicating copy to clipboard operation
df-structures copied to clipboard

unk_5 in mission_report

Open Bumber64 opened this issue 4 years ago • 2 comments

https://github.com/DFHack/df-structures/blob/4d8800c87702cbe2324bb50dae79a2c1eeb85983/df.world.xml#L347

Reverse engineered a DF function called by history_eventst constructor. Lua code equivalent:

function pushNewCampaignEvent(event_id, mission_report, year, year_tick)
	local unk_5 = mission_report.unk_5
	
	if unk_5 < 0 or mission_report.campaigns[unk_5].events_count >= 64 then
		unk_5 = unk_5 + 1
		mission_report.unk_5 = unk_5
		if unk_5 < 0 or unk_5 >= #mission_report.campaigns then
			c_report = --new mission_campaign_report
			--zero all fields
			mission_report.campaigns:push(c_report)
		end
	end
	
	local camp = mission_report.campaigns[unk_5]
	camp.event_id[camp.events_count] = event_id
	camp.event_year[camp.events_count] = year
	camp.event_year_tick[camp.events_count] = year_tick
	camp.events_count = camp.events_count + 1
	
	return
end

Looks like it's the last (used?) index of the Campaigns vector.

Bumber64 avatar Sep 21 '21 10:09 Bumber64

Can you provide the location of the function in question? I'd like to look at it myself.

ab9rf avatar Sep 21 '21 17:09 ab9rf

Can you provide the location of the function in question? I'd like to look at it myself.

For Windows DF 0.47.05 64-bit, the masterwork loss constructor is 0x1401504C0, which calls the history event constructor 0x140709240, which calls the campaign event function 0x14007E640.

Bumber64 avatar Sep 21 '21 18:09 Bumber64