Browse Source

[changed] wrapped all accesses to the value of student in a function call in preparation for adding checks that the player should still be a student when this is checked. made expulsion set student = -1, and changed some places that checked student = 0 to check student <= 0 to fix a bug where you could reapply to the university after being expelled only to be instantly expelled again. moved logic for enrolling and unenrolling from the university to the same file as function for checking value of student to cut down on code duplication and make this the only place where the raw student variable is accessed. fixed two typos

Spackled Lanturn 3 years ago
parent
commit
ece34efc4b

+ 1 - 0
glife-notepad++

@@ -747,6 +747,7 @@
 			<File name="locations\ugol" />
 			<File name="locations\ugol1" />
 			<File name="locations\unicoursework" />
+			<File name="locations\uniutil" />
 			<File name="locations\univer" />
 			<File name="locations\univer_din" />
 			<File name="locations\vann" />

+ 1 - 0
glife.qproj

@@ -914,6 +914,7 @@
 		<Location name="Vika"/>
 		<Location name="univer_din"/>
 		<Location name="unicoursework"/>
+		<Location name="uniutil"/>
 	</Folder>
 	<Folder name="Game 1">
 		<Location name="KGstart"/>

+ 1 - 1
locations/Komp.qsrc

@@ -82,7 +82,7 @@ if $ARGS[0] = 'brows':
 		if shantfoto > 0:act 'Find the girl you took photos of in the park on "Assbook"':gt 'komp', 'foto'
 		if gor_dorm = 7:act 'Read letter from Eugene':gt 'etoexhib', 'pos91'
 		if camwhore = 1 and $loc ! 'shulga_room' and $loc ! 'anushapt':act 'Go to MyFreeCams.org':gt 'komp', 'mfc'
-		if (storyline = 1 and SchoolAtestat = 0) or student > 0:act 'Spend time studying':gt 'komp', 'study'
+		if (storyline = 1 and SchoolAtestat = 0) or func('uniutil', 'student_status') > 0:act 'Spend time studying':gt 'komp', 'study'
 		if sucpcinfo = 0 and succubxp > 0: act 'Research the strange feelings you''ve been having': gt 'succubus', 'kompresearch'
 	end
 end

+ 2 - 2
locations/MartinTalk.qsrc

@@ -539,7 +539,7 @@ if $ARGS[0] = '':
 			end
 		end
 		
-		if student > 0: 
+		if func('uniutil', 'student_status') > 0: 
 			act '"I''m a university student"':
 				cla
 				'"I''m going to university," you say, your voice somewhere between pride and shame: Pride over the privilege of receiving a higher education, and shame in the face of thinking of yourself as ''privileged'' while talking to Martin, who you think didn''t have that option... or did he?'
@@ -927,7 +927,7 @@ if $ARGS[0] = 'MartinTalkApartment':
 		'Martin laughs. "Well, you definitely make it sound complicated. Good for you. But," he turns serious once more, "nothing like that is ever truly ''free'', so... be careful."'
 		$OpenInnerThought+'He wouldn''t be Martin if he didn''t tell me to "watch out" at least once a day,'+$CloseInnerThought+' you think and roll your eyes, but still nod yes at him before he has to get back to work.'
 	
-	elseif student > 0:
+	elseif func('uniutil', 'student_status') > 0:
 		'"I have a room in one of the university dormitories, actually. I wouldn''t call it ''living'', though."'
 		*nl
 		'"Oh, so you''re a student, too?"'

+ 2 - 2
locations/city_island.qsrc

@@ -38,7 +38,7 @@ end
 
 !call random events from [street_events], and display them before show location.
 gs'street_event','city_island' & if streetrand = -1:exit
-if student > 0:act '<b>GO HOME</b> (University dorm)':gt 'dorm', 'start'
+if func('uniutil', 'student_status') > 0:act '<b>GO HOME</b> (University dorm)':gt 'dorm', 'start'
 
 if car > 0 and cardrive = 25:'In the parking stands your <a href="exec:GS ''carF'', ''start''"><<$car>></a>.'
 
