This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/tech/library/checkDependencies.inc

27 lines
524 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_tech_checkDependencies {
function beta5_tech_checkDependencies($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Checks whether a player has already researched a technology's dependencies
function run($pid, $rid) {
$q = $this->db->query("SELECT depends_on FROM research_dep WHERE research=$rid");
if (!dbCount($q)) {
return true;
}
$rv = true;
while ($rv && $r = dbFetchArray($q)) {
$rv = $rv && $this->lib->call('has', $pid, $r[0]);
}
return $rv;
}
}
?>