|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00031 #include <global.h> 00032 00033 const int season_timechange[5][HOURS_PER_DAY] = 00034 { 00035 {0, 0, 0, 0, 0, -1, -1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0, 0}, 00036 {0, 0, 0, 0, 0, -1, -1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0}, 00037 {0, 0, 0, 0, 0, -1, -1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0}, 00038 {0, 0, 0, 0, -1, -1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0}, 00039 {0, 0, 0, 0, 0, -1, -1, -1, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1, 0} 00040 }; 00041 00044 void init_world_darkness() 00045 { 00046 int i; 00047 timeofday_t tod; 00048 00049 world_darkness = MAX_DARKNESS; 00050 get_tod(&tod); 00051 00052 for (i = HOURS_PER_DAY / 2; i < HOURS_PER_DAY; i++) 00053 { 00054 world_darkness -= season_timechange[tod.season][i]; 00055 } 00056 00057 for (i = 0; i <= tod.hour; i++) 00058 { 00059 world_darkness -= season_timechange[tod.season][i]; 00060 } 00061 } 00062 00069 void tick_the_clock() 00070 { 00071 timeofday_t tod; 00072 00073 todtick++; 00074 00075 if (todtick % 20 == 0) 00076 { 00077 write_todclock(); 00078 } 00079 00080 get_tod(&tod); 00081 world_darkness -= season_timechange[tod.season][tod.hour]; 00082 }
1.7.4