@@ -67,7 +67,7 @@ if week < 6 and hour >= 7:
 else
 	'The University is closed. It''s open during the week from 07:00.'
 end
-if student > 0 or hour >= 6:'The <a href="exec:gt ''dorm'', ''start''">University dorms</a> offers small, but cheap, living space, for university students.'
+if func('uniutil', 'student_status') > 0 or hour >= 6:'The <a href="exec:gt ''dorm'', ''start''">University dorms</a> offers small, but cheap, living space, for university students.'
 
 
 

+ 3 - 3
locations/city_park.qsrc

@@ -78,11 +78,11 @@ if $ARGS[0] = 'start':
 	end
 
 	if hour >= 20 or hour < 6 :
-		if home_owned[1] = 0 and tanwork = 0 and student = 0:
+		if home_owned[1] = 0 and tanwork = 0 and func('uniutil', 'student_status') <= 0:
 			!nowhere to live in city
-			'It''s quite dark now, and you have no where to stay nearby. Maybe you should try to sleep on a bench?'
+			'It''s quite dark now, and you have nowhere to stay nearby. Maybe you should try to sleep on a bench?'
 		else
-			'It''s quite dark now, and you don''t feel like walking. Maybe you Should try to sleep on a bench?'
+			'It''s quite dark now, and you don''t feel like walking. Maybe you should try to sleep on a bench?'
 		end
 		act 'Sleep on a bench': gt'placer_sex','sleeping_park_bench'
 	end

+ 2 - 2
locations/dorm.qsrc

@@ -18,7 +18,7 @@ if $ARGS[0] = 'start':
 		gt 'city_island'
 	end
 	
-	if student = 0:
+	if func('uniutil', 'student_status') <= 0:
 		menu_off = 1
 		'Since you''re not attending the University, you''re not allowed to enter unless you''re visiting someone you know.'
 		act 'Leave': minut += 5 & gt 'city_island'
@@ -79,7 +79,7 @@ if $ARGS[0] = 'korr':
 		gt 'vann', 'start'
 	end
 
-	if student > 0:
+	if func('uniutil', 'student_status') > 0:
 		if courtletter_date <= daystart and courtletter_date ! 0:
 			gt 'sentence', 'letter'
 		end

+ 1 - 7
locations/korr.qsrc

@@ -166,15 +166,9 @@ if BurgerQW['IvanQW']  = 3 and hour >= 9 and hour <= 20:
 			worksalon =0
 			tanwork =0
 			workSec =0
-			stipuha =0
 			preg = 0
 			young_shop_work = 0
-			student = 0
-			kurs = 0
-			semestr = 0
-			abiturient = 0
-			stipuha = 0
-			lektor = 0
+			gs 'uniutil', 'unenroll'
 			gs 'stat'
 
 			'Time drags on slowly. Your life and work are tedious and monotonous. You''ve been sewing for five years, having meals in the dining room and going to sleep in the barracks surrounded by other female inmates. 1,000 <b>₽</b> of your 2,000 <b>₽</b> per month salary goes towards your debt repayment. As slow as it seems, time does not stand still and your torment finally comes to an end. You are released and given 2,000 <b>₽</b>. You board the train and come back to the city.'

+ 1 - 7
locations/korr2x.qsrc

@@ -135,15 +135,9 @@ if BurgerQW['IvanQW']  = 3 and hour >= 9 and hour <= 20:
 			worksalon = 0
 			tanwork = 0
 			workSec = 0
-			stipuha = 0
 			preg = 0
 			young_shop_work = 0
