Function StartExpansion

Line
1311
Location
common.ai
Constant?
no
Type
function
Arguments
integer qty, integer hall
Returns
boolean
1311
function StartExpansion takes integer qty, integer hall returns boolean
1312
    local integer count
1313
    local integer town
1314
    local unit    peon
1315
    local integer gold_cost
1316
1317
    set count = TownCount(hall)
1318
    if count >= qty then
1319
        return true
1320
    endif
1321
1322
    set town = GetNextExpansion()
1323
    if town == -1 then
1324
        return true
1325
    endif
1326
1327
    set take_exp = true
1328
1329
    set gold_cost = GetUnitGoldCost(hall)
1330
    if gold_cost > total_gold then
1331
        return false
1332
    endif
1333
    set total_gold = total_gold - gold_cost
1334
1335
    if GetExpansionFoe() != null then
1336
        return true
1337
    endif
1338
1339
    set peon = GetExpansionPeon()
1340
    if peon != null then
1341
        return SetExpansion(peon,hall)
1342
    endif
1343
1344
    return true
1345
endfunction