1359 var clan : PClan; |
1359 var clan : PClan; |
1360 team : PTeam; |
1360 team : PTeam; |
1361 hht : THedgehog; |
1361 hht : THedgehog; |
1362 hhp : PHedgehog; |
1362 hhp : PHedgehog; |
1363 i, j : LongInt; |
1363 i, j : LongInt; |
|
1364 colorArg: Int64; |
|
1365 color: LongWord; |
1364 begin |
1366 begin |
1365 if CheckLuaParamCount(L, 2, 'SetClanColor', 'clan, color') then |
1367 if CheckLuaParamCount(L, 2, 'SetClanColor', 'clan, color') then |
1366 begin |
1368 begin |
1367 i:= Trunc(lua_tonumber(L,1)); |
1369 i:= Trunc(lua_tonumber(L,1)); |
1368 if i >= ClansCount then exit(0); |
1370 if i >= ClansCount then exit(0); |
1369 clan := ClansArray[i]; |
1371 clan := ClansArray[i]; |
1370 clan^.Color:= Trunc(lua_tonumber(L, 2)) shr 8; |
1372 colorArg:= Trunc(lua_tonumber(L, 2)); |
|
1373 if (colorArg < 0) and (abs(colorArg) <= cClanColors) then |
|
1374 // Pick clan color from settings (recommended) |
|
1375 color:= ClanColorArray[Pred(abs(colorArg))] |
|
1376 else if (colorArg >= 0) and (colorArg <= $ffffffff) then |
|
1377 // Specify color directly |
|
1378 color:= colorArg shr 8 |
|
1379 else |
|
1380 begin |
|
1381 OutError('Lua error: SetClanColor: Invalid ''color'' argument, must be between '+IntToStr(-cClanColors)+' and 0xffffffff!', true); |
|
1382 lc_setclancolor:= 0; |
|
1383 exit; |
|
1384 end; |
|
1385 |
|
1386 clan^.Color:= color; |
1371 |
1387 |
1372 for i:= 0 to Pred(clan^.TeamsNumber) do |
1388 for i:= 0 to Pred(clan^.TeamsNumber) do |
1373 begin |
1389 begin |
1374 team:= clan^.Teams[i]; |
1390 team:= clan^.Teams[i]; |
1375 for j:= 0 to cMaxHHIndex do |
1391 for j:= 0 to cMaxHHIndex do |