-			student = 0
-			kurs = 0
-			semestr = 0
-			abiturient = 0
-			stipuha = 0
-			lektor = 0
+			gs 'uniutil', 'unenroll'
 			gs'stat'
 			'Time dragged on for a long time. Your life and work in prison was tedious and monotonous. You sewed quilted jackets, had dinner in the cafeteria and went to sleep in the barracks surrounded by other women inmates. With your salary 2000 <b>₽</b> a month listed 1000 debt repayment. Eventually you payed off your debt and your torment came to an end. With your time served you were released with 2000 <b>₽</b>. You were taken to the train station and given a ticket back to the city.'
 			act 'Exit the train': gt 'city_industrial_train', 'outside'

+ 1 - 1
locations/love.qsrc

@@ -30,7 +30,7 @@ if $ARGS[0] = 'mother':
 	'<<$loverdesc[lover_number]>> pulls out a chair for you and you sit down. His mother places herself in front of the two of you. She looks at you with disgust in her eyes, looking like an overgrown insect, clearly thinking you are not a girl for her son. "So, darling, what do you do for a living?"'
 
 	if (work = 1 or cheatWork = 1) and workKafe = 1:'"I am a waitress in a cafe."'
-	if student > 0 and diplom = 0:'"I study at the university."'
+	if func('uniutil', 'student_status') > 0 and diplom = 0:'"I study at the university."'
 	if diplom = 1:'"I graduated from university."'
 	if work = 0 and cheatWork = 0 and workKafe ! 1:'"I''m unemployed."'
 

+ 1 - 1
locations/nichTanya.qsrc

@@ -1226,7 +1226,7 @@ elseif $ARGS[0] = 'chat':
 							end
 						end
 					end
-					if student > 0:
+					if  func('uniutil', 'student_status') > 0:
 						act 'I know what I am talking about (student)':
 							'"I know what I am talking about. I am a student myself."'
 							'She bites down on her lip and hesitates for a few seconds.'

+ 1 - 1
locations/park_walkevents.qsrc

@@ -474,7 +474,7 @@ if $ARGS[0] = '5':
 
 	act 'Finish your walk':gt 'city_park', 'start'
 
-	if yaq = 0 and student > 0:
+	if yaq = 0 and func('uniutil', 'student_status') > 0:
 		*clr & cla
 		minut += 20
 		gs 'stat'

+ 1 - 1
locations/stat_display.qsrc

@@ -1652,7 +1652,7 @@ if home_owned[1] > 0:
 	$streetev_home = 'your apartment'
 elseif tanwork = 1:
 	$streetev_home = 'Tanya''s apartment'
-elseif student > 0:
+elseif func('uniutil', 'student_status') > 0:
 	$streetev_home = 'your dorm'
 elseif home_owned[2] = 1:
 	$streetev_home = 'outside your apartment block'

+ 4 - 4
locations/street_event.qsrc

@@ -11,7 +11,7 @@
 		shantpopala: 100% if shantpopala>0
 2. home-related events: check if player live here (workDolgDay, vladimirday, pcs_magik >= 1 and mainQW = 0, hour = meethour).
 [street]: home_owned[1] > 0 for korr
-[down]:tanwork = 1 for house, student > 0 for dorm
+[down]:tanwork = 1 for house, func('uniutil', 'student_status') > 0 for dorm
 [city_industrial]:none for now. use (train station) as position, if no home in city.
 Known issue: boyfriend/vladimir may wait you in both place, if you rent house in [street] and study in university/work in Tanya
 
@@ -49,7 +49,7 @@ elseif $ARGS[0] = 'city_industrial':
 	streetev_hijack = 0
 	streetev_bf = 30
 	streetev_mistmeet = 5
-	if home_owned[1] = 0 and tanwork = 0 and student = 0:
+	if home_owned[1] = 0 and tanwork = 0 and func('uniutil', 'student_status') <= 0:
 		streetev_home = 0
 		$streetev_home = 'by the train station'
 	end
