// uses events/block/sharedcitylayout.df - Try splitting it up later
uses events/city/building-pick-layout.df

map{ regiondef{

0 value special-lot-mode

	// Pick random lot on specific row
	: special-row-lot 1 maxrows clamp args( row )
		<- row lotsperblock * dup lotsperblock 1- - ($
			"CURBUILD " .. curbuild ..
			" LOTMAX " .. lotmax ..
			" SPECIAL-LOT " .. special-lot ..
			" SPECIAL-BUILD " .. special-lot-build ..
			" PLOTS-LEFT " .. plots-left
		$) print to special-lot
	;
	
	: curbuildprinter
		($
			"CURBUILD " .. curbuild ..
			" LOTMAX " .. lotmax ..
			" SPECIAL-LOT " .. special-lot ..
			" SPECIAL-BUILD " .. special-lot-build ..
			" PLOTS-LEFT " .. plots-left
		$) print
	;

	// Pick a random lot between 1 and MAXROW rows
	: special-toprows-lot ( maxrow ) 1 maxrows clamp
		lotsperblock * 1 rnd to special-lot
	;

	: special-any-lot maxrows special-toprows-lot ;

	: standard-lot 1 to special-lot-mode ;

	: special-lots-init
		special-lot-mode 1 = if special-any-lot then;
	;

	// Tack this on to the end of stuff we're already doing
	: blocks-start blocks-start special-lots-init ;

	: random-lot-base
			0 stack
			' dirt-lot shove
			' concrete-lot shove
			' gravel-lot shove
			' grass-lot shove
		shuffles pops execute drop
	;

	: example-lot-build args( locid )

		"SHOP & GO" sign-text!
		0.0 0.5 1 sign-bg!
		0.0 0.5 1 sign-border!
		1 1 1 sign-fg!

		<- locid prefab{ 5 6 1 shop }

		random-lot-base

		walkway
	;

	: example-special-lot-premission
		standard-lot
		"whatever tags" to special-lot-tags
		' example-lot-build to special-lot-build

		premission
	;

// Special lots
	
	: bar-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"bar" to special-lot-tags
		' make-a-pub to special-lot-build premission
	;
	
	: gunshop-premission
		standard-lot

		"events/inner/shoploc.df" $load	

		"gunshop" to special-lot-tags
		' make-a-gunshop to special-lot-build premission
	;

	: foodshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"foodshop" to special-lot-tags
		' make-a-foodshop to special-lot-build premission
	;
	
	: petshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"petshop" to special-lot-tags
		' make-a-petshop to special-lot-build premission
	;
	
	: minimart-premission
		standard-lot
		
		"events/siege/gasbar-location.df" $load
		"../deathforth/paul/gasbar.txt" $add-rooms
		
		"gasstation" to special-lot-tags
		' example-lot-build to special-lot-build premission
	;
	
	: clinic-premission
		standard-lot

		"events/inner/clinicloc.df" $load
		"../deathforth/rooms/clinic.txt" $add-rooms
		
		"clinic" to special-lot-tags
		' make-a-clinic to special-lot-build premission
	;
	
	: police-premission
		standard-lot

		"events/inner/policeloc.df" $load
		"../deathforth/rooms/police.txt" $add-rooms
		
		"police" to special-lot-tags
		' make-a-police to special-lot-build premission
	;
	
	: office-premission
		standard-lot
		
		"events/inner/officeloc.df" $load
		"../deathforth/rooms/bigoffice.txt" $add-rooms
		
		"office" to special-lot-tags
		' make-a-office to special-lot-build premission
	;
	
	: gym-premission
		standard-lot
		
		"events/inner/gymloc.df" $load
		"../deathforth/rooms/arcadegym.txt" $add-rooms
		
		"gym" to special-lot-tags
		' make-a-gym to special-lot-build premission
	;

	: rescueapt-premission
		standard-lot
		
		"events/inner/toughhouseloc.df" $load
		
		"rescueapartment" to special-lot-tags
		' make-a-rescueapt to special-lot-build premission
	;
	
	: rescuedogapt-premission
		standard-lot
		
		"events/inner/toughhouseloc.df" $load
		
		"rescuedogapartment" to special-lot-tags
		' make-a-barkapt to special-lot-build premission
	;
	
	: infestedhouse-premission
		standard-lot
		
		"events/inner/toughhouseloc.df" $load
		
		"infestedhouse" to special-lot-tags
		' make-a-infest to special-lot-build premission
	;
	
	: bannerhouse-premission
		standard-lot
		
		"events/inner/toughhouseloc.df" $load
		
		"bannerhouse" to special-lot-tags
		' make-a-banner to special-lot-build premission
	;
	
	: sporting-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"sportingshop" to special-lot-tags
		' make-a-sportshop to special-lot-build premission
	;
	
	: jockshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"jockshop" to special-lot-tags
		' make-a-jockshop to special-lot-build premission
	;
	
	: campingshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"campingshop" to special-lot-tags
		' make-a-camping to special-lot-build premission
	;
	
	: hardwareshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"hardwareshop" to special-lot-tags
		' make-a-hardware to special-lot-build premission
	;
	
	: umbrellashop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"umbrellashop" to special-lot-tags
		' make-a-umbrella to special-lot-build premission
	;
	
	: drugshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"drugshop" to special-lot-tags
		' make-a-drugshop to special-lot-build premission
	;
	
	: arcade-premission
		standard-lot
		
		"events/inner/arcadeloc.df" $load
		"../deathforth/rooms/arcadegym.txt" $add-rooms
		
		"arcade" to special-lot-tags
		' make-a-arcade to special-lot-build premission
	;
	
	: restaurant-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"restaurant" to special-lot-tags
		' make-a-restaurant to special-lot-build premission
	;
	
	: bookstore-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"bookshop" to special-lot-tags
		' make-a-bookshop to special-lot-build premission
	;
	
	: furnshop-premission
		standard-lot
		
		"events/inner/shoploc.df" $load
		
		"furnstore" to special-lot-tags
		' make-a-furnshop to special-lot-build premission
	;
	
	: coffee-premission
		standard-lot
		
		"events/inner/coffeeloc.df" $load
		
		"coffee" to special-lot-tags
		' make-a-coffee to special-lot-build premission
	;
	
	: example-special-choice choice( "VERY SPECIAL EMPTY BUILDING" )choice: example-special-lot-premission ;
	
	: bar choice( "BAR" )choice: bar-premission ;
	: gunshop choice( "GUN SHOP" )choice: gunshop-premission ;
	: foodshop choice( "GROCERY STORE" )choice: foodshop-premission ;
	: minimart choice( "CONVENIENCE MART" )choice: minimart-premission ;
	: drugshop choice( "PHARMACY" )choice: drugshop-premission ;
	: hardwareshop choice( "HARDWARE STORE" )choice: hardwareshop-premission ;
	: police choice( "POLICE STATION" )choice: police-premission ;
	: clinic choice( "MEDICAL CLINIC" )choice: clinic-premission ;
	: campingshop choice( "CAMP SUPPLIES SHOP" )choice: campingshop-premission ;
	: bannerhouse choice( "LOST SAFEHOUSE" )choice: bannerhouse-premission ;
	: gym choice( "STRENGTH & FITNESS GYM" )choice: gym-premission ;
	: rescueapt choice( "APARTMENT WITH 'HELP' BANNER" )choice: rescueapt-premission ;
	: office choice( "OFFICE BUILDING" )choice: office-premission ;
	: jockshop choice( "ATHLETIC STORE" )choice: jockshop-premission ;
	: sporting choice( "SPORTING GOODS STORE" )choice: sporting-premission ;
	: infestedhouse choice( "INFESTED STRONGHOLD" )choice: infestedhouse-premission ;
	: umbrellashop choice( "UMBRELLA SHOP" )choice: umbrellashop-premission ;
	
	: arcade choice( "ARCADE" )choice: arcade-premission ;
	: restaurant choice( "RESTAURANT" )choice: restaurant-premission ;
	: bookstore choice( "BOOK STORE" )choice: bookstore-premission ;
	: furnshop choice( "FURNITURE STORE" )choice: furnshop-premission ;
	: coffeeshop choice( "COFFEE SHOP" )choice: coffee-premission ;
	
	// Below were going to be rare, but cancelled the idea of rare special-lots
	
	: rescuedogapt choice( "APARTMENT WITH 'BARK' BANNER" )choice: rescuedogapt-premission ;
	: petshop choice( "PET SHOP" )choice: petshop-premission ;
	
	// fast food place
	
} }

0 var special-lot-deck

regiondef{

	deck-new
	//	card: example-special-choice
		card: bar
		card: minimart
		card: gunshop
		card: foodshop
	
		card: drugshop
		card: hardwareshop
		card: police
		card: clinic
		card: campingshop
		card: bannerhouse
		card: gym
		card: rescueapt
		card: office
		card: jockshop

		card: sporting
		card: infestedhouse
		card: umbrellashop
		
		card: arcade
		card: furnshop
		card: restaurant
		card: bookstore
		card: coffeeshop

		// Was going to have below be rare, but decided not to do a rare special-lots
		card: rescuedogapt
		card: petshop
		
	constant SPECIAL-LOT-DECK
	SPECIAL-LOT-DECK shuffles to special-lot-deck
	
}
	
	: lot-draw
		special-lot-deck depths 0= if 
			regiondef{ SPECIAL-LOT-DECK shuffles to special-lot-deck }
		then
		special-lot-deck drawcard
		special-lot-deck depths 0= if
			choice( "Drive Away" )choice
		else
			special-lot-deck drawcard
		then
	;
