From c552a58b63d3b1447e805d8eaff0dc77879ff82e Mon Sep 17 00:00:00 2001 From: shamoanjac Date: Thu, 18 Aug 2016 15:26:19 +0200 Subject: [PATCH] Maximum length to faction names --- factions.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/factions.lua b/factions.lua index d46e225..33efe22 100644 --- a/factions.lua +++ b/factions.lua @@ -33,12 +33,15 @@ factions.power_per_death = .25 factions.power_per_tick = .125 factions.tick_time = 60. factions.power_per_attack = 2. +factions.faction_name_max_length = 50 --------------------- --! @brief returns whether a faction can be created or not (allows for implementation of blacklists and the like) --! @param name String containing the faction's name factions.can_create_faction = function(name) - if factions.factions[name] then + if #name > factions.faction_name_max_length then + return false + elseif factions.factions[name] then return false else return true @@ -627,6 +630,9 @@ function factions.load() if not faction.usedpower then faction.usedpower = faction:count_land() * factions.power_per_parcel end + if #faction.name > factions.faction_name_max_length then + faction:disband() + end end file:close() end