@@ -69,7 +69,7 @@ elseif $ARGS[0] = 'pav_commercial':
 	streetev_hijack = 2
 	streetev_bf = 90
 	streetev_mistmeet = 20
-	if home_owned[1] = 0 and tanwork = 0 and student = 0:
+	if home_owned[1] = 0 and tanwork = 0 and func('uniutil', 'student_status') <= 0:
 		streetev_home = 0
 		$streetev_home = 'on the high street'
 	end
@@ -85,7 +85,7 @@ elseif $ARGS[0] = 'city_island':
 	streetev_hijack = 2
 	streetev_bf = 90
 	streetev_mistmeet = 20
-	if student > 0:
+	if func('uniutil', 'student_status') > 0:
 		streetev_home = 1
 		$streetev_home = 'near the entrance to your dorm'
 	end

+ 1 - 1
locations/unicoursework.qsrc

@@ -4,7 +4,7 @@ $unicourseworkloc[0] = $ARGS[1]
 $unicourseworkloc[1] = $ARGS[2]
 
 if $ARGS[0] = 'start':
-	if student > 0 and kursovik < 100:
+	if func('uniutil', 'student_status') > 0 and kursovik < 100:
 		if $unicourseworkloc[0] = 'komp':
 			'You should probably do some of your <a href="exec:gt ''unicoursework'',$unicourseworkloc[0],$unicourseworkloc[1],1">coursework</a>.'
 		else:

+ 46 - 0
locations/uniutil.qsrc

@@ -0,0 +1,46 @@
+# uniutil
+
+if $ARGS[0] = 'student_status':
+	RESULT = student
+end
+
+if $ARGS[0] = 'enroll_prepclass':
+	abiturient = 1
+end
+
+if $ARGS[0] = 'unenroll_prepclass':
+	killvar 'abiturient'
+
+if $ARGS[0] = 'enroll_university':
+	gs 'uniutil', 'unenroll_prepclass'
+	student = 1
+	kurs = 1
+	semestr = 1
+end
+
+if $ARGS[0] = 'unenroll_university':
+	if student > 0:
+		killvar 'student'
+		killvar 'kurs'
+		killvar 'semestr'
+		killvar 'stipuha'
+		killvar 'lektor'
+	end
+end
+
+if $ARGS[0] = 'unenroll':
+	gs 'uniutil', 'unenroll_prepclass'
+	gs 'uniutil', 'unenroll_university'
+end
+
+if $ARGS[0] = 'expel':
+	gs 'uniutil', 'unenroll'
+	student = -1
+end
+
+if $ARGS[0] = 'graduate':
+	gs 'uniutil', 'unenroll'
+	diplom = 1
+end
+
+--- uniutil ---------------------------------

+ 13 - 25
locations/univer.qsrc

@@ -12,14 +12,14 @@ if $ARGS[0] = 'start':
 	'<center><b><font color="maroon">The University</font></b></center>'
 	'<center><img <<$set_imgh>> src="images/locations/city/island/university/univer.jpg"></center>'
 
-	if student = 0 and abiturient = 0:'You can take preparatory classes at the University for 15,000 <b>₽</b>.'
+	if func('uniutil', 'student_status') = 0 and abiturient = 0:'You can take preparatory classes at the University for 15,000 <b>₽</b>.'
 
 	'Admission examinations for the University are held in <b>August</b>.'
 	'The lectures begin at <b>08:00</b>. You won''t be allowed to attend if late.'
 	'First semester: September, October, November.'
 	'Second semester: February, March, April.'
 
-	if student > 0:'You have completed <<kurs>> assignments for <<semestr>>.'
+	if func('uniutil', 'student_status') > 0:'You have completed <<kurs>> assignments for <<semestr>>.'
 
 	if abiturient = 1:'You''ve enrolled in the preparatory classes.'
 
@@ -29,7 +29,7 @@ if $ARGS[0] = 'start':
 		gt 'city_island'
 	end
 
