fix duplicates when found new village + show returning scouts on rally point

This commit is contained in:
unknown
2012-06-17 11:18:28 +03:00
parent 7cbfd7acc9
commit 1232c8c87e
7 changed files with 103 additions and 13 deletions
+4 -3
View File
@@ -13,13 +13,14 @@
</div>
<?php
$units_type = $database->getMovement("34",$village->wid,1);
$settlers = $database->getMovement("7",$village->wid,1);
$units_incoming = count($units_type);
$settlers_incoming = count($settlers);
for($i=0;$i<$units_incoming;$i++){
if($units_type[$i]['attack_type'] == 1)
if($units_type[$i]['attack_type'] == 1 && $units_type[$i]['sort_type'] == 3)
$units_incoming -= 1;
}
if($units_incoming >= 1){
if($units_incoming > 0 or $settlers_incoming > 0){
?>
<h4>Incoming troops (<?php echo $units_incoming; ?>)</h4>
<?php include("16_incomming.tpl");
+61 -2
View File
@@ -276,7 +276,66 @@ if($units[$y]['from'] != 0){
<?php
}
}
}
?>
$settlers = $database->getMovement("7",$village->wid,1);
$total_for3 = count($settlers);
for($x=0;$x < $total_for3;$x++){
$timer = $x+1;
$to = $database->getMInfo($settlers[$x]['to']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $to['wref']."&c=".$generator->getMapCheck($to['wref']); ?>"><?php echo "Returning to ".$to['name']; ?></a></td>
</tr>
</thead>
<tbody class="units">
<?php
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
?>
</tr>
<tr><th>Troops</th>
<?php
for($z=1;$z<=9;$z++) {
$settlers[$x]['t'.$z]=0;
}
$settlers[$x]['t10']=3;
for($i=1;$i<11;$i++) {
if($settlers[$x]['t'.$i] == 0) {
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
echo $settlers[$x]['t'.$i]."</td>";
}
}
?>
</tr>
<tbody class="infos">
<tr>
<th>Arrival</th>
<td colspan="10">
<?php
echo "<div class=\"in small\"><span id=timer".$timer.">".$generator->getTimeFormat($settlers[$x]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$x]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "on ".$datetime[0]." ";
}
echo "at ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</table>
<?php } ?>
+6 -3
View File
@@ -97,7 +97,7 @@ $timer += 1;
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>">Found new village.</a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>">Found new village</a></td>
</tr>
</thead>
<tbody class="units">
@@ -113,15 +113,18 @@ $timer += 1;
</tr>
<tr><th>Troops</th>
<?php
for($x=1;$x<=9;$x++) {
$units[$y]['t'.$x]=0;
}
$units[$y]['t10']=3;
for($i=1;$i<=10;$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">";
echo "<td class=\"none\">0</td>";
}
else {
echo "<td>";
}
echo $units[$y]['t'.$i]."</td>";
}
}
?>
</tr></tbody>