share/hedgewars/Data/Maps/Basketball/map.lua
changeset 4502 759c1a3bb156
parent 4493 45db8e97d282
child 4506 37744d5c877e
--- a/share/hedgewars/Data/Maps/Basketball/map.lua	Fri Dec 10 22:39:20 2010 +0100
+++ b/share/hedgewars/Data/Maps/Basketball/map.lua	Fri Dec 10 23:58:15 2010 +0100
@@ -1,100 +1,6 @@
--- Hedgewars - Basketball for 2+ Players
-
-local caption = {
-	["en"] = "Hedgewars-Basketball",
-	["de"] = "Hedgewars-Basketball",
-	["es"] = "Hedgewars-Baloncesto",
-	["pl"] = "Hedgewars-Koszykówka",
-	["pt_PT"] = "Hedgewars-Basketball",
-	["sk"] = "Hedgewars-Basketbal",
-	["sv"] = "Hedgewars-Basket",
-	["pt_BR"] = "Hedgewars-Basketball"
-	}
-
-local subcaption = {
-	["en"] = "Not So Friendly Match",
-	["de"] = "Kein-so-Freundschaftsspiel",
-	["es"] = "Partido no-tan-amistoso",
-	["pl"] = "Mecz Nie-Do-Końca Towarzyski",
-	["pt_PT"] = "Partida não muito amigável",
-	["sk"] = "Nie tak celkom priateľský zápas",
-	["sv"] = "En inte så vänlig match",
-	["pt_BR"] = "Partida não muito amigável"
-	}
-
-local goal = {
-	["en"] = "Bat your opponents through the|baskets and out of the map!",
-	["de"] = "Schlage deine Widersacher durch|die Körbe und aus der Karte hinaus!",
-	["es"] = "¡Batea a tus oponentes fuera del mapa a través de la canasta!",
-	["pl"] = "Uderzaj swoich przekiwników|wyrzucając przez kosz, poza mapę!",
-	["pt_PT"] = "Bate os teus adversarios|fora do mapa acertando com eles no cesto!",
-	["sk"] = "Odpálkujte vašich súperov do koša|a von z mapy!",
-	["sv"] = "Slå ner dina motståndare i|korgarna och ut ur kartan!",
-	["pt_BR"] = "Rebata seus oponentes para|fora do mapa através dos cestos!"
-	}
-
-local scored = {
-	["en"] = " scored a point!",
-	["de"] = " erhält einen Punkt!",
-	["es"] = " anotó un tanto!",
-	["pl"] = " zdobyła punkt!",
-	["pt_PT"] = " marca um cesto!",
-	["sk"] = " skóruje!",
-	["sv"] = " fick ett poäng",
-	["pt_BR"] = " fez uma cesta"
-	}
+loadfile(GetDataPath() .. "Scripts/Locale.lua")()
 
-local failed = {
-	["en"] = " scored a penalty!",
-	["de"] = " erhält eine Strafe!",
-	["es"] = " anotó una falta!",
-	["pl"] = " zdobyła punkt karny!",
-	["pt_PT"] = " perde um ponto!",
-	["sk"] = " dostáva trestný bod!",
-	["sv"] = " fick ett straff",
-	["pt_BR"] = " sofre uma penalidade"
-	}
-
-	local sscore = {
-	["en"] = "Score",
-	["de"] = "Punktestand",
-	["es"] = "Puntuación",
-	["pl"] = "Punktacja",
-	["pt_PT"] = "Pontuação",
-	["sk"] = "Skóre",
-	["sv"] = "Poängställning",
-	["pt_BR"] = "Pontuação"
-	}
-
-local team = {
-	["en"] = "Team",
-	["es"] = "Equipo",
-	["pl"] = "Drużyna",
-	["pt_PT"] = "Equipa",
-	["sk"] = "Tím",
-	["sv"] = "Lag",
-	["pt_BR"] = "Equipe"
-	}
-
-local drowning = {
-	["en"] = "is out and",
-	["de"] = "ist draußen und",
-	["es"] = "cayó y",
-	["pl"] = "jest wyautowany i",
-	["pt_PT"] = "está fora e",
-	["sk"] = "je mimo hru a",
-	["sv"] = "är ute och",
-	["pt_BR"] = "está fora e"
-	}
-
-local function loc(text)
-	if text == nil then return "**missing**"
-	elseif text[L] == nil then return text["en"]
-	else return text[L]
-	end
-end
-
----------------------------------------------------------------
+-- Hedgewars - Basketball for 2+ Players
 
 local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
 
@@ -111,7 +17,7 @@
 end
 
 function onGameStart()
-	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0)
+	ShowMission(loc("Hedgewars-Basketball"), loc("Not So Friendly Match"), loc("Bat your opponents through the|baskets and out of the map!"), -amBaseballBat, 0)
 	started = true
 end
 
@@ -132,16 +38,18 @@
 	end
 	if (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
 		local clan = GetHogClan(CurrentHedgehog)
-		local s = GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " "
-		if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
-			score[clan] = score[clan] + 1
-			s = s .. loc(scored)
-		else
-			score[clan] = score[clan] - 1
-			s = s .. loc(failed)
+		local s
+		if clan ~= nil then
+			if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
+				score[clan] = score[clan] + 1
+				s = string.format(loc("%s is out and Team %d|scored a point!| |Score:"), GetHogName(gear), clan + 1)
+			else
+				score[clan] = score[clan] - 1
+				s = string.format(loc("%s is out and Team %d|scored a penalty!| |Score:"), GetHogName(gear), clan + 1)
+			end
+			s = s .. " " .. score[0]
+			for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
+			ShowMission(loc("Hedgewars-Basketball"), loc("Not So Friendly Match"), s, -amBaseballBat, 0)
 		end
-		s = s .. "| |" .. loc(sscore) .. ": " .. score[0]
-		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
-		ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
 	end
 end