-	if student = 0 and abiturient = 0 and money >= 15000 and month < 9 and diplom = 0 and (age >= 17 or fakepassport = 1):
+	if func('uniutil', 'student_status') = 0 and abiturient = 0 and money >= 15000 and month < 9 and diplom = 0 and (age >= 17 or fakepassport = 1):
 		''
 
 		act 'Pay for the preparatory classes (15,000 <b>₽</b>)':
@@ -56,7 +56,7 @@ if $ARGS[0] = 'start':
 		end
 	end
 
-	if month = 8 and student = 0 and diplom = 0 and (age >= 17 or fakepassport = 1):
+	if month = 8 and func('uniutil', 'student_status') = 0 and diplom = 0 and (age >= 17 or fakepassport = 1):
 		'You can try to take an entrance exam.'
 
 		act 'Take the entrance exam (1:00)':
@@ -66,10 +66,7 @@ if $ARGS[0] = 'start':
 			'<center><img <<$set_imgh>> src="images/locations/city/island/university/classroom.jpg"></center>'
 
 			if pcs_intel + abiturient >= 60:
-				student = 1
-				kurs = 1
-				semestr = 1
-				abiturient = 0
+				gs 'uniutil', 'enroll_university'
 				'You have successfully passed the entrance exam and can attend the University in September.'
 			else
 				'You have failed the entrance exam. You need to study harder...'
@@ -79,7 +76,7 @@ if $ARGS[0] = 'start':
 		end
 	end
 
-	if week < 6 and student > 0 and month > 8 and month < 12:
+	if week < 6 and func('uniutil', 'student_status') > 0 and month > 8 and month < 12:
 		!! 1st semester
 		act 'Visit the Dean':
 			cla
@@ -88,7 +85,7 @@ if $ARGS[0] = 'start':
 
 			gt 'univer', 'dekanat'
 		end
-	elseif week < 6 and student > 0 and month > 1 and month < 5:
+	elseif week < 6 and func('uniutil', 'student_status') > 0 and month > 1 and month < 5:
 		!! 2nd semester
 		act 'Visit the Dean':
 			cla
@@ -97,10 +94,10 @@ if $ARGS[0] = 'start':
 
 			gt 'univer', 'dekanat'
 		end
-	elseif week < 6 and student > 0 and month = 12 and examen = 0 and semestr = 1:
+	elseif week < 6 and func('uniutil', 'student_status') > 0 and month = 12 and examen = 0 and semestr = 1:
 		!! 1st semester exams
 		act 'Do the exam':gt 'univer', 'examen'
-	elseif week < 6 and student > 0 and month = 5 and examen = 0 and semestr = 2:
+	elseif week < 6 and func('uniutil', 'student_status') > 0 and month = 5 and examen = 0 and semestr = 2:
 		!! 2nd semester exams
 		act 'Do the exam':gt 'univer', 'examen'
 	end
@@ -121,23 +118,14 @@ if $ARGS[0] = 'dekanat':
 			semestr = 2
 		end
 	elseif examen = 2:
-		student = 0
-		kurs = 0
-		semestr = 0
-		abiturient = 0
-		stipuha = 0
-		lektor = 0
+		gs 'uniutil', 'expel'
 
 		'You got expelled from the University.'
 	end
 
 	if kurs = 2:
-		diplom = 1
-		student = 0
-		kurs = 0
-		semestr = 0
-		abiturient = 0
-		stipuha = 0
+		gs 'uniutil', 'graduate'
+
 		'Congratulations, you''ve earned your degree!'
 	end
 
@@ -151,7 +139,7 @@ if $ARGS[0] = 'dekanat':
 
 	act 'Leave the Dean''s office':gt 'univer', 'start'
 
-	if hour < 8 and student > 0:
+	if hour < 8 and func('uniutil', 'student_status') > 0:
 		act 'Attend the lecture (6:00)':
 			cla 
 			*clr