From f456516f360fdc1d793239ba2c7f04acaf662e6c Mon Sep 17 00:00:00 2001 From: avolkov Date: Fri, 13 Jan 2006 22:23:43 +0000 Subject: [PATCH] Removed some ugly, unnecessary goto's git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2179 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/comm/arilou/arilouc.c | 6 ++---- sc2/src/sc2code/comm/blackur/blackurc.c | 6 ++---- sc2/src/sc2code/comm/druuge/druugec.c | 4 +--- sc2/src/sc2code/comm/orz/orzc.c | 11 +++-------- sc2/src/sc2code/comm/pkunk/pkunkc.c | 4 +--- sc2/src/sc2code/comm/shofixt/shofixt.c | 4 +--- sc2/src/sc2code/comm/slyhome/slyhome.c | 8 ++------ sc2/src/sc2code/comm/spahome/spahome.c | 4 +--- sc2/src/sc2code/comm/supox/supoxc.c | 8 ++------ sc2/src/sc2code/comm/syreen/syreenc.c | 8 ++------ sc2/src/sc2code/comm/talkpet/talkpet.c | 8 ++------ sc2/src/sc2code/comm/thradd/thraddc.c | 4 +--- sc2/src/sc2code/comm/umgah/umgahc.c | 6 ++---- sc2/src/sc2code/comm/urquan/urquanc.c | 6 ++---- sc2/src/sc2code/comm/utwig/utwigc.c | 14 ++++---------- sc2/src/sc2code/comm/vux/vuxc.c | 4 +--- sc2/src/sc2code/comm/yehat/yehatc.c | 8 ++------ sc2/src/sc2code/comm/zoqfot/zoqfotc.c | 4 +--- 18 files changed, 32 insertions(+), 85 deletions(-) diff --git a/sc2/src/sc2code/comm/arilou/arilouc.c b/sc2/src/sc2code/comm/arilou/arilouc.c index baa406a87..65d0b7ca2 100644 --- a/sc2/src/sc2code/comm/arilou/arilouc.c +++ b/sc2/src/sc2code/comm/arilou/arilouc.c @@ -639,7 +639,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } else if (!GET_GAME_STATE (MET_ARILOU)) { @@ -660,7 +660,7 @@ Intro (void) Response (happy_by_hello, RespFunc); Response (miffed_by_hello, RespFunc); SET_GAME_STATE (MET_ARILOU, 1); - goto ExitIntro; + return; } Manner = GET_GAME_STATE (ARILOU_MANNER); @@ -782,8 +782,6 @@ Intro (void) ArilouHome ((RESPONSE_REF)0); } } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/blackur/blackurc.c b/sc2/src/sc2code/comm/blackur/blackurc.c index 05439d3f0..aa812e5b2 100644 --- a/sc2/src/sc2code/comm/blackur/blackurc.c +++ b/sc2/src/sc2code/comm/blackur/blackurc.c @@ -442,7 +442,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (KOHR_AH_KILLED_ALL)) @@ -450,7 +450,7 @@ Intro (void) NPCPhrase (GAME_OVER_DUDE); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (!GET_GAME_STATE (KOHR_AH_SENSES_EVIL) @@ -524,8 +524,6 @@ Intro (void) } SET_GAME_STATE (KOHR_AH_VISITS, NumVisits); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/druuge/druugec.c b/sc2/src/sc2code/comm/druuge/druugec.c index a58dafdd1..e387fea04 100644 --- a/sc2/src/sc2code/comm/druuge/druugec.c +++ b/sc2/src/sc2code/comm/druuge/druugec.c @@ -689,7 +689,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (DRUUGE_MANNER)) @@ -873,8 +873,6 @@ Intro (void) Space ((RESPONSE_REF)0); } } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/orz/orzc.c b/sc2/src/sc2code/comm/orz/orzc.c index bd4df7ea3..440389341 100644 --- a/sc2/src/sc2code/comm/orz/orzc.c +++ b/sc2/src/sc2code/comm/orz/orzc.c @@ -505,21 +505,18 @@ OrzNeutral (RESPONSE_REF R) else if (PLAYER_SAID (R, where_androsyn)) { WhereAndrosyn (R); - - goto ExitNeutral; + return; } else if (PLAYER_SAID (R, talk_about_alliance) || PLAYER_SAID (R, seem_like_nice_guys)) { OfferAlliance (R); - - goto ExitNeutral; + return; } else if (PLAYER_SAID (R, hostile_2)) { ExitConversation (R); - - goto ExitNeutral; + return; } if (GET_GAME_STATE (ORZ_ANDRO_STATE) == 0) @@ -569,8 +566,6 @@ OrzNeutral (RESPONSE_REF R) } } Response (bye_neutral, ExitConversation); -ExitNeutral: - ; } static void diff --git a/sc2/src/sc2code/comm/pkunk/pkunkc.c b/sc2/src/sc2code/comm/pkunk/pkunkc.c index ba8b72b1a..abe214f7e 100644 --- a/sc2/src/sc2code/comm/pkunk/pkunkc.c +++ b/sc2/src/sc2code/comm/pkunk/pkunkc.c @@ -849,7 +849,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } Manner = GET_GAME_STATE (PKUNK_MANNER); @@ -1085,8 +1085,6 @@ Intro (void) PkunkMigrate ((RESPONSE_REF)0); } -ExitIntro: - ; } // Called after combat or communications diff --git a/sc2/src/sc2code/comm/shofixt/shofixt.c b/sc2/src/sc2code/comm/shofixt/shofixt.c index b581aee50..3f8bdb6a2 100644 --- a/sc2/src/sc2code/comm/shofixt/shofixt.c +++ b/sc2/src/sc2code/comm/shofixt/shofixt.c @@ -546,7 +546,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } GetShofixtiName (); @@ -616,8 +616,6 @@ Intro (void) Hostile ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/slyhome/slyhome.c b/sc2/src/sc2code/comm/slyhome/slyhome.c index b64750de3..299204457 100644 --- a/sc2/src/sc2code/comm/slyhome/slyhome.c +++ b/sc2/src/sc2code/comm/slyhome/slyhome.c @@ -548,7 +548,7 @@ ProbeInfo (RESPONSE_REF R) else if (PLAYER_SAID (R, talk_more_probe_attack)) { ProbeFunction (R); - goto ExitProbeInfo; + return; } else if (PLAYER_SAID (R, where_probes_from)) { @@ -641,8 +641,6 @@ ProbeInfo (RESPONSE_REF R) { DISABLE_PHRASE (know_more_probe); } -ExitProbeInfo: - ; } static void @@ -728,7 +726,7 @@ HomeWorld (RESPONSE_REF R) else if (PLAYER_SAID (R, like_more_about_you)) { SlylandroInfo (R); - goto ExitHomeWorld; + return; } else if (PLAYER_SAID (R, enough_about_me)) NPCPhrase (OK_ENOUGH_YOU); @@ -845,8 +843,6 @@ HomeWorld (RESPONSE_REF R) } } Response (bye, ExitConversation); -ExitHomeWorld: - ; } static void diff --git a/sc2/src/sc2code/comm/spahome/spahome.c b/sc2/src/sc2code/comm/spahome/spahome.c index a1df5370f..89d884fde 100644 --- a/sc2/src/sc2code/comm/spahome/spahome.c +++ b/sc2/src/sc2code/comm/spahome/spahome.c @@ -727,7 +727,7 @@ SpathiParty (RESPONSE_REF R) Response (fellowship, SpathiParty); Response (do_as_we_say, ExitConversation); - goto ExitParty; + return; } switch (GET_GAME_STATE (SPATHI_HOME_VISITS) - 1) { @@ -741,8 +741,6 @@ SpathiParty (RESPONSE_REF R) Response (bye_from_party_3, ExitConversation); break; } -ExitParty: - ; } static void diff --git a/sc2/src/sc2code/comm/supox/supoxc.c b/sc2/src/sc2code/comm/supox/supoxc.c index 434703a75..577957f04 100644 --- a/sc2/src/sc2code/comm/supox/supoxc.c +++ b/sc2/src/sc2code/comm/supox/supoxc.c @@ -377,7 +377,7 @@ NeutralSupox (RESPONSE_REF R) Response (what_do_i_do_now, ExitConversation); Response (thanks_now_we_eat_you, ExitConversation); - goto ExitSupox; + return; } else if (PLAYER_SAID (R, got_fixed_ultron)) { @@ -515,8 +515,6 @@ NeutralSupox (RESPONSE_REF R) } } Response (bye_neutral, ExitConversation); -ExitSupox: - ; } static void @@ -529,7 +527,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (SUPOX_HOSTILE)) @@ -663,8 +661,6 @@ Intro (void) NeutralSupox ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/syreen/syreenc.c b/sc2/src/sc2code/comm/syreen/syreenc.c index 708d6aaa0..f0d543676 100644 --- a/sc2/src/sc2code/comm/syreen/syreenc.c +++ b/sc2/src/sc2code/comm/syreen/syreenc.c @@ -555,7 +555,7 @@ NormalSyreen (RESPONSE_REF R) SET_GAME_STATE (SYREEN_KNOW_ABOUT_MYCON, 1); SyreenShuttle ((RESPONSE_REF)0); - goto ExitSyreen; + return; } if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 3) @@ -629,8 +629,6 @@ NormalSyreen (RESPONSE_REF R) Response (pStr[i], NormalSyreen); } Response (bye, FriendlyExit); -ExitSyreen: - ; } static void @@ -724,7 +722,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } NumVisits = GET_GAME_STATE (SYREEN_HOME_VISITS); @@ -832,8 +830,6 @@ Intro (void) SyreenVault ((RESPONSE_REF)0); } SET_GAME_STATE (SYREEN_HOME_VISITS, NumVisits); -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/talkpet/talkpet.c b/sc2/src/sc2code/comm/talkpet/talkpet.c index 0b8ac324f..ccabf5801 100644 --- a/sc2/src/sc2code/comm/talkpet/talkpet.c +++ b/sc2/src/sc2code/comm/talkpet/talkpet.c @@ -497,7 +497,7 @@ CompelPlayer (RESPONSE_REF R) SET_GAME_STATE (BATTLE_SEGUE, 1); } - goto ExitCompel; + return; } if (PHRASE_ENABLED (what_are_you)) @@ -543,8 +543,6 @@ CompelPlayer (RESPONSE_REF R) } } Response (bye_at_umgah, CompelPlayer); -ExitCompel: - ; } static void PetDeal (RESPONSE_REF R); @@ -649,7 +647,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) @@ -778,8 +776,6 @@ Intro (void) PetDeal ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/thradd/thraddc.c b/sc2/src/sc2code/comm/thradd/thraddc.c index 6c1711410..f8a6ec632 100644 --- a/sc2/src/sc2code/comm/thradd/thraddc.c +++ b/sc2/src/sc2code/comm/thradd/thraddc.c @@ -693,7 +693,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (AQUA_HELIX)) @@ -904,8 +904,6 @@ Intro (void) ThraddHostile ((RESPONSE_REF)0); } } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/umgah/umgahc.c b/sc2/src/sc2code/comm/umgah/umgahc.c index 4b56d634c..9ae75a81c 100644 --- a/sc2/src/sc2code/comm/umgah/umgahc.c +++ b/sc2/src/sc2code/comm/umgah/umgahc.c @@ -341,7 +341,7 @@ Zombies (RESPONSE_REF R) NPCPhrase (NOT_GIVE_UP); SET_GAME_STATE (BATTLE_SEGUE, 1); - goto ExitZombies; + return; } else if (PLAYER_SAID (R, arilou_told_us)) { @@ -350,7 +350,7 @@ Zombies (RESPONSE_REF R) SET_GAME_STATE (BATTLE_SEGUE, 1); SET_GAME_STATE (KNOW_UMGAH_ZOMBIES, 1); SET_GAME_STATE (UMGAH_VISITS, 0); - goto ExitZombies; + return; } if (PHRASE_ENABLED (evil_blobbies)) @@ -402,8 +402,6 @@ Zombies (RESPONSE_REF R) } } Response (bye_zombie, CombatIsInevitable); -ExitZombies: - ; } } diff --git a/sc2/src/sc2code/comm/urquan/urquanc.c b/sc2/src/sc2code/comm/urquan/urquanc.c index a4efc0d3a..076e6bb41 100644 --- a/sc2/src/sc2code/comm/urquan/urquanc.c +++ b/sc2/src/sc2code/comm/urquan/urquanc.c @@ -410,7 +410,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } b0 = GET_GAME_STATE (URQUAN_PROBE_GRPOFFS0); @@ -454,7 +454,7 @@ Intro (void) NPCPhrase (CAUGHT_YA); SET_GAME_STATE (BATTLE_SEGUE, 1); - goto ExitIntro; + return; } b0 = GET_GAME_STATE (SAMATRA_GRPOFFS0); @@ -517,8 +517,6 @@ Intro (void) SET_GAME_STATE (URQUAN_VISITS, NumVisits); } } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/utwig/utwigc.c b/sc2/src/sc2code/comm/utwig/utwigc.c index 86d07b040..d2cc7c740 100644 --- a/sc2/src/sc2code/comm/utwig/utwigc.c +++ b/sc2/src/sc2code/comm/utwig/utwigc.c @@ -498,14 +498,14 @@ NeutralUtwig (RESPONSE_REF R) SET_GAME_STATE (UTWIG_HOME_VISITS, 0); SET_GAME_STATE (UTWIG_VISITS, 0); SET_GAME_STATE (BOMB_VISITS, 0); - goto ExitUtwig; + return; } else if (PLAYER_SAID (R, real_sorry_about_ultron)) { NPCPhrase (APPRECIATE_SYMPATHY); SET_GAME_STATE (UTWIG_STACK1, 4); - goto ExitUtwig; + return; } else if (PLAYER_SAID (R, what_about_you_1)) { @@ -613,8 +613,6 @@ NeutralUtwig (RESPONSE_REF R) if (GET_GAME_STATE (ULTRON_CONDITION)) Response (got_ultron, ExitConversation); Response (bye_neutral, ExitConversation); -ExitUtwig: - ; } static void @@ -653,7 +651,7 @@ BombWorld (RESPONSE_REF R) SET_GAME_STATE (UTWIG_HOME_VISITS, 0); SET_GAME_STATE (UTWIG_VISITS, 0); SET_GAME_STATE (BOMB_VISITS, 0); - goto ExitBomb; + return; } else if (PLAYER_SAID (R, may_we_have_bomb)) { @@ -720,8 +718,6 @@ BombWorld (RESPONSE_REF R) && !GET_GAME_STATE (REFUSED_ULTRON_AT_BOMB)) Response (got_ultron, ExitConversation); Response (bye_bomb, ExitConversation); -ExitBomb: - ; } static void @@ -734,7 +730,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (UTWIG_HOSTILE)) @@ -932,8 +928,6 @@ Intro (void) NeutralUtwig ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/vux/vuxc.c b/sc2/src/sc2code/comm/vux/vuxc.c index 1bbd0dcaa..84f9fd8ae 100644 --- a/sc2/src/sc2code/comm/vux/vuxc.c +++ b/sc2/src/sc2code/comm/vux/vuxc.c @@ -691,7 +691,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6)) @@ -747,8 +747,6 @@ Intro (void) NormalVux ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/yehat/yehatc.c b/sc2/src/sc2code/comm/yehat/yehatc.c index a670e336a..6f9d44958 100644 --- a/sc2/src/sc2code/comm/yehat/yehatc.c +++ b/sc2/src/sc2code/comm/yehat/yehatc.c @@ -437,7 +437,7 @@ YehatSpace (RESPONSE_REF R) SET_GAME_STATE (BATTLE_SEGUE, 0); SET_GAME_STATE (NO_YEHAT_ALLY_SPACE, 2); - goto ExitYehat; + return; } else if (PLAYER_SAID (R, at_least_help_us_space)) { @@ -550,8 +550,6 @@ YehatSpace (RESPONSE_REF R) } } Response (bye_space, ExitConversation); -ExitYehat: - ; } static void @@ -564,7 +562,7 @@ Intro (void) NPCPhrase (OUT_TAKES); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (YEHAT_CIVIL_WAR)) @@ -642,8 +640,6 @@ Intro (void) YehatSpace ((RESPONSE_REF)0); } -ExitIntro: - ; } static COUNT diff --git a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c index 81f2dc224..600d67401 100644 --- a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c +++ b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c @@ -763,7 +763,7 @@ Intro (void) NPCPhrase_cb (OUT_TAKES13, &SelectAlienPIK); ZFPTalkSegue ((COUNT)~0); SET_GAME_STATE (BATTLE_SEGUE, 0); - goto ExitIntro; + return; } if (GET_GAME_STATE (ZOQFOT_HOSTILE)) @@ -918,8 +918,6 @@ Intro (void) ZoqFotHome (0); } -ExitIntro: - ; } static COUNT