Skip to content

Commit

Permalink
Tweaks and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
goosehub committed May 20, 2020
1 parent 077a330 commit 3a81d46
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
|
*/

$default_domain = 'localhost/landgrab.xyz';
$default_domain = 'landgrab.xyz/alpha';

$allowed_domains = array(
'localhost/landgrab',
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Game.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function update_world($world_key)

$data['account'] = $this->user_model->this_account($data['world']['id']);

$server_map_update_interval_s = (MAP_UPDATE_INTERVAL_MS / 1000) * 2;
$server_map_update_interval_s = (MAP_UPDATE_INTERVAL_MS / 1000) * 3;
$data['tiles'] = $this->game_model->get_all_tiles_in_world_recently_updated($data['world']['id'], $server_map_update_interval_s);
api_response($data);
}
Expand Down
4 changes: 2 additions & 2 deletions application/models/Game_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ function can_claim($account, $tile, $previous_tile) {
api_error_response('attack_requires_war', 'You must declare war before attacking this nation');
}
}
if (!$this->unit_can_take_settlement($tile['settlement_key'], $previous_tile['unit_key'])) {
if ($tile['account_key'] != $account['id'] && !$this->unit_can_take_settlement($tile['settlement_key'], $previous_tile['unit_key'])) {
api_error_response('unit_not_able_to_take_square', 'This unit is not able to take this size of township');
}
return true;
Expand All @@ -860,7 +860,7 @@ function can_move_to($account, $tile, $previous_tile) {
api_error_response('tile_is_occupied', 'There is already a friendly unit on this tile');
}
}
if (!$this->unit_can_take_settlement($tile['settlement_key'], $previous_tile['unit_key'])) {
if ($tile['account_key'] != $account['id'] && !$this->unit_can_take_settlement($tile['settlement_key'], $previous_tile['unit_key'])) {
api_error_response('unit_not_able_to_take_square', 'This unit is not able to take this size of township');
}
return true;
Expand Down
8 changes: 6 additions & 2 deletions application/views/scripts/unit_script.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function unit_can_move_to_new_tile(marker, start_lat, start_lng, end_lat, end_ln
let allowed_move_to_new_position = false;
let start_tile_id = tiles_by_coord[start_lat + ',' + start_lng].tile_key;
let end_tile_id = tiles_by_coord[end_lat + ',' + end_lng].tile_key;
let end_tile_account_key = tiles_by_coord[end_lat + ',' + end_lng].account_key;
let settlement_key = tiles_by_coord[end_lat + ',' + end_lng].settlement_key;
// Check conditions
Expand All @@ -180,7 +181,7 @@ function unit_can_move_to_new_tile(marker, start_lat, start_lng, end_lat, end_ln
else if (is_friendly_square(end_lat, end_lng)) {
alert('You must declare war through diplomacy before you can attack this land');
}
else if (!unit_can_take_settlement(settlement_key, marker.unit.unit_key)) {
else if (!unit_can_take_settlement(end_tile_account_key, settlement_key, marker.unit.unit_key)) {
alert('This unit is not able to take this size of township');
}
else {
Expand Down Expand Up @@ -213,7 +214,10 @@ function move_unit_to_new_tile(marker, combat, start_lat, start_lng, end_lat, en
}
}
function unit_can_take_settlement(settlement_key, unit_key) {
function unit_can_take_settlement(end_tile_account_key, settlement_key, unit_key) {
if (end_tile_account_key == account.id) {
return true;
}
if (settlement_key == town_key) {
if (unit_key == airforce_key) {
return false;
Expand Down
1 change: 1 addition & 0 deletions notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ HIGH PRIORITY
make trade screen more clear on existing for offer
reset cron
MEDIUM PRIORITY
Show current supplies of relevant settlement or industry card
shortages more clear
default to terrain view
settlement/industry require round of feed to establish
Expand Down
2 changes: 1 addition & 1 deletion sql/landgrab.sql
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ INSERT INTO `settlement` (
),
(11, 'Timber', 'timber', 3,
FALSE, FALSE, TRUE, FALSE, FALSE,
TRUE, TRUE, FALSE, FALSE, FALSE,
TRUE, TRUE, FALSE, TRUE, FALSE,
10, '', 5, 10, 1
),
(12, 'Fiber', 'fiber', 3,
Expand Down
2 changes: 1 addition & 1 deletion sql/world.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4211,7 +4211,7 @@ INSERT INTO `tile` (`id`, `lat`, `lng`, `world_key`, `account_key`, `terrain_key
(4165, 12, -80, 1, NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-02-29 11:09:56'),
(4166, 14, -80, 1, NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-02-29 11:09:56'),
(4167, 16, -80, 1, NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-02-29 11:09:56'),
(4168, 18, -80, 1, NULL, 6, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-02-29 11:09:56'),
(4168, 18, -80, 1, NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-02-29 11:09:56'),
(4169, 20, -80, 1, NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-03-01 06:00:56'),
(4170, 22, -80, 1, NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-03-03 01:37:53'),
(4171, 24, -80, 1, NULL, 5, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, '2020-05-18 00:39:22'),
Expand Down

0 comments on commit 3a81d46

Please sign in to comment.