cutStringForWidth, subStringForWidth 재 구현

This commit is contained in:
2018-04-07 16:57:21 +09:00
parent f5494a69a2
commit 85e6faf92c
6 changed files with 69 additions and 165 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ for($j=0; $j < $gencount; $j++) {
$turn = getTurn($general, 1, 0);
for($i=0; $i < 5; $i++) {
$turn[$i] = StringUtil::SubStrForWidth($turn[$i], 0, 20);
$turn[$i] = StringUtil::subStringForWidth($turn[$i], 0, 20);
$k = $i+1;
echo "
&nbsp;$k : $turn[$i] <br>";
+3 -3
View File
@@ -33,7 +33,7 @@ if($command == 46) {
$name = str_replace(" ", "", $name);
$name = str_replace(" ", "", $name);
if($name == "") { $name = "무명"; }
$name = StringUtil::SubStrForWidth($name, 0, 12);
$name = StringUtil::subStringForWidth($name, 0, 12);
$db->update('general', [
'makenation'=>$name
@@ -58,7 +58,7 @@ if($command == 46) {
$nationname = str_replace(" ", "", $nationname);
$nationname = str_replace(" ", "", $nationname);
if($nationname == "") { $nationname = "무명"; }
$nationname = StringUtil::SubStrForWidth($nationname, 0, 12);
$nationname = StringUtil::subStringForWidth($nationname, 0, 12);
$query = "update general set makenation='{$nationname}' where level>=5 and nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -84,7 +84,7 @@ if($command == 46) {
$note = str_replace("|", "", $note);
$note = str_replace(" ", "", $note);
$note = str_replace(" ", "", $note);
$note = StringUtil::SubStrForWidth($note, 0, 90);
$note = StringUtil::subStringForWidth($note, 0, 90);
$query = "update diplomacy set reserved='{$note}' where me='{$me['nation']}' and you='$double'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+1 -1
View File
@@ -423,7 +423,7 @@ function processAI($no) {
$colors = GetNationColors();
$color = rand() % count($colors);
$command = EncodeCommand(0, $type, $color, 46);
$nationName = "".StringUtil::SubStr($general['name'], 1);
$nationName = "".mb_substr($general['name'], 1);
//건국
$query = "update general set turn0='$command',makenation='$nationName' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error("processAI08 ".MYDB_error($connect),"");
+1 -1
View File
@@ -787,7 +787,7 @@ function process_55(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nationcount = MYDB_num_rows($result);
if($nationcount > 0) { $makename = StringUtil::SubStr("$nationcount".$general['name'], 0, 6); }
if($nationcount > 0) { $makename = mb_substr("$nationcount".$general['name'], 0, 6); }
else { $makename = $general['name']; }
if($general['level'] != 0) {
+3 -3
View File
@@ -400,7 +400,7 @@ function processWar($general, $city) {
}
$render_attacker = [
'crewtype' => StringUtil::SubStr(GameUnitConst::byId($general['crewtype'])->name, 0, 2),
'crewtype' => mb_substr(GameUnitConst::byId($general['crewtype'])->name, 0, 2),
'name'=> $general['name'],
'remain_crew' => $general['crew'],
'killed_crew' => -$mydeathnum
@@ -1276,13 +1276,13 @@ function processWar($general, $city) {
}
$render_attacker = [
'crewtype' => StringUtil::SubStr(GameUnitConst::byId($general['crewtype'])->name, 0, 2),
'crewtype' => mb_substr(GameUnitConst::byId($general['crewtype'])->name, 0, 2),
'name'=> $general['name'],
'remain_crew' => $general['crew'],
'killed_crew' => -$mydeathnum
];
$render_defender = [
'crewtype' => StringUtil::SubStr(GameUnitConst::byId($oppose['crewtype'])->name, 0, 2),
'crewtype' => mb_substr(GameUnitConst::byId($oppose['crewtype'])->name, 0, 2),
'name'=> $oppose['name'],
'remain_crew' => $oppose['crew'],
'killed_crew' => -$opdeathnum