├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── Caesar Open.ttf ├── DS-Greece.ttf ├── INSTALL_LINUX ├── INSTALL_WINDOWS ├── LICENSE ├── LICENSE_GPL3 ├── README.md ├── c3_rev ├── C3.eng ├── C3_MM.eng ├── CMakeLists.txt ├── Caesar3.ini ├── basic.cpp ├── basic.h ├── c3.inf ├── cities_points.h ├── defs.h ├── gui.cpp ├── gui.h ├── house_evol.cpp ├── house_evol.h ├── log.cpp ├── log.h ├── main.cpp ├── mmio.cpp ├── mmio.h ├── pk.cpp ├── pk.h ├── variables.h └── win32-cross.cmake ├── cmake ├── Modules │ ├── CMakeParseArguments.cmake │ ├── EnsureVersion.cmake │ ├── FindLibintl.cmake │ ├── FindPNG.cmake │ ├── FindPackageHandleStandardArgs.cmake │ ├── FindQxt.cmake │ ├── FindSDL.cmake │ ├── FindSDL_image.cmake │ ├── FindSDL_mixer.cmake │ ├── FindSDL_ttf.cmake │ ├── Findzlib.cmake │ ├── GenerateVersionHPP.cmake │ └── version.hpp.in.cmake └── vs │ └── opencaesar3.vcxproj.user ├── dependencies └── README ├── docs └── CIII_EmpireCatalog_PharaohAah.pdf ├── install.sh ├── locale ├── en │ └── LC_MESSAGES │ │ └── caesar.po └── ru │ ├── LC_MESSAGES │ └── caesar.po │ ├── russian.csv │ └── test.txt ├── missions └── capua.oc3mission ├── models ├── game │ ├── archives.model │ ├── cities.model │ ├── construction.model │ ├── house.model │ ├── names.model │ ├── pantheon.model │ └── settings.model └── gui │ ├── educationadv.gui │ ├── employersadv.gui │ ├── entertainmentadv.gui │ ├── filmwidget.gui │ ├── playername.gui │ ├── speedoptions.gui │ ├── topmenu.gui │ └── videooptions.gui ├── release_src.sh ├── release_win32.sh ├── resources └── README ├── sgreader ├── CMakeLists.txt ├── README ├── aboutdialog.cpp ├── aboutdialog.h ├── gui │ ├── extractthread.cpp │ ├── extractthread.h │ ├── extractwizard.cpp │ ├── extractwizard.h │ ├── filelistpage.cpp │ ├── filelistpage.h │ ├── inputdirpage.cpp │ ├── inputdirpage.h │ ├── outputdirpage.cpp │ ├── outputdirpage.h │ ├── progresspage.cpp │ └── progresspage.h ├── icons │ ├── sgreader.ico │ └── sgreader.png ├── imagetreeitem.cpp ├── imagetreeitem.h ├── licensedialog.cpp ├── licensedialog.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── sgbitmap.cpp ├── sgbitmap.h ├── sgfile.cpp ├── sgfile.h ├── sgimage.cpp ├── sgimage.h ├── sgreader.pro ├── sgreader.qrc └── sgreader.rc ├── source ├── building │ ├── building.cpp │ ├── building.hpp │ ├── buildings.hpp │ ├── clay_pit.cpp │ ├── clay_pit.hpp │ ├── constants.hpp │ ├── education.cpp │ ├── education.hpp │ ├── engineer_post.cpp │ ├── engineer_post.hpp │ ├── entertainment.cpp │ ├── entertainment.hpp │ ├── factory.cpp │ ├── factory.hpp │ ├── farm.cpp │ ├── farm.hpp │ ├── forum.cpp │ ├── forum.hpp │ ├── garden.cpp │ ├── garden.hpp │ ├── goverment.cpp │ ├── goverment.hpp │ ├── granary.cpp │ ├── granary.hpp │ ├── health.cpp │ ├── health.hpp │ ├── high_bridge.cpp │ ├── high_bridge.hpp │ ├── house.cpp │ ├── house.hpp │ ├── low_bridge.cpp │ ├── low_bridge.hpp │ ├── marble_quarry.cpp │ ├── marble_quarry.hpp │ ├── market.cpp │ ├── market.hpp │ ├── metadata.cpp │ ├── metadata.hpp │ ├── military.cpp │ ├── military.hpp │ ├── military_academy.cpp │ ├── military_academy.hpp │ ├── native.cpp │ ├── native.hpp │ ├── pottery.cpp │ ├── pottery.hpp │ ├── prefecture.cpp │ ├── prefecture.hpp │ ├── religion.cpp │ ├── religion.hpp │ ├── ruins.cpp │ ├── ruins.hpp │ ├── senate.cpp │ ├── senate.hpp │ ├── service.cpp │ ├── service.hpp │ ├── training.cpp │ ├── training.hpp │ ├── warehouse.cpp │ ├── warehouse.hpp │ ├── watersupply.cpp │ ├── watersupply.hpp │ ├── well.cpp │ ├── well.hpp │ ├── wharf.cpp │ ├── wharf.hpp │ ├── working.cpp │ └── working.hpp ├── core │ ├── alignment.cpp │ ├── alignment.hpp │ ├── allocator.hpp │ ├── bytearray.hpp │ ├── color.hpp │ ├── delegate.hpp │ ├── direction.hpp │ ├── enumerator.hpp │ ├── event.hpp │ ├── eventconverter.cpp │ ├── eventconverter.hpp │ ├── exception.hpp │ ├── flagholder.hpp │ ├── font.cpp │ ├── font.hpp │ ├── foreach.hpp │ ├── gettext.hpp │ ├── json.cpp │ ├── json.hpp │ ├── list.hpp │ ├── logger.cpp │ ├── logger.hpp │ ├── math.hpp │ ├── platform.hpp │ ├── position.hpp │ ├── predefinitions.hpp │ ├── rectangle.hpp │ ├── referencecounted.hpp │ ├── requirements.hpp │ ├── safetycast.hpp │ ├── saveadapter.cpp │ ├── saveadapter.hpp │ ├── scopedptr.hpp │ ├── serializer.cpp │ ├── serializer.hpp │ ├── signals.hpp │ ├── singleton.hpp │ ├── size.hpp │ ├── smartptr.hpp │ ├── stringarray.hpp │ ├── stringhelper.cpp │ ├── stringhelper.hpp │ ├── time.cpp │ ├── time.hpp │ ├── variant.cpp │ ├── variant.hpp │ ├── variantprivate.hpp │ └── vector2.hpp ├── events │ ├── dispatcher.cpp │ ├── dispatcher.hpp │ ├── event.cpp │ ├── event.hpp │ ├── setvideooptions.cpp │ ├── setvideooptions.hpp │ ├── showfeastwindow.cpp │ └── showfeastwindow.hpp ├── game │ ├── abstractloader.hpp │ ├── alarm_event_holder.cpp │ ├── alarm_event_holder.hpp │ ├── astarpathfinding.cpp │ ├── astarpathfinding.hpp │ ├── astarpoint.hpp │ ├── build_options.cpp │ ├── build_options.hpp │ ├── citizen_group.cpp │ ├── citizen_group.hpp │ ├── city.cpp │ ├── city.hpp │ ├── cityfunds.cpp │ ├── cityfunds.hpp │ ├── cityservice.hpp │ ├── cityservice_animals.cpp │ ├── cityservice_animals.hpp │ ├── cityservice_culture.cpp │ ├── cityservice_culture.hpp │ ├── cityservice_disorder.cpp │ ├── cityservice_disorder.hpp │ ├── cityservice_emigrant.cpp │ ├── cityservice_emigrant.hpp │ ├── cityservice_festival.cpp │ ├── cityservice_festival.hpp │ ├── cityservice_fishplace.cpp │ ├── cityservice_fishplace.hpp │ ├── cityservice_info.cpp │ ├── cityservice_info.hpp │ ├── cityservice_prosperity.cpp │ ├── cityservice_prosperity.hpp │ ├── cityservice_religion.cpp │ ├── cityservice_religion.hpp │ ├── cityservice_roads.cpp │ ├── cityservice_roads.hpp │ ├── cityservice_shoreline.cpp │ ├── cityservice_shoreline.hpp │ ├── cityservice_timers.cpp │ ├── cityservice_timers.hpp │ ├── cityservice_water.cpp │ ├── cityservice_water.hpp │ ├── cityservice_workershire.cpp │ ├── cityservice_workershire.hpp │ ├── constants.hpp │ ├── construction.cpp │ ├── construction.hpp │ ├── divinity.cpp │ ├── divinity.hpp │ ├── empire.cpp │ ├── empire.hpp │ ├── empire_city.hpp │ ├── empire_city_computer.cpp │ ├── empire_city_computer.hpp │ ├── empire_trading.cpp │ ├── empire_trading.hpp │ ├── enums.hpp │ ├── fish_place.cpp │ ├── fish_place.hpp │ ├── game.cpp │ ├── game.hpp │ ├── gamedate.cpp │ ├── gamedate.hpp │ ├── good.cpp │ ├── good.hpp │ ├── goodhelper.cpp │ ├── goodhelper.hpp │ ├── goodorders.cpp │ ├── goodorders.hpp │ ├── goodstore.cpp │ ├── goodstore.hpp │ ├── goodstore_simple.cpp │ ├── goodstore_simple.hpp │ ├── house_level.cpp │ ├── house_level.hpp │ ├── infoboxmanager.cpp │ ├── infoboxmanager.hpp │ ├── loader.cpp │ ├── loader.hpp │ ├── loader_map.cpp │ ├── loader_map.hpp │ ├── loader_oc3mission.cpp │ ├── loader_oc3mission.hpp │ ├── loader_oc3save.cpp │ ├── loader_oc3save.hpp │ ├── loader_sav.cpp │ ├── loader_sav.hpp │ ├── minimap_colours.cpp │ ├── minimap_colours.hpp │ ├── name_generator.cpp │ ├── name_generator.hpp │ ├── path_finding.cpp │ ├── path_finding.hpp │ ├── pathway.cpp │ ├── pathway.hpp │ ├── pathway_helper.cpp │ ├── pathway_helper.hpp │ ├── pkwareinputstream.cpp │ ├── pkwareinputstream.hpp │ ├── player.cpp │ ├── player.hpp │ ├── resourcegroup.cpp │ ├── resourcegroup.hpp │ ├── road.cpp │ ├── road.hpp │ ├── roadbuild_helper.cpp │ ├── roadbuild_helper.hpp │ ├── route.hpp │ ├── saver.cpp │ ├── saver.hpp │ ├── screen.cpp │ ├── screen.hpp │ ├── screen_game.cpp │ ├── screen_game.hpp │ ├── screen_menu.cpp │ ├── screen_menu.hpp │ ├── screen_wait.cpp │ ├── screen_wait.hpp │ ├── service.cpp │ ├── service.hpp │ ├── settings.cpp │ ├── settings.hpp │ ├── tilemap.cpp │ ├── tilemap.hpp │ ├── tilemap_camera.cpp │ ├── tilemap_camera.hpp │ ├── tilemapchangecommand.cpp │ ├── tilemapchangecommand.hpp │ ├── tileoverlay_factory.cpp │ ├── tileoverlay_factory.hpp │ ├── timer.cpp │ ├── timer.hpp │ ├── trade_options.cpp │ ├── trade_options.hpp │ ├── walkermanager.cpp │ ├── walkermanager.hpp │ ├── win_targets.cpp │ └── win_targets.hpp ├── gfx │ ├── IMG_saveend.h │ ├── IMG_savepng.cpp │ ├── IMG_savepng.h │ ├── animation.cpp │ ├── animation.hpp │ ├── animation_bank.cpp │ ├── animation_bank.hpp │ ├── city_renderer.cpp │ ├── city_renderer.hpp │ ├── constants.hpp │ ├── decorator.cpp │ ├── decorator.hpp │ ├── engine.cpp │ ├── engine.hpp │ ├── gl_engine.cpp │ ├── gl_engine.hpp │ ├── layer.cpp │ ├── layer.hpp │ ├── layerconstants.hpp │ ├── layercrime.cpp │ ├── layercrime.hpp │ ├── layerdamage.cpp │ ├── layerdamage.hpp │ ├── layerdesirability.cpp │ ├── layerdesirability.hpp │ ├── layerentertainment.cpp │ ├── layerentertainment.hpp │ ├── layerfire.cpp │ ├── layerfire.hpp │ ├── layerfood.cpp │ ├── layerfood.hpp │ ├── layerhealth.cpp │ ├── layerhealth.hpp │ ├── layerreligion.cpp │ ├── layerreligion.hpp │ ├── layersimple.cpp │ ├── layersimple.hpp │ ├── layerwater.cpp │ ├── layerwater.hpp │ ├── loader.cpp │ ├── loader.hpp │ ├── loader_png.cpp │ ├── loader_png.hpp │ ├── picture.cpp │ ├── picture.hpp │ ├── picture_bank.cpp │ ├── picture_bank.hpp │ ├── picture_info_bank.cpp │ ├── picture_info_bank.hpp │ ├── pictureconverter.cpp │ ├── pictureconverter.hpp │ ├── renderer.hpp │ ├── sdl_engine.cpp │ ├── sdl_engine.hpp │ ├── tile.cpp │ ├── tile.hpp │ ├── tileoverlay.cpp │ └── tileoverlay.hpp ├── gui │ ├── advisor_education_window.cpp │ ├── advisor_education_window.hpp │ ├── advisor_emperor_window.cpp │ ├── advisor_emperor_window.hpp │ ├── advisor_employers_window.cpp │ ├── advisor_employers_window.hpp │ ├── advisor_entertainment_window.cpp │ ├── advisor_entertainment_window.hpp │ ├── advisor_finance_window.cpp │ ├── advisor_finance_window.hpp │ ├── advisor_health_window.cpp │ ├── advisor_health_window.hpp │ ├── advisor_legion_window.cpp │ ├── advisor_legion_window.hpp │ ├── advisor_ratings_window.cpp │ ├── advisor_ratings_window.hpp │ ├── advisor_religion_window.cpp │ ├── advisor_religion_window.hpp │ ├── advisor_trade_window.cpp │ ├── advisor_trade_window.hpp │ ├── advisors_window.cpp │ ├── advisors_window.hpp │ ├── buildmenu.cpp │ ├── buildmenu.hpp │ ├── contextmenu.cpp │ ├── contextmenu.hpp │ ├── contextmenuitem.cpp │ ├── contextmenuitem.hpp │ ├── contextmenuitemprivate.h │ ├── contextmenuprivate.hpp │ ├── dialogbox.cpp │ ├── dialogbox.hpp │ ├── editbox.cpp │ ├── editbox.hpp │ ├── empiremap_window.cpp │ ├── empiremap_window.hpp │ ├── environment.cpp │ ├── environment.hpp │ ├── festival_planing_window.cpp │ ├── festival_planing_window.hpp │ ├── film_widget.cpp │ ├── film_widget.hpp │ ├── groupbox.cpp │ ├── groupbox.hpp │ ├── info_box.cpp │ ├── info_box.hpp │ ├── label.cpp │ ├── label.hpp │ ├── listbox.cpp │ ├── listbox.hpp │ ├── listboxitem.cpp │ ├── listboxitem.hpp │ ├── listboxprivate.hpp │ ├── loadmapwindow.cpp │ ├── loadmapwindow.hpp │ ├── mainmenu.cpp │ ├── mainmenu.hpp │ ├── menu.cpp │ ├── menu.hpp │ ├── message_stack_widget.cpp │ ├── message_stack_widget.hpp │ ├── minimap_window.cpp │ ├── minimap_window.hpp │ ├── mission_target_window.cpp │ ├── mission_target_window.hpp │ ├── modal_widget.cpp │ ├── modal_widget.hpp │ ├── overlays_menu.cpp │ ├── overlays_menu.hpp │ ├── playername_window.cpp │ ├── playername_window.hpp │ ├── popup_messagebox.cpp │ ├── popup_messagebox.hpp │ ├── pushbutton.cpp │ ├── pushbutton.hpp │ ├── rightpanel.cpp │ ├── rightpanel.hpp │ ├── save_dialog.cpp │ ├── save_dialog.hpp │ ├── scrollbar.cpp │ ├── scrollbar.hpp │ ├── scrollbarprivate.hpp │ ├── senate_popup_info.cpp │ ├── senate_popup_info.hpp │ ├── special_orders_window.cpp │ ├── special_orders_window.hpp │ ├── startmenu.cpp │ ├── startmenu.hpp │ ├── texturedbutton.hpp │ ├── topmenu.cpp │ ├── topmenu.hpp │ ├── video_options_window.cpp │ ├── video_options_window.hpp │ ├── warehouse_infobox.cpp │ ├── warehouse_infobox.hpp │ ├── widget.cpp │ ├── widget.hpp │ ├── widget_deleter.cpp │ ├── widget_deleter.hpp │ ├── widget_factory.cpp │ ├── widget_factory.hpp │ ├── widgetanimator.cpp │ ├── widgetanimator.hpp │ ├── widgetpositionanimator.cpp │ ├── widgetpositionanimator.hpp │ ├── widgetprivate.hpp │ ├── window_gamespeed_options.cpp │ └── window_gamespeed_options.hpp ├── main.cpp ├── sound │ ├── oc3_sound_engine.cpp │ └── oc3_sound_engine.hpp ├── version.hpp ├── vfs │ ├── archive.hpp │ ├── archive_zip.cpp │ ├── archive_zip.hpp │ ├── entity.hpp │ ├── file.cpp │ ├── file.hpp │ ├── filelist.cpp │ ├── filelist.hpp │ ├── filelist_item.hpp │ ├── filenative_impl.cpp │ ├── filenative_impl.hpp │ ├── filepath.cpp │ ├── filepath.hpp │ ├── filesystem.cpp │ ├── filesystem.hpp │ ├── memfile.cpp │ └── memfile.hpp └── walker │ ├── ability.cpp │ ├── ability.hpp │ ├── action.hpp │ ├── animals.cpp │ ├── animals.hpp │ ├── cart_pusher.cpp │ ├── cart_pusher.hpp │ ├── cart_supplier.cpp │ ├── cart_supplier.hpp │ ├── constants.hpp │ ├── corpse.cpp │ ├── corpse.hpp │ ├── emigrant.cpp │ ├── emigrant.hpp │ ├── fishing_boat.cpp │ ├── fishing_boat.hpp │ ├── immigrant.cpp │ ├── immigrant.hpp │ ├── market_kid.cpp │ ├── market_kid.hpp │ ├── market_lady.cpp │ ├── market_lady.hpp │ ├── merchant.cpp │ ├── merchant.hpp │ ├── patrician.cpp │ ├── patrician.hpp │ ├── prefect.cpp │ ├── prefect.hpp │ ├── protestor.cpp │ ├── protestor.hpp │ ├── serviceman.cpp │ ├── serviceman.hpp │ ├── servicewalker_helper.hpp │ ├── ship.cpp │ ├── ship.hpp │ ├── taxcollector.cpp │ ├── taxcollector.hpp │ ├── trainee.cpp │ ├── trainee.hpp │ ├── walker.cpp │ ├── walker.hpp │ ├── workerhunter.cpp │ └── workerhunter.hpp └── utils ├── aesGladman ├── aes.h ├── aescrypt.cpp ├── aeskey.cpp ├── aesopt.h ├── aestab.cpp ├── fileenc.cpp ├── fileenc.h ├── hmac.cpp ├── hmac.h ├── pwd2key.cpp ├── pwd2key.h ├── sha1.cpp ├── sha1.h ├── sha2.cpp └── sha2.h ├── bzip2 ├── blocksort.c ├── bzcompress.c ├── bzlib.c ├── bzlib.h ├── bzlib_private.h ├── crctable.c ├── decompress.c ├── huffman.c └── randtable.c ├── lzma ├── LzmaDec.c ├── LzmaDec.h └── Types.h └── zlib ├── adler32.c ├── compress.c ├── crc32.c ├── crc32.h ├── deflate.c ├── deflate.h ├── gzclose.c ├── gzguts.h ├── gzio.c ├── gzlib.c ├── gzread.c ├── gzwrite.c ├── infback.c ├── inffast.c ├── inffast.h ├── inffixed.h ├── inflate.c ├── inflate.h ├── inftrees.c ├── inftrees.h ├── trees.c ├── trees.h ├── uncompr.c ├── zconf.h ├── zlib.h ├── zutil.c └── zutil.h /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | # Emacs backup and temp files 3 | *~ 4 | \#*# 5 | stdout.txt 6 | caesar3 7 | 8 | #coredump files 9 | core.* 10 | 11 | # makefile is generated by cmake 12 | Makefile 13 | CMakeFiles 14 | CMakeCache.txt 15 | cmake_install.cmake 16 | 17 | # Eclipse project files 18 | .classpath 19 | .project 20 | .cproject 21 | 22 | build/* 23 | resources/* 24 | dependencies/* 25 | application/* 26 | en/* 27 | 28 | # Compiled translation files 29 | *.mo 30 | 31 | /*.7pre1 32 | /source/gfx/*.autosave 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | 3 | compiler: 4 | - gcc 5 | - clang 6 | 7 | #matrix: 8 | # include: 9 | # - compiler: i686-w64-mingw32 10 | # env: OPTIONS="-DCMAKE_TOOLCHAIN_FILE=cmake/xcompile/win32.cmake" 11 | 12 | before_install: 13 | - sudo apt-get update 14 | - sudo apt-get install -qq libsdl1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev 15 | 16 | 17 | before_script: 18 | - mkdir build 19 | - cd build 20 | - cmake .. 21 | 22 | script: make 23 | -------------------------------------------------------------------------------- /Caesar Open.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/Caesar Open.ttf -------------------------------------------------------------------------------- /DS-Greece.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/DS-Greece.ttf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This file is part of openCaesar3. 2 | 3 | openCaesar3 is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | openCaesar3 is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with openCaesar3. If not, see . 15 | 16 | Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | openCaesar3 source code and binary is published under the GNU GPLv3 license. 20 | The libarchive library is published under the BSD-2 clause license. 21 | 22 | 23 | -------------------------------------------------------------------------------- /c3_rev/C3.eng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/c3_rev/C3.eng -------------------------------------------------------------------------------- /c3_rev/C3_MM.eng: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/c3_rev/C3_MM.eng -------------------------------------------------------------------------------- /c3_rev/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(c3_rev) 2 | cmake_minimum_required(VERSION 2.8) 3 | aux_source_directory(. SRC_LIST) 4 | file(GLOB INC_LIST "*.h") 5 | 6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -g") 7 | 8 | add_executable(${PROJECT_NAME} ${INC_LIST} ${SRC_LIST}) 9 | 10 | target_link_libraries(${PROJECT_NAME} "winmm.lib") 11 | target_link_libraries(${PROJECT_NAME} "ddraw.lib") 12 | target_link_libraries(${PROJECT_NAME} "dsound.lib") 13 | 14 | -------------------------------------------------------------------------------- /c3_rev/Caesar3.ini: -------------------------------------------------------------------------------- 1 | [Config] 2 | RAM=32 3 | CDDrive=..\cd. 4 | 5 | -------------------------------------------------------------------------------- /c3_rev/basic.h: -------------------------------------------------------------------------------- 1 | #ifndef __C3_BASIC_INCLUDE__ 2 | #define __C3_BASIC_INCLUDE__ 3 | 4 | int fun_getStringWidth(const char *str, int fontId); 5 | int fun_strlen(const char *str); 6 | int fun_getCharWidth(unsigned __int8 c, int fontId); 7 | void unused_addToGameTextString(char *str, int group, int number, signed int len); 8 | void fun_strMoveLeft(char *start, const char *end); 9 | int fun_strToInt(char *str); 10 | int fun_strNumDigitChars(char *str); 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /c3_rev/c3.inf: -------------------------------------------------------------------------------- 1 | .FFNt 2ddd B -------------------------------------------------------------------------------- /c3_rev/cities_points.h: -------------------------------------------------------------------------------- 1 | #ifndef __C3_CITIESPOINTS_INCLUDE__ 2 | #define __C3_CITIESPOINTS_INCLUDE__ 3 | 4 | #include "defs.h" 5 | 6 | #define _RR_SIZE 10 7 | 8 | C3MapPoint stru_5F1890[_RR_SIZE]; // 9 | C3MapPoint stru_5F18A0[_RR_SIZE]; 10 | C3MapPoint stru_5F18C0[_RR_SIZE]; 11 | C3MapPoint stru_5F18F0[_RR_SIZE]; 12 | C3MapPoint stru_5F1930[_RR_SIZE]; 13 | C3MapPoint stru_5F1980[_RR_SIZE]; 14 | C3MapPoint stru_5F19E0[_RR_SIZE]; 15 | C3MapPoint stru_5F19F8[_RR_SIZE]; 16 | C3MapPoint stru_5F1A20[_RR_SIZE]; 17 | C3MapPoint stru_5F1A58[_RR_SIZE]; 18 | C3MapPoint stru_5F1AA0[_RR_SIZE]; 19 | C3MapPoint stru_5F1AF8[_RR_SIZE]; 20 | C3MapPoint stru_5F1B60[_RR_SIZE]; 21 | C3MapPoint stru_5F1B80[_RR_SIZE]; 22 | C3MapPoint stru_5F1BB0[_RR_SIZE]; 23 | C3MapPoint stru_5F1BF0[_RR_SIZE]; 24 | C3MapPoint stru_5F1C40[_RR_SIZE]; 25 | C3MapPoint stru_5F1CA0[_RR_SIZE]; 26 | C3MapPoint stru_5F1D10[_RR_SIZE]; 27 | C3MapPoint stru_5F1D38[_RR_SIZE]; 28 | C3MapPoint stru_5F1D70[_RR_SIZE]; 29 | C3MapPoint stru_5F1DB8[_RR_SIZE]; 30 | C3MapPoint stru_5F1E10[_RR_SIZE]; 31 | C3MapPoint stru_5F1E78[_RR_SIZE]; 32 | C3MapPoint stru_5F1EF0[_RR_SIZE]; 33 | C3MapPoint stru_5F1F20[_RR_SIZE]; 34 | C3MapPoint stru_5F1F60[_RR_SIZE]; 35 | C3MapPoint stru_5F1FB0[_RR_SIZE]; 36 | C3MapPoint stru_5F2010[_RR_SIZE]; 37 | C3MapPoint stru_5F2080[_RR_SIZE]; 38 | C3MapPoint stru_5F20FE[_RR_SIZE]; 39 | 40 | #endif 41 | 42 | 43 | -------------------------------------------------------------------------------- /c3_rev/gui.cpp: -------------------------------------------------------------------------------- 1 | #include "variables.h" 2 | 3 | void fun_resetTooltipTimer() 4 | { 5 | mouseover_last_update = time_current; 6 | mouseover_info_id = 0; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /c3_rev/gui.h: -------------------------------------------------------------------------------- 1 | #ifndef __C3_GUI_INCLUDE__ 2 | #define __C3_GUI_INCLUDE__ 3 | 4 | void fun_resetTooltipTimer(); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /c3_rev/house_evol.h: -------------------------------------------------------------------------------- 1 | #ifndef __HOUSE_EVOL_INCLUDE__ 2 | #define __HOUSE_EVOL_INCLUDE__ 3 | 4 | void fun_determineHouseEvolveText(int buildingId); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /c3_rev/log.h: -------------------------------------------------------------------------------- 1 | #ifndef __LOG_INCLUDE__ 2 | #define __LOG_INCLUDE__ 3 | 4 | void fun_logDebugMessage(const char *msg, const char *paramStr, int paramInt); 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /c3_rev/mmio.h: -------------------------------------------------------------------------------- 1 | #ifndef __MMIO_INCLUDE__ 2 | #define __MMIO_INCLUDE__ 3 | 4 | #include "windows.h" 5 | 6 | int mmio_loadFile(const char *pszFileName, HMMIO *outMmio, void **out_a3, const MMCKINFO *pmmckiParent); 7 | int mmio_530B40(HMMIO hmmio, int length1, char* a3, int a4, int a5); 8 | int mmio_close(HMMIO *mmio, HGLOBAL *a2); 9 | int cvtdate(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11); 10 | void __cdecl fun_writeLogMessageToStatusTxt(DWORD nNumberOfBytesToWrite); 11 | void fun_logDebugMessage(const char *msg, const char *paramStr, int paramInt); 12 | int fun_chdirToCdBasedOnExtension(const char *filename); 13 | void fun_storeFileExtension(const char *filename); 14 | void fun_strncpy(const char *src, char *dst, int len); 15 | void fun_strtoupper(char* a1); 16 | void fun_getGameTextString(int group, int number); 17 | void fun_drawHelpDialogWithVideo(); 18 | 19 | 20 | void fun_chdirHome(); 21 | void fun_getTimeAsString(); 22 | int fun_intToString(signed int number, int offset, int addPlusSign); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /c3_rev/win32-cross.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win32 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc) 5 | SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++) 6 | SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres) 7 | SET(CMAKE_RANLIB /usr/bin/i686-w64-mingw32-ranlib) 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /cmake/Modules/version.hpp.in.cmake: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PROJECT_VERSION_INCLUDE_H_ 17 | #define __OPENCAESAR3_PROJECT_VERSION_INCLUDE_H_ 18 | 19 | #include "core/platform.hpp" 20 | 21 | #define OC3_VERSION_MAJOR 0 22 | #define OC3_VERSION_MINOR 2 23 | #define OC3_VERSION_REVSN @rev_number@ 24 | 25 | #define OC3_STR_EXT(__A) #__A 26 | #define OC3_STR_A(__A) OC3_STR_EXT(__A) 27 | #define OC3_VERSION OC3_STR_A(OC3_VERSION_MAJOR)"."OC3_STR_A(OC3_VERSION_MINOR)"."OC3_STR_A(OC3_VERSION_REVSN)"["OC3_PLATFORM_NAME":"OC3_COMPILER_NAME"]" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /cmake/vs/opencaesar3.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | @DEBUG_ARGS@ 5 | WindowsLocalDebugger 6 | 7 | 8 | @DEBUG_ARGS@ 9 | WindowsLocalDebugger 10 | 11 | 12 | @DEBUG_ARGS@ 13 | WindowsLocalDebugger 14 | 15 | 16 | @DEBUG_ARGS@ 17 | WindowsLocalDebugger 18 | 19 | -------------------------------------------------------------------------------- /dependencies/README: -------------------------------------------------------------------------------- 1 | Use this folder for windows dependencies (http://opencaesar3.org/files/dependencies.7z) 2 | -------------------------------------------------------------------------------- /docs/CIII_EmpireCatalog_PharaohAah.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/docs/CIII_EmpireCatalog_PharaohAah.pdf -------------------------------------------------------------------------------- /locale/ru/russian.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/locale/ru/russian.csv -------------------------------------------------------------------------------- /locale/ru/test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/locale/ru/test.txt -------------------------------------------------------------------------------- /models/game/archives.model: -------------------------------------------------------------------------------- 1 | { 2 | pics_1 : "resources/pics_1.zip" 3 | } -------------------------------------------------------------------------------- /models/game/pantheon.model: -------------------------------------------------------------------------------- 1 | { 2 | ceres : 3 | { 4 | name : "Ceres", 5 | shortDesc : "Fertility", 6 | type : "goddess", 7 | service : "srvc_temple_ceres", 8 | image : "picture1_00013.png" 9 | }, 10 | 11 | mars : 12 | { 13 | name : "Mars", 14 | shortDesc : "War", 15 | type : "god", 16 | service : "srvc_temple_mars", 17 | image : "picture1_00012.png" 18 | }, 19 | 20 | neptune : 21 | { 22 | name : "Neptune" 23 | shortDesc : "" 24 | type : "god", 25 | service : "srvc_temple_neptune" 26 | image : "picture1_00015.png" 27 | }, 28 | 29 | venus : 30 | { 31 | name : "Venus" 32 | shortDesc : "" 33 | type : "goddes" 34 | service : "srvc_temple_venus" 35 | image : "picture1_00011.png" 36 | }, 37 | 38 | mercury : 39 | { 40 | name : "Mercury" 41 | shortDesc : "" 42 | type : "god", 43 | service : "srvc_temple_mercury" 44 | image : "picture1_00014.png" 45 | } 46 | } -------------------------------------------------------------------------------- /models/game/settings.model: -------------------------------------------------------------------------------- 1 | { 2 | resolution : [1024, 768] 3 | fullscreen : false 4 | } -------------------------------------------------------------------------------- /models/gui/educationadv.gui: -------------------------------------------------------------------------------- 1 | { 2 | lbBackground#Label : 3 | { 4 | geometryf : [ 0.0, 0.0, 1, 1 ] 5 | bgtype : "whiteFrame" 6 | 7 | lbBlackframe#Label : { 8 | geometryf : [ 0.05, 0.4, 0.95, 0.7 ] 9 | bgtype : "blackFrame" 10 | } 11 | 12 | lbWorkText#Label : { 13 | font : "FONT_1" 14 | geometry : [ 180, 80, 250, 105 ] 15 | text : "##work##" 16 | } 17 | 18 | lbMaxAvailableText#Label : { 19 | font : "FONT_1" 20 | geometry : [ 290, 80, 450, 105 ] 21 | text : "##max_available##" 22 | } 23 | 24 | lbCoverageText#Label : { 25 | font : "FONT_1" 26 | geometry : [ 480, 80, 600, 105 ] 27 | text : "##coverage##" 28 | } 29 | 30 | lbCityInfo#Label : { 31 | font : "FONT_1" 32 | geometry : [ 65, 50, 610, 80 ] 33 | } 34 | 35 | lbTroubleInfo#Label : { 36 | font : "FONT_1" 37 | multiline : true 38 | geometryf : [ 0.05, 0.71, 0.95, 0.95 ] 39 | } 40 | 41 | lbTitle#Label : { 42 | geometryf : [ 0.05, 0.05, 0.95, 0.1 ] 43 | minimumSize : [ 0, 30 ] 44 | maximumSize : [ 0, 60 ] 45 | font : "FONT_3" 46 | text : "##education_advisor_title##" 47 | textAlign : [ "center", "center" ] 48 | } 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /models/gui/filmwidget.gui: -------------------------------------------------------------------------------- 1 | { 2 | geometry : [ 0, 0, 415, 450 ] 3 | 4 | lbBackground#Label : 5 | { 6 | geometryf : [ 0.0, 0.0, 1, 1 ] 7 | bgtype : "whiteFrame" 8 | 9 | lbTitle#Label : 10 | { 11 | font : "FONT_2" 12 | geometry : [ 42, 400, 370, 440 ] 13 | text : "##title##" 14 | textAlign : [ "center", "center" ] 15 | } 16 | 17 | btnHelp#TexturedButton : 18 | { 19 | geometry : [ 16, 408, 40, 432 ] 20 | normal : [ "paneling", 528 ] 21 | hovered : [ "paneling", 529 ] 22 | pressed : [ "paneling", 530 ] 23 | disabled : [ "paneling", 531 ] 24 | } 25 | 26 | btnExit#TexturedButton : 27 | { 28 | geometry : [ 374, 408, 398, 432 ] 29 | normal : [ "paneling", 532 ] 30 | hovered : [ "paneling", 533 ] 31 | pressed : [ "paneling", 534 ] 32 | disabled : [ "paneling", 535 ] 33 | } 34 | 35 | lbBlackFrame#Label : { 36 | geometry : [ 10, 310, 405, 400 ] 37 | bgtype : "blackFrame" 38 | 39 | lbTime#Label : { 40 | geometry : [ 0, 0, 150, 20 ] 41 | font : "FONT_1" 42 | } 43 | 44 | lbReceiver#Label : { 45 | geometry : [ 150, 0, 405, 20 ] 46 | font : "FONT_1" 47 | } 48 | 49 | lbMessage#Label : { 50 | geometry : [ 0, 20, 430, 90 ] 51 | font : "FONT_1" 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /models/gui/playername.gui: -------------------------------------------------------------------------------- 1 | { 2 | geometry : [ 0, 0, 380, 128 ] 3 | 4 | lbBackground#Label : 5 | { 6 | geometryf : [ 0.0, 0.0, 1, 1 ] 7 | bgtype : "whiteFrame" 8 | 9 | edPlayerName#EditBox : 10 | { 11 | geometry : [ 32, 50, 352, 82 ] 12 | textAlign : [ "upperLeft", "center" ] 13 | font : "FONT_2_WHITE" 14 | textOffset : [ 20, 0 ] 15 | text : "##new_governor##" 16 | } 17 | 18 | lbNext#Label : 19 | { 20 | geometry : [ 180, 90, 336, 110 ] 21 | text : "##plname_continue##" 22 | font : "FONT_2" 23 | } 24 | 25 | lbTitle#Label : 26 | { 27 | geometry : [ 10, 10, 380, 48 ] 28 | text : "##enter_your_name##" 29 | font : "FONT_3" 30 | textAlign : [ "center", "center" ] 31 | } 32 | 33 | btnContinue#TexturedButton : 34 | { 35 | geometry : [ 330, 90, 357, 117 ] 36 | normal : [ "paneling", 179 ] 37 | hovered : [ "paneling", 180 ] 38 | pressed : [ "paneling", 181 ] 39 | disabled : [ "paneling", 179 ] 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /models/gui/topmenu.gui: -------------------------------------------------------------------------------- 1 | { 2 | lbPopulation#Label : { 3 | geometry : [ 0, 0, 120, 23 ] 4 | image : "paneling_00015.png" 5 | font : "FONT_2_WHITE" 6 | textAlign : [ "center", "center" ] 7 | tooltipText : "##population_tooltip##" 8 | } 9 | 10 | lbDate#Label : { 11 | geometry : [ 0, 0, 120, 23 ] 12 | font : "FONT_2_YELLOW" 13 | textAlign : [ "center", "center" ] 14 | image : "paneling_00015.png" 15 | tooltipText : "##funds_tooltip##" 16 | } 17 | 18 | lbFunds#Label : { 19 | geometry : [ 0, 0, 120, 23 ] 20 | font : "FONT_2_WHITE" 21 | textAlign : [ "center", "center" ] 22 | image : "paneling_00015.png" 23 | tooltipText : "##date_tooltip##" 24 | } 25 | 26 | cntxItemFile#ContextMenuItem : { 27 | text : "##gmenu_file##" 28 | submenu : true 29 | 30 | cntxItemNewgame#ContextMenuItem : { 31 | text : "##gmenu_file_new##" 32 | } 33 | 34 | cntxItemRestart#ContextMenuItem : { 35 | text : "##gmenu_file_restart##" 36 | } 37 | 38 | cntxItemLoad#ContextMenuItem : { 39 | text : "##gmenu_file_load##" 40 | } 41 | 42 | cntxItemSave#ContextMenuItem : { 43 | text : "##gmenu_file_save##" 44 | } 45 | 46 | cntxItemMainMenu#ContextMenuItem : { 47 | text : "##gmenu_file_mainmenu##" 48 | } 49 | 50 | cntxItemExit#ContextMenuItem : { 51 | text : "##gmenu_file_exit##" 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /models/gui/videooptions.gui: -------------------------------------------------------------------------------- 1 | { 2 | geometry : [ 0, 0, 320, 290 ] 3 | 4 | lbTitle#Label : 5 | { 6 | font : "FONT_3" 7 | geometry : [ 30, 10, 290, 35 ] 8 | text : "##video_options##" 9 | textAlign : [ "center", "center" ] 10 | } 11 | 12 | lbBackground#Label : 13 | { 14 | geometryf : [ 0.0, 0.0, 1, 1 ] 15 | bgtype : "whiteFrame" 16 | 17 | btnSwitchMode#PushButton : 18 | { 19 | geometry : [ 50, 45, 270, 65 ] 20 | text : "##switch_mode##" 21 | bgtype : "smallGrayBorderLine" 22 | id : 1 23 | } 24 | 25 | lbxModes#ListBox : 26 | { 27 | geometry : [ 52, 68, 270, 232 ] 28 | bgtype : "smallGrayBorderLine" 29 | } 30 | 31 | btnCancel#PushButton : 32 | { 33 | geometry : [ 50, 237, 270, 257 ] 34 | bgtype : "smallGrayBorderLine" 35 | text : "##cancel##" 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /release_src.sh: -------------------------------------------------------------------------------- 1 | # make a SVN tag: 2 | # svn copy file:///home/greg/dev/SVN/caesar/trunk file:///home/greg/dev/SVN/caesar/tags/0-0-2 3 | 4 | DATE=`date +"%Y_%m_%d.%H_%M_%S"` 5 | DIR=BAK/REL_SRC_$DATE 6 | DST=$DIR/opencaesar3 7 | mkdir -p $DST 8 | cp *.?pp $DST 9 | cp make* $DST 10 | cp *.sh $DST 11 | cp *.csv $DST 12 | cp INSTALL* $DST 13 | cp README* $DST 14 | cp LICENSE* $DST 15 | mkdir -p $DST/fr/LC_MESSAGES 16 | cp fr/LC_MESSAGES/caesar.po $DST/fr/LC_MESSAGES 17 | 18 | tar cvz --directory $DIR -f opencaesar3-src-$DATE.tgz opencaesar3 19 | mv opencaesar3-src-$DATE.tgz BAK 20 | 21 | 22 | -------------------------------------------------------------------------------- /release_win32.sh: -------------------------------------------------------------------------------- 1 | # make a SVN tag: 2 | # svn copy file:///home/greg/dev/SVN/caesar/trunk file:///home/greg/dev/SVN/caesar/tags/0-0-2 3 | 4 | DATE=`date +"%Y_%m_%d.%H_%M_%S"` 5 | DIR=BAK/REL_WIN32_$DATE 6 | DST=$DIR/opencaesar3 7 | mkdir -p $DST 8 | 9 | cp caesar.exe $DST 10 | cp *.csv $DST 11 | 12 | # copy text files in windows format 13 | for FILE in INSTALL_WINDOWS README LICENSE* 14 | do 15 | cp $FILE $DST/$FILE.txt 16 | todos $DST/$FILE.txt 17 | done 18 | 19 | # copy dependencies 20 | cp win32_deps/*.dll $DST 21 | cp win32_deps/*.ttf $DST 22 | 23 | mkdir $DST/sgreader 24 | cp win32_deps/sgreader/*.exe $DST/sgreader 25 | cp win32_deps/sgreader/*.txt $DST/sgreader 26 | 27 | # install translations 28 | mkdir -p $DST/fr/LC_MESSAGES 29 | cp fr/LC_MESSAGES/caesar.po $DST/fr/LC_MESSAGES 30 | 31 | # make stubs for resources directory 32 | mkdir -p $DST/resources/pics 33 | mkdir -p $DST/resources/maps 34 | 35 | cd $DIR 36 | zip -r opencaesar3-win32-$DATE.zip opencaesar3 37 | cd - 38 | mv $DIR/opencaesar3-win32-$DATE.zip BAK 39 | 40 | -------------------------------------------------------------------------------- /resources/README: -------------------------------------------------------------------------------- 1 | Use this folder for game resources (http://opencaesar3.org/files/resources.7z) 2 | -------------------------------------------------------------------------------- /sgreader/gui/extractthread.h: -------------------------------------------------------------------------------- 1 | #ifndef EXTRACTTHREAD_H 2 | #define EXTRACTTHREAD_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ExtractThread : public QThread { 10 | Q_OBJECT 11 | 12 | public: 13 | ExtractThread(const QStringList &files, const QString &outputDir, 14 | bool extractSystem); 15 | QStringList errors() const; 16 | void cancel(); 17 | int errorCount() const; 18 | int extractCount() const; 19 | 20 | signals: 21 | void progressChanged(int value); 22 | void fileChanged(const QString &filename, int maxImages); 23 | 24 | protected: 25 | void run(); 26 | 27 | private: 28 | void extractFile(const QString &filename); 29 | 30 | QStringList errorMessages; 31 | QStringList files; 32 | QDir outputDir; 33 | bool extractSystem; 34 | bool doCancel; 35 | int extracted; 36 | int errorImages; 37 | }; 38 | 39 | #endif /* EXTRACTTHREAD_H */ 40 | -------------------------------------------------------------------------------- /sgreader/gui/extractwizard.cpp: -------------------------------------------------------------------------------- 1 | #include "extractwizard.h" 2 | 3 | #include "inputdirpage.h" 4 | #include "filelistpage.h" 5 | #include "outputdirpage.h" 6 | #include "progresspage.h" 7 | 8 | #include // TODO: specify 9 | 10 | ExtractWizard::ExtractWizard(QWidget *parent) 11 | : QWizard(parent) 12 | { 13 | setWindowTitle("Extract files wizard"); 14 | 15 | addPage(new InputDirPage(this)); 16 | addPage(new FileListPage(this)); 17 | addPage(new OutputDirPage(this)); 18 | addPage(new ProgressPage(this)); 19 | 20 | setOptions(QWizard::DisabledBackButtonOnLastPage); 21 | setWizardStyle(QWizard::ClassicStyle); 22 | 23 | QList layout; 24 | layout << QWizard::CancelButton << QWizard::Stretch << QWizard::BackButton 25 | << QWizard::NextButton << QWizard::FinishButton; 26 | setButtonLayout(layout); 27 | } 28 | 29 | ExtractWizard::~ExtractWizard() { 30 | 31 | } 32 | 33 | void ExtractWizard::closeEvent(QCloseEvent *event) { 34 | ProgressPage *page = qobject_cast(currentPage()); 35 | 36 | qDebug("Close called on dialog"); 37 | if (page && page->isBusy()) { 38 | event->ignore(); 39 | } else { 40 | event->accept(); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /sgreader/gui/extractwizard.h: -------------------------------------------------------------------------------- 1 | #ifndef EXTRACTWIZARD_H 2 | #define EXTRACTWIZARD_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QStackedWidget; 9 | class QPushButton; 10 | 11 | class InputDirPage; 12 | class OutputDirPage; 13 | class FileListPage; 14 | class ProgressPage; 15 | 16 | class ExtractWizard : public QWizard { 17 | Q_OBJECT 18 | 19 | public: 20 | ExtractWizard(QWidget *parent = 0); 21 | ~ExtractWizard(); 22 | 23 | protected: 24 | void closeEvent(QCloseEvent *event); 25 | 26 | private: 27 | InputDirPage *inputPage; 28 | FileListPage *filePage; 29 | OutputDirPage *outputPage; 30 | ProgressPage *progressPage; 31 | 32 | QStackedWidget *stackWidget; 33 | QPushButton *nextButton; 34 | QPushButton *prevButton; 35 | QPushButton *cancelButton; 36 | 37 | QString inputFolder; 38 | QString outputFolder; 39 | QStringList files; 40 | }; 41 | 42 | #endif /* EXTRACTWIZARD_H */ 43 | -------------------------------------------------------------------------------- /sgreader/gui/filelistpage.h: -------------------------------------------------------------------------------- 1 | #ifndef FILELISTPAGE_H 2 | #define FILELISTPAGE_H 3 | 4 | #include 5 | 6 | class QListWidget; 7 | 8 | class FileListPage : public QWizardPage { 9 | public: 10 | FileListPage(QWidget *parent); 11 | void initializePage(); 12 | bool validatePage(); 13 | 14 | private: 15 | QListWidget *fileList; 16 | }; 17 | 18 | #endif /* FILELISTPAGE_H */ 19 | -------------------------------------------------------------------------------- /sgreader/gui/inputdirpage.cpp: -------------------------------------------------------------------------------- 1 | #include "inputdirpage.h" 2 | 3 | #include // TODO: specify 4 | 5 | InputDirPage::InputDirPage(QWidget *parent) 6 | : QWizardPage(parent) 7 | { 8 | setTitle("Select the input folder"); 9 | 10 | QLabel *inputDescription = new QLabel( 11 | tr("Choose the folder where the SG2/SG3 files are located that you wish" 12 | " to extract.\n\nFor Caesar 3, this is the installation folder, for" 13 | " the other Citybuilding games it's install_dir\\Data.")); 14 | inputDescription->setWordWrap(true); 15 | 16 | QVBoxLayout *boxlayout = new QVBoxLayout(); 17 | QHBoxLayout *dirlayout = new QHBoxLayout(); 18 | 19 | QLabel *inputLabel = new QLabel(tr("Input folder:")); 20 | inputLineEdit = new QLineEdit(); 21 | QPushButton *browseButton = new QPushButton(tr("Browse...")); 22 | 23 | connect(browseButton, SIGNAL(clicked()), this, SLOT(browseClicked())); 24 | 25 | dirlayout->addWidget(inputLabel); 26 | dirlayout->addWidget(inputLineEdit); 27 | dirlayout->addWidget(browseButton); 28 | 29 | boxlayout->addWidget(inputDescription); 30 | boxlayout->addLayout(dirlayout); 31 | boxlayout->addStretch(); 32 | 33 | setLayout(boxlayout); 34 | 35 | registerField("inputDir*", inputLineEdit); 36 | } 37 | 38 | void InputDirPage::browseClicked() { 39 | QString dirname = QFileDialog::getExistingDirectory(this, 40 | tr("Choose the folder where the .sg2/.sg3 files are located"), inputLineEdit->text()); 41 | 42 | if (!dirname.isEmpty()) { 43 | inputLineEdit->setText(dirname); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /sgreader/gui/inputdirpage.h: -------------------------------------------------------------------------------- 1 | #ifndef INPUTDIRPAGE_H 2 | #define INPUTDIRPAGE_H 3 | 4 | #include 5 | 6 | class QLineEdit; 7 | 8 | class InputDirPage : public QWizardPage { 9 | Q_OBJECT 10 | 11 | public: 12 | InputDirPage(QWidget *parent); 13 | QString inputDir() const; 14 | 15 | private slots: 16 | void browseClicked(); 17 | 18 | private: 19 | QLineEdit *inputLineEdit; 20 | }; 21 | 22 | #endif /* INPUTDIRPAGE_H */ 23 | -------------------------------------------------------------------------------- /sgreader/gui/outputdirpage.h: -------------------------------------------------------------------------------- 1 | #ifndef OUTPUTDIRPAGE_H 2 | #define OUTPUTDIRPAGE_H 3 | 4 | #include 5 | 6 | class QLineEdit; 7 | class QCheckBox; 8 | 9 | class OutputDirPage : public QWizardPage { 10 | Q_OBJECT 11 | 12 | public: 13 | OutputDirPage(QWidget *parent); 14 | void initializePage(); 15 | 16 | private slots: 17 | void browseClicked(); 18 | 19 | private: 20 | QLineEdit *outputLineEdit; 21 | QCheckBox *systemCheckbox; 22 | }; 23 | 24 | #endif /* OUTPUTDIRPAGE_H */ 25 | -------------------------------------------------------------------------------- /sgreader/gui/progresspage.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSPAGE_H 2 | #define PROGRESSPAGE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ExtractThread; 10 | 11 | class ProgressPage : public QWizardPage { 12 | Q_OBJECT 13 | 14 | public: 15 | ProgressPage(QWidget *parent); 16 | void initializePage(); 17 | bool isComplete() const; 18 | bool isBusy() const; 19 | 20 | private slots: 21 | void progressChanged(int image); 22 | void fileChanged(const QString &filename, int numFiles); 23 | void threadFinished(); 24 | void cancelThread(); 25 | 26 | private: 27 | ExtractThread *thread; 28 | QProgressBar *fileProgress; 29 | QProgressBar *imageProgress; 30 | QLabel *fileLabel; 31 | QLabel *imageLabel; 32 | QPushButton *cancelButton; 33 | QTextEdit *errorTextEdit; 34 | }; 35 | 36 | #endif /* PROGRESSPAGE_H */ 37 | -------------------------------------------------------------------------------- /sgreader/icons/sgreader.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/sgreader/icons/sgreader.ico -------------------------------------------------------------------------------- /sgreader/icons/sgreader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gecube/opencaesar3/8f4678951c05cd7302fbdcfe22f5264d94270bfd/sgreader/icons/sgreader.png -------------------------------------------------------------------------------- /sgreader/imagetreeitem.cpp: -------------------------------------------------------------------------------- 1 | #include "imagetreeitem.h" 2 | 3 | ImageTreeItem::ImageTreeItem(QTreeWidget *parent, int id, SgImage *image) 4 | : QTreeWidgetItem(parent, ItemType), imageRecord(image), imageId(id) 5 | { 6 | setColumnData(); 7 | } 8 | 9 | ImageTreeItem::ImageTreeItem(QTreeWidgetItem *parent, int id, SgImage *image) 10 | : QTreeWidgetItem(parent, ItemType), imageRecord(image), imageId(id) 11 | { 12 | setColumnData(); 13 | } 14 | 15 | SgImage *ImageTreeItem::image() { 16 | return imageRecord; 17 | } 18 | 19 | void ImageTreeItem::setColumnData() { 20 | setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); 21 | setText(0, QString("%0: %1").arg(imageId + 1) 22 | .arg(imageRecord->description())); 23 | //setData(0, Qt::DisplayRole, imageId); 24 | //setData(1, Qt::DisplayRole, imageRecord->description()); 25 | setToolTip(0, imageRecord->fullDescription()); 26 | } 27 | -------------------------------------------------------------------------------- /sgreader/imagetreeitem.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGETREEITEM_H 2 | #define IMAGETREEITEM_H 3 | 4 | #include "sgimage.h" 5 | 6 | #include 7 | #include 8 | 9 | class ImageTreeItem : public QTreeWidgetItem { 10 | public: 11 | ImageTreeItem(QTreeWidget *parent, int id, SgImage *image); 12 | ImageTreeItem(QTreeWidgetItem *parent, int id, SgImage *image); 13 | 14 | SgImage *image(); 15 | 16 | static const int ItemType = QTreeWidgetItem::UserType; 17 | 18 | private: 19 | void setColumnData(); 20 | SgImage *imageRecord; 21 | int imageId; 22 | }; 23 | 24 | #endif /* IMAGETREEITEM_H */ 25 | -------------------------------------------------------------------------------- /sgreader/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include // TODO: specify 6 | 7 | #include "sgfile.h" 8 | #include "sgimage.h" 9 | 10 | class QAction; 11 | 12 | class MainWindow : public QMainWindow { 13 | Q_OBJECT 14 | 15 | public: 16 | MainWindow(); 17 | //~MainWindow(); 18 | 19 | 20 | private slots: 21 | void openFile(); 22 | void saveFile(); 23 | void extractAll(); 24 | void treeSelectionChanged(); 25 | //void help(); 26 | void license(); 27 | void about(); 28 | 29 | private: 30 | void createChildren(); 31 | void createMenu(); 32 | void createActions(); 33 | 34 | void loadFile(const QString &filename); 35 | void loadImage(SgImage *image); 36 | void clearImage(); 37 | 38 | QTreeWidget *treeWidget; 39 | QLabel *imageLabel; 40 | QString filename; 41 | QString appname; 42 | QImage image; 43 | SgFile *sgFile; 44 | 45 | QAction *openAction; 46 | QAction *saveAction; 47 | QAction *extractAllAction; 48 | QAction *exitAction; 49 | 50 | QAction *helpAction; 51 | QAction *licenseAction; 52 | QAction *aboutAction; 53 | }; 54 | 55 | #endif /* MAINWINDOW_H */ 56 | -------------------------------------------------------------------------------- /sgreader/sgbitmap.h: -------------------------------------------------------------------------------- 1 | #ifndef SGBITMAP_H 2 | #define SGBITMAP_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class QDataStream; 10 | class QFile; 11 | class SgBitmapRecord; 12 | class SgImage; 13 | 14 | class SgBitmap { 15 | public: 16 | SgBitmap(int id, const QString &sgFilename, QDataStream *stream); 17 | ~SgBitmap(); 18 | int imageCount() const; 19 | QString description() const; 20 | QString bitmapName() const; 21 | QImage getImage(int id); 22 | SgImage *image(int id); 23 | void addImage(SgImage *child); 24 | QFile *openFile(char isExtern); 25 | QString errorMessage(int id) const; 26 | 27 | enum { 28 | RECORD_SIZE = 200 29 | }; 30 | private: 31 | QString find555File(); 32 | QString findFilenameCaseInsensitive(QDir directory, QString filename); 33 | 34 | QList images; 35 | SgBitmapRecord *record; 36 | QFile *file; 37 | QString sgFilename; 38 | int bitmapId; 39 | char isExtern; 40 | }; 41 | 42 | #endif /* SGBITMAP_H */ 43 | -------------------------------------------------------------------------------- /sgreader/sgfile.h: -------------------------------------------------------------------------------- 1 | #ifndef SGFILE_H 2 | #define SGFILE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class SgBitmap; 9 | class SgImage; 10 | class SgHeader; // = header 11 | 12 | class SgFile { 13 | public: 14 | SgFile(const QString &filename); 15 | ~SgFile(); 16 | bool load(); 17 | int bitmapCount() const; 18 | int totalImageCount() const; 19 | int imageCount(int bitmapId) const; 20 | QString basename() const; 21 | 22 | SgBitmap *getBitmap(int bitmapId) const; 23 | QString getBitmapDescription(int bitmapId) const; 24 | 25 | SgImage *image(int bitmapId, int imageId) const; 26 | SgImage *image(int globalImageId) const; 27 | 28 | QImage getImage(int bitmapId, int imageId); 29 | QImage getImage(int globalImageId); 30 | 31 | QString errorMessage(int bitmapId, int imageId) const; 32 | QString errorMessage(int globalImageId) const; 33 | 34 | private: 35 | bool checkVersion(); 36 | int maxBitmapRecords() const; 37 | void loadBitmaps(QDataStream *stream); 38 | void loadImages(QDataStream *stream, bool includeAlpha); 39 | 40 | QList bitmaps; 41 | QList images; 42 | QString filename; 43 | QString basefilename; 44 | SgHeader *header; 45 | }; 46 | 47 | #endif /* SGFILE_H */ 48 | -------------------------------------------------------------------------------- /sgreader/sgreader.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = 3 | CONFIG += qxt 4 | QXT += core gui 5 | DEPENDPATH += . gui 6 | INCLUDEPATH += . gui 7 | OBJECTS_DIR = build/obj 8 | MOC_DIR = build/moc 9 | RCC_DIR = build/rcc 10 | 11 | # Input 12 | HEADERS += aboutdialog.h \ 13 | imagetreeitem.h \ 14 | licensedialog.h \ 15 | mainwindow.h \ 16 | sgbitmap.h \ 17 | sgfile.h \ 18 | sgimage.h \ 19 | gui/filelistpage.h \ 20 | gui/inputdirpage.h \ 21 | gui/outputdirpage.h \ 22 | gui/progresspage.h \ 23 | gui/extractthread.h \ 24 | gui/extractwizard.h 25 | SOURCES += aboutdialog.cpp \ 26 | imagetreeitem.cpp \ 27 | licensedialog.cpp \ 28 | main.cpp \ 29 | mainwindow.cpp \ 30 | sgbitmap.cpp \ 31 | sgfile.cpp \ 32 | sgimage.cpp \ 33 | gui/filelistpage.cpp \ 34 | gui/inputdirpage.cpp \ 35 | gui/outputdirpage.cpp \ 36 | gui/progresspage.cpp \ 37 | gui/extractthread.cpp \ 38 | gui/extractwizard.cpp 39 | RESOURCES += sgreader.qrc 40 | RC_FILE = sgreader.rc 41 | -------------------------------------------------------------------------------- /sgreader/sgreader.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icons/sgreader.png 5 | 6 | 7 | -------------------------------------------------------------------------------- /sgreader/sgreader.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icons/sgreader.ico" 2 | -------------------------------------------------------------------------------- /source/building/buildings.hpp: -------------------------------------------------------------------------------- 1 | #include "wharf.hpp" 2 | #include "warehouse.hpp" -------------------------------------------------------------------------------- /source/building/clay_pit.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CLAY_PIT_H_INCLUDED__ 17 | #define __OPENCAESAR3_CLAY_PIT_H_INCLUDED__ 18 | 19 | #include "factory.hpp" 20 | 21 | class ClayPit : public Factory 22 | { 23 | public: 24 | ClayPit(); 25 | 26 | bool canBuild( CityPtr city, const TilePos& pos ) const; // returns true if it can be built there 27 | void timeStep( const unsigned long time ); 28 | }; 29 | 30 | #endif //__OPENCAESAR3_CLAY_PIT_H_INCLUDED__ 31 | -------------------------------------------------------------------------------- /source/building/education.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_BUILDING_EDUCATION_H_INCLUDE_ 17 | #define _OPENCAESAR3_BUILDING_EDUCATION_H_INCLUDE_ 18 | 19 | #include "building/service.hpp" 20 | 21 | class School : public ServiceBuilding 22 | { 23 | public: 24 | School(); 25 | 26 | int getVisitorsNumber() const; 27 | 28 | virtual void deliverService(); 29 | 30 | virtual unsigned int getWalkerDistance() const; 31 | }; 32 | 33 | class Library : public ServiceBuilding 34 | { 35 | public: 36 | Library(); 37 | 38 | int getVisitorsNumber() const; 39 | }; 40 | 41 | class College : public ServiceBuilding 42 | { 43 | public: 44 | College(); 45 | 46 | int getVisitorsNumber() const; 47 | }; 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /source/building/engineer_post.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_BUILDINGENGINEER_H_INCLUDE_ 17 | #define __OPENCAESAR3_BUILDINGENGINEER_H_INCLUDE_ 18 | 19 | #include "service.hpp" 20 | 21 | class EngineerPost : public ServiceBuilding 22 | { 23 | public: 24 | EngineerPost(); 25 | void timeStep(const unsigned long time); 26 | void deliverService(); 27 | 28 | unsigned int getWalkerDistance() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /source/building/forum.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_FORUM_H_INCLUDED__ 17 | #define __OPENCAESAR3_FORUM_H_INCLUDED__ 18 | 19 | #include "service.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class Forum : public ServiceBuilding 23 | { 24 | public: 25 | Forum(); 26 | 27 | int collectTaxes(); 28 | int getPeoplesReached() const; 29 | 30 | virtual void deliverService(); 31 | virtual void timeStep( const unsigned long time ); 32 | 33 | private: 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | #endif //__OPENCAESAR3_FORUM_H_INCLUDED__ 39 | -------------------------------------------------------------------------------- /source/building/garden.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_GARDEN_H_INCLUDED__ 18 | #define __OPENCAESAR3_GARDEN_H_INCLUDED__ 19 | 20 | #include "game/construction.hpp" 21 | 22 | class Garden : public Construction 23 | { 24 | public: 25 | Garden(); 26 | virtual void initTerrain(Tile& terrain); 27 | virtual bool isWalkable() const; 28 | virtual bool isNeedRoadAccess() const; 29 | virtual void build(CityPtr city, const TilePos& pos ); 30 | virtual void load(const VariantMap &stream); 31 | void update(); 32 | }; 33 | 34 | #endif //__OPENCAESAR3_GARDEN_H_INCLUDED__ 35 | -------------------------------------------------------------------------------- /source/building/granary.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_GRANARY_H_INCLUDED__ 17 | #define __OPENCAESAR3_GRANARY_H_INCLUDED__ 18 | 19 | #include "working.hpp" 20 | 21 | class GoodStore; 22 | class Granary : public WorkingBuilding 23 | { 24 | public: 25 | Granary(); 26 | 27 | virtual void timeStep(const unsigned long time); 28 | void computePictures(); 29 | GoodStore& getGoodStore(); 30 | 31 | virtual void save( VariantMap& stream) const; 32 | virtual void load( const VariantMap& stream); 33 | 34 | private: 35 | void _tryDevastateGranary(); 36 | 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /source/building/marble_quarry.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_FACTORYMARBLE_H_INCLUDED__ 17 | #define __OPENCAESAR3_FACTORYMARBLE_H_INCLUDED__ 18 | 19 | #include "factory.hpp" 20 | 21 | class MarbleQuarry : public Factory 22 | { 23 | public: 24 | MarbleQuarry(); 25 | 26 | virtual bool canBuild(CityPtr city, const TilePos& pos ) const; // returns true if it can be built there 27 | virtual void timeStep(const unsigned long time); 28 | }; 29 | 30 | #endif //__OPENCAESAR3_FACTORYMARBLE_H_INCLUDED__ 31 | -------------------------------------------------------------------------------- /source/building/military.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_MILITARY_BUILDING_H_INCLUDED__ 17 | #define __OPENCAESAR3_MILITARY_BUILDING_H_INCLUDED__ 18 | 19 | #include "working.hpp" 20 | 21 | class Barracks : public WorkingBuilding 22 | { 23 | public: 24 | Barracks(); 25 | }; 26 | 27 | class FortLegionnaire : public Building 28 | { 29 | public: 30 | FortLegionnaire(); 31 | }; 32 | 33 | class FortJaveline : public Building 34 | { 35 | public: 36 | FortJaveline(); 37 | }; 38 | 39 | class FortMounted : public Building 40 | { 41 | public: 42 | FortMounted(); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /source/building/military_academy.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #include "military_academy.hpp" 18 | #include "constants.hpp" 19 | 20 | MilitaryAcademy::MilitaryAcademy() : WorkingBuilding( constants::building::B_MILITARY_ACADEMY, Size(3) ) 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /source/building/military_academy.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ACADEMY_H_INCLUDED__ 17 | #define __OPENCAESAR3_ACADEMY_H_INCLUDED__ 18 | 19 | #include "working.hpp" 20 | 21 | class MilitaryAcademy : public WorkingBuilding 22 | { 23 | public: 24 | MilitaryAcademy(); 25 | }; 26 | 27 | #endif //__OPENCAESAR3_ACADEMY_H_INCLUDED__ 28 | -------------------------------------------------------------------------------- /source/building/pottery.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_FACTORY_POTTERY_H_INCLUDED__ 17 | #define __OPENCAESAR3_FACTORY_POTTERY_H_INCLUDED__ 18 | 19 | #include "factory.hpp" 20 | 21 | class Pottery : public Factory 22 | { 23 | public: 24 | Pottery(); 25 | 26 | virtual bool canBuild(CityPtr city, const TilePos &pos) const; 27 | virtual void timeStep(const unsigned long time); 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /source/building/prefecture.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_BUILDINGPREFECT_H_INCLUDED__ 17 | #define __OPENCAESAR3_BUILDINGPREFECT_H_INCLUDED__ 18 | 19 | #include "service.hpp" 20 | #include "core/position.hpp" 21 | 22 | class Prefecture : public ServiceBuilding 23 | { 24 | public: 25 | Prefecture(); 26 | void timeStep(const unsigned long time); 27 | void deliverService(); 28 | int getServiceDelay() const; 29 | 30 | void fireDetect( const TilePos& pos ); 31 | 32 | private: 33 | TilePos _fireDetect; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /source/building/senate.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SENATE_H_INCLUDED_ 17 | #define __OPENCAESAR3_SENATE_H_INCLUDED_ 18 | 19 | #include "service.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class Senate : public ServiceBuilding 23 | { 24 | public: 25 | Senate(); 26 | unsigned int getFunds() const; 27 | 28 | int collectTaxes(); 29 | int getPeoplesReached() const; 30 | 31 | virtual std::string getError() const; 32 | 33 | void deliverService(); 34 | 35 | bool canBuild(CityPtr city, const TilePos& pos )const; 36 | private: 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /source/building/warehouse.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef WAREHOUSE_HPP 20 | #define WAREHOUSE_HPP 21 | 22 | #include "working.hpp" 23 | #include "game/enums.hpp" 24 | #include "game/good.hpp" 25 | #include "core/position.hpp" 26 | 27 | class GoodStore; 28 | 29 | class Warehouse: public WorkingBuilding 30 | { 31 | friend class WarehouseStore; 32 | 33 | public: 34 | Warehouse(); 35 | 36 | virtual void timeStep(const unsigned long time); 37 | void computePictures(); 38 | GoodStore& getGoodStore(); 39 | 40 | virtual void save(VariantMap& stream) const; 41 | virtual void load(const VariantMap& stream); 42 | 43 | private: 44 | void _resolveDevastationMode(); 45 | 46 | class Impl; 47 | ScopedPtr< Impl > _d; 48 | }; 49 | 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /source/building/well.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_WELL_H_INCLUDED__ 17 | #define __OPENCAESAR3_WELL_H_INCLUDED__ 18 | 19 | #include "service.hpp" 20 | 21 | class Well : public ServiceBuilding 22 | { 23 | public: 24 | Well(); 25 | 26 | virtual void deliverService(); 27 | 28 | virtual bool isNeedRoadAccess() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /source/core/alignment.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "core/alignment.hpp" 17 | 18 | 19 | AlignHelper::AlignHelper() : EnumsHelper( alignAuto ) 20 | { 21 | append( alignUpperLeft, "upperLeft" ); 22 | append( alignLowerRight, "lowerRight" ); 23 | append( alignCenter, "center" ); 24 | append( alignScale, "scale" ); 25 | append( alignAuto, "auto" ); 26 | } 27 | -------------------------------------------------------------------------------- /source/core/alignment.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ALIGNMENT_H_INCLUDED__ 17 | #define __OPENCAESAR3_ALIGNMENT_H_INCLUDED__ 18 | 19 | #include "enumerator.hpp" 20 | 21 | enum TypeAlign 22 | { 23 | //! Aligned to parent's top or left side (default) 24 | alignUpperLeft=0, 25 | //! Aligned to parent's bottom or right side 26 | alignLowerRight, 27 | //! Aligned to the center of parent 28 | alignCenter, 29 | //! Stretched to fit parent 30 | alignScale, 31 | //! 32 | alignAuto 33 | }; 34 | 35 | class AlignHelper : public EnumsHelper 36 | { 37 | public: 38 | AlignHelper(); 39 | }; 40 | 41 | #endif // __NRP_ALIGNMENT_H_INCLUDED__ 42 | 43 | -------------------------------------------------------------------------------- /source/core/bytearray.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_BYTEARRAY_H_INCLUDED__ 17 | #define __OPENCAESAR3_BYTEARRAY_H_INCLUDED__ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | class ByteArray : public std::vector 24 | { 25 | public: 26 | ByteArray() 27 | { 28 | 29 | } 30 | 31 | ByteArray& operator=( const std::string& str ) 32 | { 33 | resize( str.size() + 1, 0 ); 34 | memcpy( &(*this)[0], str.c_str(), str.size() ); 35 | return *this; 36 | } 37 | 38 | const char* data() const 39 | { 40 | return &(*this)[0]; 41 | } 42 | 43 | char* data() 44 | { 45 | return &(*this)[0]; 46 | } 47 | }; 48 | 49 | #endif //__OPENCAESAR3_BYTEARRAY_H_INCLUDED__ -------------------------------------------------------------------------------- /source/core/direction.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef _OPENCAESAR3_DIRECTION_INCLUDE_H_ 18 | #define _OPENCAESAR3_DIRECTION_INCLUDE_H_ 19 | 20 | namespace constants 21 | { 22 | 23 | typedef enum 24 | { 25 | noneDirection, 26 | north, 27 | northWest, 28 | west, 29 | southWest, 30 | south, 31 | southEast, 32 | east, 33 | northEast, 34 | countDirection 35 | } Direction; 36 | 37 | } //end namespace constants 38 | 39 | #endif //_OPENCAESAR3_DIRECTION_INCLUDE_H_ 40 | -------------------------------------------------------------------------------- /source/core/eventconverter.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_EVENTCONVERTER_H_INCLUDE_ 18 | #define __OPENCAESAR3_EVENTCONVERTER_H_INCLUDE_ 19 | 20 | #include "event.hpp" 21 | #include 22 | #include 23 | 24 | class EventConverter 25 | { 26 | public: 27 | static EventConverter& instance(); 28 | ~EventConverter(); 29 | 30 | NEvent get( const SDL_Event& event ); 31 | 32 | private: 33 | class Impl; 34 | std::auto_ptr< Impl > _d; 35 | 36 | EventConverter(); 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /source/core/exception.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef EXCEPTION_HPP 20 | #define EXCEPTION_HPP 21 | 22 | 23 | #include 24 | 25 | #define THROW(x) { std::stringstream _exception_text; _exception_text << x; throw Exception(_exception_text.str()); } 26 | 27 | 28 | class Exception 29 | { 30 | public: 31 | Exception(const std::string &aDescription) 32 | { 33 | _desc = aDescription; 34 | }; 35 | 36 | ~Exception() {}; 37 | 38 | const std::string& getDescription() const 39 | { 40 | return _desc; 41 | } 42 | 43 | private: 44 | std::string _desc; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /source/core/flagholder.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCAESAR3_FLAGHOLDER_H_INCLUDE_ 2 | #define __OPENCAESAR3_FLAGHOLDER_H_INCLUDE_ 3 | 4 | template< class T > 5 | class FlagHolder 6 | { 7 | public: 8 | FlagHolder() : _flags( 0 ) {} 9 | 10 | void setFlag( T flag, bool enabled=true ) 11 | { 12 | if( enabled ) 13 | _flags |= flag; 14 | else 15 | _flags &= ~flag; 16 | } 17 | 18 | void resetFlag( T flag ) 19 | { 20 | setFlag( flag, false ); 21 | } 22 | 23 | bool isFlag( T flag ) const 24 | { 25 | return (_flags & flag) > 0; 26 | } 27 | 28 | void setFlags( int val ) 29 | { 30 | _flags = val; 31 | } 32 | private: 33 | 34 | int _flags; 35 | }; 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /source/core/gettext.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef GETTEXT_HPP 20 | #define GETTEXT_HPP 21 | 22 | #include 23 | #define _(x) gettext(x) 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /source/core/logger.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "logger.hpp" 17 | #include "requirements.hpp" 18 | #include "stringhelper.hpp" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | void Logger::warning( const char* fmt, ... ) 31 | { 32 | va_list argument_list; 33 | va_start(argument_list, fmt); 34 | 35 | std::string ret; 36 | StringHelper::vformat( ret, 512, fmt, argument_list ); 37 | 38 | va_end(argument_list); 39 | 40 | std::cout << ret << std::endl; 41 | } 42 | 43 | void Logger::redirect(std::string filename ) 44 | { 45 | std::ofstream* file = new std::ofstream(); 46 | 47 | file->open("stdout.txt"); 48 | std::cout.rdbuf( file->rdbuf() ); // перенапраляем в файл 49 | } 50 | 51 | -------------------------------------------------------------------------------- /source/core/logger.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LOGGER_H_INCLUDED__ 17 | #define __OPENCAESAR3_LOGGER_H_INCLUDED__ 18 | 19 | #include 20 | 21 | class Logger 22 | { 23 | public: 24 | static void warning( const char* fmt, ...); 25 | 26 | static void redirect( std::string filename ); 27 | }; 28 | 29 | #endif //__OPENCAESAR3_LOGGER_H_INCLUDED__ 30 | -------------------------------------------------------------------------------- /source/core/safetycast.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_SAFETY_CAST_INCLUDE_ 18 | #define __OPENCAESAR3_SAFETY_CAST_INCLUDE_ 19 | 20 | #include 21 | 22 | template 23 | inline T safety_cast( B object ) throw() 24 | { 25 | try 26 | { 27 | return dynamic_cast(object); 28 | } 29 | #if defined(OC3_PLATFORM_WIN) && !defined(OC3_USE_MINGW_COMPILER) 30 | catch(std::__non_rtti_object ) 31 | { 32 | //LOGIT(pfEmerg, "cast(0x%p): __non_rtti_object exception has caught: '%s'\n", object, e.what()); 33 | return 0; 34 | } 35 | #else 36 | catch(std::bad_cast) 37 | { 38 | return 0; 39 | } 40 | #endif 41 | catch(...) 42 | { 43 | //LOGIT(pfEmerg, "cast(0x%p): an unknown exception has caught.\n", object); 44 | return 0; 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /source/core/saveadapter.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SAVEADAPTER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SAVEADAPTER_H_INCLUDED__ 18 | 19 | #include "core/variant.hpp" 20 | #include "vfs/filepath.hpp" 21 | 22 | class SaveAdapter 23 | { 24 | public: 25 | static VariantMap load( const io::FilePath& fileName ); 26 | 27 | static bool save( const VariantMap& options, const io::FilePath& filename ); 28 | private: 29 | SaveAdapter(); 30 | }; 31 | 32 | #endif //__OPENCAESAR3_SAVEADAPTER_H_INCLUDED__ 33 | -------------------------------------------------------------------------------- /source/core/serializer.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | #include "serializer.hpp" 19 | 20 | const char* Serializable::damageLevel = "damageLevel"; 21 | const char* Serializable::fireLevel = "fireLevel"; 22 | 23 | -------------------------------------------------------------------------------- /source/core/serializer.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | #ifndef __OPENCAESAR3_SERIALIZABLE_H_INCLUDED__ 19 | #define __OPENCAESAR3_SERIALIZABLE_H_INCLUDED__ 20 | 21 | class VariantMap; 22 | 23 | class Serializable 24 | { 25 | public: 26 | static const char* damageLevel; 27 | static const char* fireLevel; 28 | // read/write self on stream 29 | virtual void save( VariantMap& options ) const = 0; 30 | virtual void load( const VariantMap& options ) = 0; 31 | }; 32 | 33 | 34 | #endif //__OPENCAESAR3_SERIALIZABLE_H_INCLUDED__ 35 | -------------------------------------------------------------------------------- /source/core/stringarray.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_STRINGARRAY_H_INCLUDED__ 17 | #define __OPENCAESAR3_STRINGARRAY_H_INCLUDED__ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | class StringArray : public std::vector< std::string > 24 | { 25 | public: 26 | std::string rand() const 27 | { 28 | return empty() ? "" : at( std::rand() % size() ); 29 | } 30 | }; 31 | 32 | #endif //__OPENCAESAR3_STRINGARRAY_H_INCLUDED__ 33 | -------------------------------------------------------------------------------- /source/events/setvideooptions.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR_EVENT_SETVIDEOOPTIONS_H_INCLUDE_ 17 | #define _OPENCAESAR_EVENT_SETVIDEOOPTIONS_H_INCLUDE_ 18 | 19 | #include "event.hpp" 20 | 21 | namespace events 22 | { 23 | 24 | class SetVideoSettings : public GameEvent 25 | { 26 | public: 27 | static GameEventPtr create(); 28 | virtual void exec( Game& game ); 29 | 30 | private: 31 | void _setResolution(Size); 32 | void _setFullscreen(bool); 33 | }; 34 | 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /source/events/showfeastwindow.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR_EVENT_SHOWFEASTWINDOW_H_INCLUDE_ 17 | #define _OPENCAESAR_EVENT_SHOWFEASTWINDOW_H_INCLUDE_ 18 | 19 | #include "event.hpp" 20 | 21 | namespace events 22 | { 23 | 24 | class ShowFeastWindow : public GameEvent 25 | { 26 | public: 27 | static GameEventPtr create(std::string text, std::string title, std::string receiver); 28 | virtual void exec( Game& game ); 29 | 30 | private: 31 | std::string _text; 32 | std::string _title; 33 | std::string _receiver; 34 | }; 35 | 36 | } 37 | 38 | #endif //_OPENCAESAR_EVENT_SHOWFEASTWINDOW_H_INCLUDE_ 39 | -------------------------------------------------------------------------------- /source/game/abstractloader.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SCENARIOABSTRACTLOADER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SCENARIOABSTRACTLOADER_H_INCLUDED__ 18 | 19 | #include "core/referencecounted.hpp" 20 | 21 | class Game; 22 | 23 | class GameAbstractLoader : public ReferenceCounted 24 | { 25 | public: 26 | virtual ~GameAbstractLoader() {} 27 | virtual bool load( const std::string& filename, Game& oScenario ) = 0; 28 | virtual bool isLoadableFileExtension( const std::string& filename ) = 0; 29 | //virtual bool isLoadableFileFormat( file ) = 0; 30 | }; 31 | 32 | 33 | #endif //__OPENCAESAR3_SCENARIOABSTRACTLOADER_H_INCLUDED__ 34 | -------------------------------------------------------------------------------- /source/game/alarm_event_holder.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ALARM_EVENT_HOLDER_H_INCLUDED__ 17 | #define __OPENCAESAR3_ALARM_EVENT_HOLDER_H_INCLUDED__ 18 | 19 | #include "core/scopedptr.hpp" 20 | #include "core/position.hpp" 21 | #include "core/signals.hpp" 22 | 23 | #include 24 | 25 | class AlarmEventHolder 26 | { 27 | public: 28 | AlarmEventHolder(); 29 | 30 | ~AlarmEventHolder(); 31 | 32 | void add(TilePos pos, std::string message ); 33 | void next(); 34 | 35 | bool haveAlarms() const; 36 | TilePos getCurrentPos() const; 37 | std::string getCurrentMessage() const; 38 | 39 | oc3_signals public: 40 | Signal1& onAlarmChange(); 41 | Signal1& onMoveToAlarm(); 42 | 43 | private: 44 | class Impl; 45 | ScopedPtr< Impl > _d; 46 | }; 47 | 48 | #endif //__OPENCAESAR3_ALARM_EVENT_HOLDER_H_INCLUDED__ 49 | -------------------------------------------------------------------------------- /source/game/astarpathfinding.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCAESAR3_ASTARPATHFINDING_H_INCLUDED__ 2 | #define __OPENCAESAR3_ASTARPATHFINDING_H_INCLUDED__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "core/scopedptr.hpp" 9 | 10 | class Tilemap; 11 | class TilePos; 12 | class Pathway; 13 | class AStarPoint; 14 | class Size; 15 | class Tile; 16 | 17 | class Pathfinder 18 | { 19 | public: 20 | typedef enum { noFlags=0x0, checkStart=0x1, checkStop=0x2, roadOnly=0x4, waterOnly=0x8, 21 | terrainOnly=0x10, traversePath=0x20, everyWhere=0x80 } Flags; 22 | static const AStarPoint invalidPoint; 23 | static Pathfinder& getInstance(); 24 | 25 | void update( const Tilemap& tmap ); 26 | 27 | bool getPath( const TilePos& start, const TilePos& stop, 28 | Pathway& oPathWay, int flags, 29 | const Size& arrivedArea ); 30 | 31 | bool getPath( const Tile& start, const Tile& stop, 32 | Pathway& oPathWay, int flags, 33 | const Size& arrivedArea ); 34 | 35 | unsigned int getMaxLoopCount() const; 36 | 37 | ~Pathfinder(); 38 | private: 39 | Pathfinder(); 40 | 41 | bool aStar( const TilePos& start, const TilePos& stop, const Size& arrivedArea, Pathway& oPathWay, int flags ); 42 | 43 | class Impl; 44 | ScopedPtr< Impl > _d; 45 | }; 46 | 47 | 48 | #endif //__OPENCAESAR3_ASTARPATHFINDING_H_INCLUDED__ 49 | -------------------------------------------------------------------------------- /source/game/citizen_group.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR_HOUSE_HABITANT_INCLUDE_H_ 17 | #define _OPENCAESAR_HOUSE_HABITANT_INCLUDE_H_ 18 | 19 | #include "core/variant.hpp" 20 | 21 | class CitizenGroup : public std::map< int, int > 22 | { 23 | public: 24 | typedef enum { newborn=0, child, scholar, student, mature, aged, longliver=99 } Age; 25 | typedef enum { childMin=2, matureMin=21 } AgeRange; 26 | 27 | int count() const; 28 | int count( Age group ) const; 29 | 30 | CitizenGroup retrieve( int count ); 31 | 32 | CitizenGroup& operator += ( const CitizenGroup& b ); 33 | 34 | VariantList save() const; 35 | void load( const VariantList& stream ); 36 | }; 37 | 38 | #endif //_OPENCAESAR_HOUSE_HABITANT_INCLUDE_H_ 39 | -------------------------------------------------------------------------------- /source/game/cityservice.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_H_INCLUDED__ 18 | 19 | #include "core/referencecounted.hpp" 20 | #include "core/smartptr.hpp" 21 | 22 | class CityService : public ReferenceCounted 23 | { 24 | public: 25 | virtual void update( const unsigned int time ) = 0; 26 | 27 | virtual std::string getName() const { return _name; } 28 | virtual bool isDeleted() const { return false; } 29 | 30 | virtual void destroy() {} 31 | 32 | protected: 33 | CityService( const std::string& name ) : _name( name ) 34 | { 35 | } 36 | 37 | protected: 38 | std::string _name; 39 | }; 40 | 41 | typedef SmartPtr CityServicePtr; 42 | 43 | #endif//__OPENCAESAR3_CITYSERVICE_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/game/cityservice_animals.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_ANIMALS_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_ANIMALS_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceAnimals : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceAnimals(); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_ANIMALS_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_culture.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_CULTURE_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_CULTURE_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceCulture : public CityService 24 | { 25 | public: 26 | typedef enum { ccSchool, ccLibrary, ccAcademy, ccReligion, ccTheatres } Coverage; 27 | static CityServicePtr create( CityPtr city ); 28 | 29 | void update( const unsigned int time ); 30 | int getValue() const; 31 | 32 | int getCoverage( Coverage type ) const; 33 | 34 | static std::string getDefaultName(); 35 | 36 | private: 37 | CityServiceCulture( CityPtr city ); 38 | 39 | class Impl; 40 | ScopedPtr< Impl > _d; 41 | }; 42 | 43 | #endif //__OPENCAESAR3_CITYSERVICE_CULTURE_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/game/cityservice_disorder.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_DISORDER_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_DISORDER_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceDisorder : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | private: 30 | CityServiceDisorder( CityPtr city ); 31 | 32 | class Impl; 33 | ScopedPtr< Impl > _d; 34 | }; 35 | 36 | #endif //__OPENCAESAR3_CITYSERVICE_DISORDER_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/game/cityservice_emigrant.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_EMIGRANT_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_EMIGRANT_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceEmigrant : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceEmigrant( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /source/game/cityservice_fishplace.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_FISHPLACE_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_FISHPLACE_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceFishPlace : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceFishPlace( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_FISHPLACE_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_info.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_INFO_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_INFO_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceInfo : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceInfo( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_INFO_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_religion.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_RELIGION_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_RELIGION_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceReligion : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceReligion( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_RELIGION_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_roads.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_ROADS_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_ROADS_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceRoads : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | ~CityServiceRoads(); 30 | private: 31 | CityServiceRoads( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_ROADS_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_shoreline.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_SHORELINE_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_SHORELINE_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/predefinitions.hpp" 21 | #include "core/scopedptr.hpp" 22 | 23 | class CityServiceShoreline : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | 30 | private: 31 | CityServiceShoreline( CityPtr city ); 32 | 33 | class Impl; 34 | ScopedPtr< Impl > _d; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_CITYSERVICE_SHORELINE_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/game/cityservice_timers.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_TIMERS_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_TIMERS_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "timer.hpp" 21 | 22 | class CityServiceTimers : public CityService 23 | { 24 | public: 25 | static CityServiceTimers& getInstance(); 26 | 27 | void update( const unsigned int time ); 28 | void addTimer( TimerPtr timer ); 29 | 30 | ~CityServiceTimers(); 31 | private: 32 | CityServiceTimers(); 33 | 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | 39 | #endif //__OPENCAESAR3_CITYSERVICE_TIMERS_H_INCLUDED__ 40 | -------------------------------------------------------------------------------- /source/game/cityservice_water.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "cityservice_water.hpp" 17 | #include "city.hpp" 18 | 19 | class CityServiceWater::Impl 20 | { 21 | public: 22 | CityPtr city; 23 | }; 24 | 25 | CityServicePtr CityServiceWater::create( CityPtr city ) 26 | { 27 | CityServiceWater* ret = new CityServiceWater( city ); 28 | 29 | return CityServicePtr( ret ); 30 | } 31 | 32 | CityServiceWater::CityServiceWater( CityPtr city ) 33 | : CityService( "water" ), _d( new Impl ) 34 | { 35 | _d->city = city; 36 | } 37 | 38 | void CityServiceWater::update( const unsigned int time ) 39 | { 40 | if( time % 22 != 1 ) 41 | return; 42 | 43 | //unsigned int vacantPop=0; 44 | } 45 | -------------------------------------------------------------------------------- /source/game/cityservice_water.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_WATER_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_WATER_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | class CityServiceWater : public CityService 24 | { 25 | public: 26 | static CityServicePtr create( CityPtr city ); 27 | 28 | void update( const unsigned int time ); 29 | private: 30 | CityServiceWater( CityPtr city ); 31 | 32 | class Impl; 33 | ScopedPtr< Impl > _d; 34 | }; 35 | 36 | #endif //__OPENCAESAR3_CITYSERVICE_WATER_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/game/cityservice_workershire.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_CITYSERVICE_WORKERSHIRE_H_INCLUDED__ 17 | #define __OPENCAESAR3_CITYSERVICE_WORKERSHIRE_H_INCLUDED__ 18 | 19 | #include "cityservice.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "gfx/tileoverlay.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | class CityServiceWorkersHire : public CityService 25 | { 26 | public: 27 | static CityServicePtr create( CityPtr city ); 28 | 29 | void update( const unsigned int time ); 30 | private: 31 | CityServiceWorkersHire( CityPtr city ); 32 | 33 | void _hireByType( const TileOverlay::Type type ); 34 | bool _haveHr( WorkingBuildingPtr building ); 35 | 36 | class Impl; 37 | ScopedPtr< Impl > _d; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /source/game/constants.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef _OPENCAESAR3_GAME_CONSTANTS_INCLUDE_H_ 20 | #define _OPENCAESAR3_GAME_CONSTANTS_INCLUDE_H_ 21 | 22 | #include "building/constants.hpp" 23 | 24 | namespace constants 25 | { 26 | 27 | namespace place 28 | { 29 | const TileOverlay::Type fishPlace=100; 30 | } 31 | 32 | } 33 | 34 | #endif //_OPENCAESAR3_GAME_CONSTANTS_INCLUDE_H_ 35 | -------------------------------------------------------------------------------- /source/game/fish_place.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_FISHPLACE_H_INCLUDE_ 17 | #define _OPENCAESAR3_FISHPLACE_H_INCLUDE_ 18 | 19 | #include "gfx/tileoverlay.hpp" 20 | 21 | class FishPlace : public TileOverlay 22 | { 23 | public: 24 | FishPlace(); 25 | ~FishPlace(); 26 | 27 | virtual void build(CityPtr city, const TilePos &pos); 28 | virtual void initTerrain(Tile &terrain); 29 | virtual void timeStep(const unsigned long time); 30 | virtual void destroy(); 31 | 32 | const PicturesArray& getPictures(Renderer::Pass pass) const; 33 | Renderer::PassQueue getPassQueue() const; 34 | 35 | private: 36 | 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | #endif //_OPENCAESAR3_FISHPLACE_H_INCLUDE_ 42 | -------------------------------------------------------------------------------- /source/game/gamedate.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_GAMEDATE_H_INCLUDED__ 17 | #define __OPENCAESAR3_GAMEDATE_H_INCLUDED__ 18 | 19 | #include "core/time.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class GameDate 23 | { 24 | public: 25 | static DateTime current(); 26 | 27 | static void timeStep( unsigned int time ); 28 | 29 | static void init( const DateTime& date ); 30 | 31 | static GameDate& instance(); 32 | 33 | ~GameDate(); 34 | 35 | private: 36 | GameDate(); 37 | 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /source/game/goodhelper.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_GOODHELPER_H_INCLUDED__ 18 | #define __OPENCAESAR3_GOODHELPER_H_INCLUDED__ 19 | 20 | #include "core/scopedptr.hpp" 21 | #include "gfx/picture.hpp" 22 | #include "good.hpp" 23 | #include "core/direction.hpp" 24 | 25 | class GoodStock; 26 | 27 | class GoodHelper 28 | { 29 | public: 30 | static GoodHelper& getInstance(); 31 | 32 | static std::string getName( Good::Type type ); 33 | static Picture getPicture( Good::Type type, bool emp=false ); 34 | static Good::Type getType( const std::string& name ); 35 | static std::string getTypeName( Good::Type type ); 36 | static Picture getCartPicture( const GoodStock& stock, constants::Direction direction ); 37 | ~GoodHelper(); 38 | private: 39 | GoodHelper(); 40 | 41 | class Impl; 42 | ScopedPtr< Impl > _d; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /source/game/goodorders.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_GOODORDERS_H_INCLUDED__ 17 | #define __OPENCAESAR3_GOODORDERS_H_INCLUDED__ 18 | 19 | #include "good.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class GoodOrders 23 | { 24 | public: 25 | typedef enum { accept=0, reject, deliver, none } Order; 26 | 27 | GoodOrders(); 28 | ~GoodOrders(); 29 | 30 | void set( const Good::Type type, Order rule ); 31 | void set( Order rule ); 32 | Order get( const Good::Type type ); 33 | 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | #endif //__OPENCAESAR3_GOODORDERS_H_INCLUDED__ 40 | -------------------------------------------------------------------------------- /source/game/infoboxmanager.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCAESAR3_INFOBOX_MANAGER_H_INCLUDE_ 2 | #define __OPENCAESAR3_INFOBOX_MANAGER_H_INCLUDE_ 3 | 4 | #include "core/smartptr.hpp" 5 | #include "core/referencecounted.hpp" 6 | #include "core/scopedptr.hpp" 7 | #include "core/predefinitions.hpp" 8 | #include "enums.hpp" 9 | #include "gui/info_box.hpp" 10 | 11 | class InfoBoxManager; 12 | typedef SmartPtr< InfoBoxManager > InfoBoxManagerPtr; 13 | 14 | class InfoboxCreator 15 | { 16 | public: 17 | virtual gui::InfoBoxSimple* create( gui::Widget*, const Tile& ) = 0; 18 | }; 19 | 20 | class InfoBoxManager : public ReferenceCounted 21 | { 22 | public: 23 | static InfoBoxManagerPtr create( CityPtr city, gui::GuiEnv* gui ); 24 | 25 | void showHelp( const Tile& tile ); 26 | void setShowDebugInfo( const bool showInfo ); 27 | 28 | void addInfobox( const TileOverlay::Type type, const std::string& typeName, InfoboxCreator* ctor ); 29 | bool canCreate( const TileOverlay::Type type ) const; 30 | private: 31 | InfoBoxManager( CityPtr city, gui::GuiEnv* gui ); 32 | ~InfoBoxManager(); 33 | 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /source/game/loader.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef SCENARIO_LOADER_HPP 20 | #define SCENARIO_LOADER_HPP 21 | 22 | #include "core/scopedptr.hpp" 23 | #include "vfs/filepath.hpp" 24 | 25 | class Game; 26 | 27 | class GameLoader 28 | { 29 | public: 30 | GameLoader(); 31 | ~GameLoader(); 32 | 33 | bool load(const io::FilePath& filename, Game& game); 34 | 35 | private: 36 | class Impl; 37 | ScopedPtr< Impl > _d; 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /source/game/loader_map.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SCENARIOMAP_LOADER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SCENARIOMAP_LOADER_H_INCLUDED__ 18 | 19 | #include "abstractloader.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class GameLoaderC3Map : public GameAbstractLoader 23 | { 24 | public: 25 | GameLoaderC3Map(); 26 | 27 | bool load(const std::string& filename, Game& game); 28 | bool isLoadableFileExtension( const std::string& filename ); 29 | 30 | private: 31 | class Impl; 32 | ScopedPtr< Impl > _d; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /source/game/loader_oc3mission.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SCENARIO_OC3MISSION_LOADER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SCENARIO_OC3MISSION_LOADER_H_INCLUDED__ 18 | 19 | #include "abstractloader.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class GameLoaderMission : public GameAbstractLoader 23 | { 24 | public: 25 | GameLoaderMission(); 26 | 27 | bool load(const std::string& filename, Game& oScenario); 28 | bool isLoadableFileExtension( const std::string& filename ); 29 | 30 | private: 31 | class Impl; 32 | ScopedPtr< Impl > _d; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /source/game/loader_oc3save.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SCENARIO_OC3SAVE_LOADER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SCENARIO_OC3SAVE_LOADER_H_INCLUDED__ 18 | 19 | #include "abstractloader.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class Game; 23 | 24 | class GameLoaderOc3 : public GameAbstractLoader 25 | { 26 | public: 27 | bool load(const std::string& filename, Game &game); 28 | bool isLoadableFileExtension( const std::string& filename ); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /source/game/loader_sav.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SCENARIOSAV_LOADER_H_INCLUDED__ 17 | #define __OPENCAESAR3_SCENARIOSAV_LOADER_H_INCLUDED__ 18 | 19 | #include "abstractloader.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class GameLoaderC3Sav : public GameAbstractLoader 23 | { 24 | public: 25 | GameLoaderC3Sav(); 26 | 27 | bool load(const std::string& filename, Game& game); 28 | bool isLoadableFileExtension( const std::string& filename ); 29 | 30 | private: 31 | class Impl; 32 | ScopedPtr< Impl > _d; 33 | }; 34 | 35 | #endif // __OPENCAESAR3_SCENARIOSAV_LOADER_H_INCLUDED__ 36 | -------------------------------------------------------------------------------- /source/game/name_generator.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_NAME_GENERATOR_H_INCLUDED__ 17 | #define __OPENCAESAR3_NAME_GENERATOR_H_INCLUDED__ 18 | 19 | #include "core/scopedptr.hpp" 20 | #include "vfs/filepath.hpp" 21 | 22 | class NameGenerator 23 | { 24 | public: 25 | typedef enum { male=0, female, 26 | patricianMale, patricianFemale } NameType; 27 | static NameGenerator& instance(); 28 | 29 | ~NameGenerator(); 30 | 31 | static std::string rand( NameType type ); 32 | static void initialize( const io::FilePath& filename ); 33 | 34 | private: 35 | NameGenerator(); 36 | 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | #endif //__OPENCAESAR3_NAME_GENERATOR_H_INCLUDED__ 42 | -------------------------------------------------------------------------------- /source/game/pathway_helper.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PATHWAYHELPER_H_INCLUDED__ 17 | #define __OPENCAESAR3_PATHWAYHELPER_H_INCLUDED__ 18 | 19 | #include "pathway.hpp" 20 | 21 | class PathwayHelper 22 | { 23 | public: 24 | typedef enum { roadOnly=0, allTerrain, roadFirst } WayType; 25 | static Pathway create(CityPtr city, 26 | TilePos startPos, TilePos stopPos, 27 | WayType type=roadOnly, Size arrivedArea=Size(1)); 28 | 29 | static Pathway randomWay( CityPtr city, TilePos startPos, int walkRadius ); 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /source/game/roadbuild_helper.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_ROADPROPAGATOR_H_INCLUDE_ 18 | #define __OPENCAESAR3_ROADPROPAGATOR_H_INCLUDE_ 19 | 20 | #include "core/scopedptr.hpp" 21 | #include "tilemap.hpp" 22 | 23 | class Tilemap; 24 | 25 | class RoadPropagator 26 | { 27 | public: 28 | /** finds the shortest path between origin and destination 29 | * returns True if a path exists 30 | * the path is returned in oPathWay 31 | */ 32 | static ConstTilemapWay createPath( const Tilemap& tileMap, const Tile& startTile, const Tile& destination ); 33 | }; 34 | 35 | #endif //__OPENCAESAR3_ROADPROPAGATOR_H_INCLUDE_ 36 | -------------------------------------------------------------------------------- /source/game/route.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_APPOINTEDWAY_H_INCLUDE_ 17 | #define _OPENCAESAR3_APPOINTEDWAY_H_INCLUDE_ 18 | 19 | #include "oc3_pathway.hpp" 20 | #include 21 | 22 | class RouteMap : public std::map 23 | { 24 | public: 25 | }; 26 | 27 | class Route : public std::pair 28 | { 29 | public: 30 | Route() {} 31 | 32 | Route( const RouteMap::value_type& a ) 33 | { 34 | *this = a; 35 | } 36 | 37 | Route& operator=(const RouteMap::value_type& a) 38 | { 39 | first = a.first; 40 | second = a.second; 41 | 42 | return *this; 43 | } 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /source/game/saver.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef _OPENCAESAR3_SCENARIO_OC3SAVE_SAVER_H_INCLUDE_ 20 | #define _OPENCAESAR3_SCENARIO_OC3SAVE_SAVER_H_INCLUDE_ 21 | 22 | #include "vfs/filepath.hpp" 23 | #include "core/scopedptr.hpp" 24 | 25 | class Game; 26 | 27 | class GameSaver 28 | { 29 | public: 30 | void save( const io::FilePath& filename, const Game& game ); 31 | }; 32 | 33 | 34 | #endif //_OPENCAESAR3_SCENARIO_OC3SAVE_SAVER_H_INCLUDE_ 35 | -------------------------------------------------------------------------------- /source/game/screen_wait.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SCREEN_WAIT_HPP 2 | #define SCREEN_WAIT_HPP 3 | 4 | #include "screen.hpp" 5 | #include 6 | 7 | class GfxEngine; 8 | class GuiEnv; 9 | 10 | // displays a background image 11 | class ScreenWait: public Screen 12 | { 13 | public: 14 | ScreenWait(); 15 | ~ScreenWait(); 16 | 17 | void initialize(); 18 | 19 | virtual void draw(); 20 | 21 | protected: 22 | int getResult() const; 23 | 24 | private: 25 | class Impl; 26 | std::auto_ptr< Impl > _d; 27 | }; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /source/gfx/layerconstants.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERCONSTANTS_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERCONSTANTS_H_INCLUDED__ 18 | 19 | namespace constants 20 | { 21 | 22 | namespace citylayer 23 | { 24 | enum { simple=0, water, fire, damage, desirability, 25 | entertainments, entertainmentAll, theater, amphitheater, colloseum, hippodrome, 26 | health, doctor, hospital, barber, baths, 27 | food, 28 | religion, 29 | risks, crime, aborigen, troubles, 30 | education, educationAll, school, library, academy, 31 | commerce, tax, 32 | all 33 | }; 34 | } 35 | 36 | } 37 | 38 | #endif //__OPENCAESAR3_LAYERCONSTANTS_H_INCLUDED__ 39 | -------------------------------------------------------------------------------- /source/gfx/layercrime.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERCRIME_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERCRIME_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerCrime : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual VisibleWalkers getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | }; 34 | 35 | #endif //__OPENCAESAR3_LAYERCRIME_H_INCLUDED__ 36 | -------------------------------------------------------------------------------- /source/gfx/layerdamage.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERDAMAGE_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERDAMAGE_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerDamage : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual std::set getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | 34 | }; 35 | 36 | #endif //__OPENCAESAR3_LAYERDAMAGE_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/gfx/layerdesirability.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERDESIRABILITY_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERDESIRABILITY_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | #include "core/font.hpp" 22 | 23 | class LayerDesirability : public Layer 24 | { 25 | public: 26 | virtual int getType() const; 27 | virtual std::set getVisibleWalkers() const; 28 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 29 | 30 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 31 | private: 32 | CityRenderer* _renderer; 33 | CityPtr _city; 34 | Font _debugFont; 35 | }; 36 | 37 | #endif //__OPENCAESAR3_LAYERRENDERER_H_INCLUDED__ 38 | -------------------------------------------------------------------------------- /source/gfx/layerentertainment.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERENTERTAINMENT_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERENTERTAINMENT_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerEntertainment : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual VisibleWalkers getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city, int type ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | std::set _flags; 34 | VisibleWalkers _visibleWalkers; 35 | int _type; 36 | }; 37 | 38 | #endif //__OPENCAESAR3_LAYERENTERTAINMENT_H_INCLUDED__ 39 | -------------------------------------------------------------------------------- /source/gfx/layerfire.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERFIRE_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERFIRE_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerFire : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual std::set getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | }; 34 | 35 | #endif //__OPENCAESAR3_LAYERFIRE_H_INCLUDED__ 36 | -------------------------------------------------------------------------------- /source/gfx/layerfood.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERFOOD_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERFOOD_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerFood : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual VisibleWalkers getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | }; 34 | 35 | #endif //__OPENCAESAR3_LAYERFOOD_H_INCLUDED__ 36 | -------------------------------------------------------------------------------- /source/gfx/layerhealth.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERHEALTH_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERHEALTH_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerHealth : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual VisibleWalkers getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city, int type ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | std::set _flags; 34 | std::set _walkers; 35 | int _type; 36 | }; 37 | 38 | #endif //__OPENCAESAR3_LAYERHEALTH_H_INCLUDED__ 39 | -------------------------------------------------------------------------------- /source/gfx/layerreligion.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERRELIGION_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERRELIGION_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerReligion : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual VisibleWalkers getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | std::set _flags; 34 | }; 35 | 36 | #endif //__OPENCAESAR3_LAYERRELIGION_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/gfx/layersimple.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERSIMPLE_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERSIMPLE_H_INCLUDED__ 18 | 19 | #include "core/referencecounted.hpp" 20 | #include "gfx/layer.hpp" 21 | #include "city_renderer.hpp" 22 | 23 | class LayerSimple : public Layer 24 | { 25 | public: 26 | virtual int getType() const; 27 | virtual std::set getVisibleWalkers() const; 28 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 29 | 30 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 31 | private: 32 | CityRenderer* _renderer; 33 | CityPtr _city; 34 | }; 35 | 36 | #endif //__OPENCAESAR3_LAYERSIMPLE_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/gfx/layerwater.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_LAYERWATER_H_INCLUDED__ 17 | #define __OPENCAESAR3_LAYERWATER_H_INCLUDED__ 18 | 19 | #include "layer.hpp" 20 | #include "city_renderer.hpp" 21 | 22 | class LayerWater : public Layer 23 | { 24 | public: 25 | virtual int getType() const; 26 | virtual std::set getVisibleWalkers() const; 27 | virtual void drawTile( GfxEngine& engine, Tile& tile, Point offset ); 28 | 29 | static LayerPtr create( CityRenderer* renderer, CityPtr city ); 30 | private: 31 | CityRenderer* _renderer; 32 | CityPtr _city; 33 | std::set _flags; 34 | }; 35 | 36 | #endif //__OPENCAESAR3_LAYERWATER_H_INCLUDED__ 37 | -------------------------------------------------------------------------------- /source/gfx/loader.cpp: -------------------------------------------------------------------------------- 1 | #include "loader.hpp" 2 | #include "loader_png.hpp" 3 | #include "core/foreach.hpp" 4 | 5 | class PictureLoader::Impl 6 | { 7 | public: 8 | void initLoaders(); 9 | 10 | typedef std::vector< AbstractPictureLoader* > Loaders; 11 | typedef Loaders::iterator LoaderIterator; 12 | Loaders loaders; 13 | }; 14 | 15 | PictureLoader::PictureLoader(void) : _d( new Impl ) 16 | { 17 | _d->initLoaders(); 18 | } 19 | 20 | void PictureLoader::Impl::initLoaders() 21 | { 22 | //_d->loaders.push_back( new PixmapLoaderBmp() ); 23 | loaders.push_back( new PictureLoaderPng() ); 24 | //_d->loaders.push_back( new PixmapLoaderPsd() ); 25 | //_d->loaders.push_back( new PixmapLoaderJpeg() ); 26 | } 27 | 28 | PictureLoader::~PictureLoader(void) 29 | { 30 | } 31 | 32 | PictureLoader& PictureLoader::instance() 33 | { 34 | static PictureLoader instanceLoader; 35 | return instanceLoader; 36 | } 37 | 38 | Picture PictureLoader::load( io::NFile file ) 39 | { 40 | if( !file.isOpen() ) 41 | return Picture::getInvalid(); 42 | 43 | // try to load file based on file extension 44 | foreach( AbstractPictureLoader* loader, _d->loaders ) 45 | { 46 | if( loader->isALoadableFileExtension(file.getFileName()) || 47 | loader->isALoadableFileFormat(file) ) 48 | { 49 | // reset file position which might have changed due to previous loadImage calls 50 | file.seek(0); 51 | return loader->load( file ); 52 | } 53 | } 54 | 55 | return Picture::getInvalid(); // failed to load 56 | } 57 | -------------------------------------------------------------------------------- /source/gfx/loader.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _OC3_PICTURE_LOADER_H_INLCUDE_ 2 | #define _OC3_PICTURE_LOADER_H_INLCUDE_ 3 | 4 | #include "picture.hpp" 5 | #include "core/scopedptr.hpp" 6 | #include "vfs/file.hpp" 7 | 8 | //! Class which is able to create a picture(sdl surface) from a file. 9 | class AbstractPictureLoader : public ReferenceCounted 10 | { 11 | public: 12 | //! returns true if the file maybe is able to be loaded by this class 13 | //! based on the file extension (e.g. ".tga") 14 | virtual bool isALoadableFileExtension( const io::FilePath& filename ) const = 0; 15 | 16 | //! returns true if the file maybe is able to be loaded by this class 17 | virtual bool isALoadableFileFormat( io::NFile file ) const = 0; 18 | 19 | //! creates a surface from the file 20 | virtual Picture load( io::NFile file ) const = 0; 21 | }; 22 | 23 | class PictureLoader 24 | { 25 | public: 26 | static PictureLoader& instance(); 27 | 28 | Picture load( io::NFile file ); 29 | 30 | ~PictureLoader(void); 31 | private: 32 | 33 | PictureLoader(void); 34 | 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | #endif //_OC3_PICTURE_LOADER_H_INLCUDE_ 40 | -------------------------------------------------------------------------------- /source/gfx/loader_png.hpp: -------------------------------------------------------------------------------- 1 | // this file was created by rt (www.tomkorp.com), based on ttk's png-reader 2 | // i wanted to be able to read in PNG images with opencaesar :) 3 | 4 | #ifndef __OC3_PICTURELOADER_PNG_H_INCLUDED__ 5 | #define __OC3_PICTURELOADER_PNG_H_INCLUDED__ 6 | 7 | #include "loader.hpp" 8 | 9 | //! Surface Loader for PNG files 10 | class PictureLoaderPng : public AbstractPictureLoader 11 | { 12 | public: 13 | 14 | //! returns true if the file maybe is able to be loaded by this class 15 | //! based on the file extension (e.g. ".png") 16 | virtual bool isALoadableFileExtension(const io::FilePath& filename) const; 17 | 18 | //! returns true if the file maybe is able to be loaded by this class 19 | virtual bool isALoadableFileFormat( io::NFile file) const; 20 | 21 | //! creates a surface from the file 22 | virtual Picture load( io::NFile file ) const; 23 | }; 24 | 25 | #endif //__OC3_PICTURELOADER_PNG_H_INCLUDED__ 26 | 27 | -------------------------------------------------------------------------------- /source/gfx/picture_info_bank.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PICTURE_INFO_BANK_H_INCLUDED__ 17 | #define __OPENCAESAR3_PICTURE_INFO_BANK_H_INCLUDED__ 18 | 19 | #include "core/position.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | // contains data needed for loading pictures 23 | class PictureInfoBank 24 | { 25 | public: 26 | static PictureInfoBank& instance(); 27 | ~PictureInfoBank(); 28 | 29 | Point getOffset(const std::string &resource_name); // image name ("Govt_00005") 30 | 31 | private: 32 | PictureInfoBank(); 33 | 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | #endif //__OPENCAESAR3_PICTURE_INFO_BANK_H_INCLUDED__ 39 | -------------------------------------------------------------------------------- /source/gfx/pictureconverter.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PICTURECONVERTER_H_INCLUDE_ 17 | #define __OPENCAESAR3_PICTURECONVERTER_H_INCLUDE_ 18 | 19 | #include "core/rectangle.hpp" 20 | 21 | class Picture; 22 | 23 | class PictureConverter 24 | { 25 | public: 26 | static void convToGrayscale( Picture& dst, const Picture& src ); 27 | static void rgbBalance( Picture& dst, const Picture& src, int lROffset, int lGOffset, int lBOffset ); 28 | static void maskColor( Picture& dst, const Picture& src, int rmask=0x00ff0000, int gmask=0x0000ff00, 29 | int bmask=0x000000ff, int amask=0xff000000 ); 30 | 31 | private: 32 | PictureConverter(); 33 | ~PictureConverter(); 34 | 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /source/gfx/renderer.hpp: -------------------------------------------------------------------------------- 1 | // this file was created by rt (www.tomkorp.com), based on ttk's png-reader 2 | // i wanted to be able to read in PNG images with opencaesar :) 3 | 4 | #ifndef __OC3_RENDERER_H_INCLUDED__ 5 | #define __OC3_RENDERER_H_INCLUDED__ 6 | 7 | #include "core/referencecounted.hpp" 8 | #include "picture.hpp" 9 | 10 | //! Surface Loader for PNG files 11 | class Renderer : public ReferenceCounted 12 | { 13 | public: 14 | typedef enum { 15 | none = 0, //non pass active 16 | transparent = 16, //transparent overlays 17 | foreground = 24, //solid overlays 18 | animations, 19 | shadow = 64 //drawn after solid overlays 20 | } Pass; 21 | 22 | typedef std::vector PassQueue; 23 | 24 | virtual void render() = 0; 25 | }; 26 | 27 | class Renderable : public ReferenceCounted 28 | { 29 | public: 30 | virtual PicturesArray getPictures( Renderer::Pass ) const = 0; 31 | }; 32 | 33 | #endif //__OC3_RENDERER_H_INCLUDED__ 34 | 35 | -------------------------------------------------------------------------------- /source/gui/advisor_education_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_EDUCATION_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_EDUCATION_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class AdvisorEducationWindow : public Widget 28 | { 29 | public: 30 | AdvisorEducationWindow( CityPtr city, Widget* parent, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | } //end namespace gui 40 | 41 | #endif //__OPENCAESAR3_ADVISOR_EDUCATION_WINDOW_H_INCLUDED__ 42 | -------------------------------------------------------------------------------- /source/gui/advisor_employers_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_EMPLOYERS_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_EMPLOYERS_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class AdvisorEmployerWindow : public Widget 27 | { 28 | public: 29 | AdvisorEmployerWindow( CityPtr city, Widget* parent, int id ); 30 | 31 | void draw( GfxEngine& painter ); 32 | 33 | private: 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | }//end namespace gui 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /source/gui/advisor_entertainment_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_ENTERTAINMENT_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_ENTERTAINMENT_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class AdvisorEntertainmentWindow : public Widget 27 | { 28 | public: 29 | AdvisorEntertainmentWindow( CityPtr city, Widget* parent, int id ); 30 | 31 | void draw( GfxEngine& painter ); 32 | 33 | private: 34 | void _showFestivalWindow(); 35 | 36 | class Impl; 37 | ScopedPtr< Impl > _d; 38 | }; 39 | 40 | }// end namespace gui 41 | 42 | #endif //__OPENCAESAR3_ADVISOR_ENTERTAINMENT_WINDOW_H_INCLUDED__ 43 | -------------------------------------------------------------------------------- /source/gui/advisor_finance_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_FINANCE_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_FINANCE_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class AdvisorFinanceWindow : public Widget 28 | { 29 | public: 30 | AdvisorFinanceWindow( CityPtr city, Widget* parent, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | }//end namespace gui 40 | #endif //__OPENCAESAR3_ADVISOR_HEALTH_WINDOW_H_INCLUDED__ 41 | -------------------------------------------------------------------------------- /source/gui/advisor_health_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_HEALTH_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_HEALTH_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class AdvisorHealthWindow : public Widget 28 | { 29 | public: 30 | AdvisorHealthWindow( CityPtr city, Widget* parent, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | }//end namespace gui 40 | 41 | #endif //__OPENCAESAR3_ADVISOR_HEALTH_WINDOW_H_INCLUDED__ 42 | -------------------------------------------------------------------------------- /source/gui/advisor_legion_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_LEGION_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_LEGION_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | namespace gui 22 | { 23 | 24 | class AdvisorLegionWindow : public Widget 25 | { 26 | public: 27 | AdvisorLegionWindow( Widget* parent, int id ); 28 | 29 | void draw( GfxEngine& painter ); 30 | 31 | private: 32 | class Impl; 33 | ScopedPtr< Impl > _d; 34 | }; 35 | 36 | }//end namespace gui 37 | #endif 38 | -------------------------------------------------------------------------------- /source/gui/advisor_ratings_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_RATINGS_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_RATINGS_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/predefinitions.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class AdvisorRatingsWindow : public Widget 27 | { 28 | public: 29 | AdvisorRatingsWindow( Widget* parent, int id, const CityPtr city ); 30 | 31 | void draw( GfxEngine& painter ); 32 | 33 | private: 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | }//end namespace gui 39 | #endif //__OPENCAESAR3_ADVISOR_RATINGS_WINDOW_H_INCLUDED__ 40 | -------------------------------------------------------------------------------- /source/gui/advisor_religion_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_RELIGION_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_RELIGION_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class AdvisorReligionWindow : public Widget 28 | { 29 | public: 30 | AdvisorReligionWindow( CityPtr city, Widget* parent, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | }; 38 | 39 | }//end namespace gui 40 | #endif //__OPENCAESAR3_ADVISOR_HEALTH_WINDOW_H_INCLUDED__ 41 | -------------------------------------------------------------------------------- /source/gui/advisor_trade_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_ADVISOR_TRADE_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_ADVISOR_TRADE_WINDOW_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "core/predefinitions.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class AdvisorTradeWindow : public Widget 28 | { 29 | public: 30 | AdvisorTradeWindow( CityPtr city, Widget* parent, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | oc3_signals public: 35 | Signal0<>& onEmpireMapRequest(); 36 | 37 | private: 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | }//end namespace gui 43 | #endif //__OPENCAESAR3_ADVISOR_TRADE_WINDOW_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/gui/contextmenuitemprivate.h: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_CONTEXT_MENU_ITEM_PRIVATE_H_INCLUDE_ 17 | #define _OPENCAESAR3_CONTEXT_MENU_ITEM_PRIVATE_H_INCLUDE_ 18 | 19 | #include "core/signals.hpp" 20 | #include "core/size.hpp" 21 | #include "core/flagholder.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class ContextMenu; 27 | 28 | class ContextMenuItem::Impl : public FlagHolder 29 | { 30 | public: 31 | Size dim; 32 | int offset; 33 | int luaFunction; 34 | int commandId; 35 | bool isAutoChecking; 36 | bool checked; 37 | bool isSeparator; 38 | bool isHovered; 39 | ContextMenu* subMenu; 40 | SubMenuAlign subMenuAlignment; 41 | 42 | oc3_signals public: 43 | Signal1 onCheckedSignal; 44 | }; 45 | 46 | }//end namespace gui 47 | #endif //_OPENCAESAR3_CONTEXT_MENU_ITEM_PRIVATE_H_INCLUDE_ 48 | -------------------------------------------------------------------------------- /source/gui/contextmenuprivate.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_CONTEXT_MENU_PRIVATE_H_INLCUDE_ 17 | #define _OPENCAESAR3_CONTEXT_MENU_PRIVATE_H_INLCUDE_ 18 | 19 | #include 20 | 21 | #include "gfx/picture.hpp" 22 | #include "core/signals.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class ContextMenuItem; 28 | 29 | class ContextMenu::Impl 30 | { 31 | public: 32 | std::vector< ContextMenuItem* > items; 33 | 34 | int highlihted; 35 | int lastHighlihted; 36 | unsigned int changeTime; 37 | bool allowFocus; 38 | 39 | Point pos; 40 | Widget* eventParent; 41 | Font lastFont; 42 | CloseMode closeHandling; 43 | bool needRecalculateItems; 44 | 45 | oc3_signals public: 46 | Signal1 onItemActionSignal; 47 | }; 48 | 49 | }//end namespace gui 50 | #endif //_OPENCAESAR3_CONTEXT_MENU_PRIVATE_H_INLCUDE_ 51 | -------------------------------------------------------------------------------- /source/gui/dialogbox.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_GUI_DIALOGBOX_INCLUDE_H_ 17 | #define _OPENCAESAR3_GUI_DIALOGBOX_INCLUDE_H_ 18 | 19 | #include "gui/widget.hpp" 20 | #include "core/signals.hpp" 21 | #include "core/scopedptr.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class DialogBox : public Widget 27 | { 28 | public: 29 | enum { btnYes=1, btnNo=2, btnOk=4, btnCancel=8 }; 30 | DialogBox( Widget* parent, const Rect& rectangle, const std::string& title, 31 | const std::string& text, int buttons ); 32 | 33 | bool onEvent(const NEvent& event); 34 | 35 | void draw( GfxEngine& painter ); 36 | 37 | oc3_signals public: 38 | Signal1& onResult(); 39 | Signal0<>& onOk(); 40 | Signal0<>& onCancel(); 41 | 42 | private: 43 | class Impl; 44 | ScopedPtr< Impl > _d; 45 | }; 46 | 47 | }//end namespace gui 48 | #endif 49 | -------------------------------------------------------------------------------- /source/gui/message_stack_widget.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_MESSAGE_STACK_WIDGET_H_INCLUDED__ 18 | #define __OPENCAESAR3_MESSAGE_STACK_WIDGET_H_INCLUDED__ 19 | 20 | #include "widget.hpp" 21 | #include "core/scopedptr.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class WindowMessageStack : public Widget 27 | { 28 | public: 29 | static const int defaultID; 30 | static WindowMessageStack* create( Widget* parent ); 31 | 32 | // draw on screen 33 | virtual void draw( GfxEngine& engine ); 34 | 35 | bool onEvent(const NEvent& event); 36 | 37 | void addMessage( std::string ); 38 | 39 | private: 40 | WindowMessageStack( Widget* parent, int id, const Rect& rectangle ); 41 | 42 | class Impl; 43 | ScopedPtr< Impl > _d; 44 | }; 45 | 46 | }//end namespace gui 47 | #endif 48 | -------------------------------------------------------------------------------- /source/gui/minimap_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_MINIMAP_WINDOW_H_INCLUDE_ 17 | #define __OPENCAESAR3_MINIMAP_WINDOW_H_INCLUDE_ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "gfx/picture.hpp" 22 | 23 | class Tilemap; 24 | 25 | namespace gui 26 | { 27 | 28 | class Minimap : public Widget 29 | { 30 | public: 31 | Minimap(Widget* parent, const Rect& rect, const Tilemap& tilemap, int climate ); 32 | 33 | void draw(GfxEngine &painter); 34 | 35 | void setCenter( Point pos ); 36 | 37 | private: 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | }//end namespace gui 43 | #endif //__OPENCAESAR3_MINIMAP_WINDOW_H_INCLUDE_ 44 | -------------------------------------------------------------------------------- /source/gui/mission_target_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_MISSION_TARGETS_WINDOW_H_INCLUDED__ 17 | #define __OPENCAESAR3_MISSION_TARGETS_WINDOW_H_INCLUDED__ 18 | 19 | #include "core/scopedptr.hpp" 20 | #include "core/predefinitions.hpp" 21 | #include "widget.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class MissionTargetsWindow : public Widget 27 | { 28 | public: 29 | static MissionTargetsWindow* create( Widget* parent, CityPtr city , int id=-1 ); 30 | ~MissionTargetsWindow(); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | private: 35 | MissionTargetsWindow( Widget* parent, int id, const Rect& rectangle ); 36 | 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | }//end namespace gui 42 | #endif //__OPENCAESAR3_EMPIRE_H_INCLUDED__ 43 | -------------------------------------------------------------------------------- /source/gui/modal_widget.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OC3_MODAL_WIDGET_H_INCLUDED__ 2 | #define __OC3_MODAL_WIDGET_H_INCLUDED__ 3 | 4 | #include "widget.hpp" 5 | 6 | namespace gui 7 | { 8 | 9 | class ModalScreen : public Widget 10 | { 11 | public: 12 | //! constructor 13 | ModalScreen( Widget* parent, int id=-1 ); 14 | 15 | //! called if an event happened. 16 | virtual bool onEvent(const NEvent& event); 17 | 18 | //! Removes a child. 19 | virtual void removeChild(Widget* child); 20 | 21 | //! Adds a child 22 | virtual void addChild(Widget* child); 23 | 24 | //! draws the element and its children 25 | virtual void draw( GfxEngine& painter ); 26 | 27 | //! Modalscreen is not a typical element, but rather acts like a state for it's children. 28 | //! isVisible is overriden to give this a useful behaviour, so that a modal will no longer 29 | //! be active when its parent is invisible or all its children are invisible. 30 | virtual bool isVisible() const; 31 | 32 | //! Modals are infinite so every point is inside 33 | virtual bool isPointInside(const Point& point) const; 34 | 35 | protected: 36 | virtual bool _canTakeFocus(Widget* target) const; 37 | 38 | //! Updates the absolute position. 39 | virtual void _resizeEvent(); 40 | 41 | private: 42 | unsigned int _mouseDownTime; 43 | }; 44 | 45 | }//end namespace gui 46 | #endif //__OC3_MODAL_WIDGET_H_INCLUDED__ 47 | -------------------------------------------------------------------------------- /source/gui/playername_window.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_WINDOW_PLAYERNAME_H_INCLUDE_ 17 | #define _OPENCAESAR3_WINDOW_PLAYERNAME_H_INCLUDE_ 18 | 19 | #include "widget.hpp" 20 | #include "core/signals.hpp" 21 | #include "core/scopedptr.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class WindowPlayerName : public Widget 27 | { 28 | public: 29 | WindowPlayerName( Widget* parent ); 30 | ~WindowPlayerName(); 31 | 32 | public oc3_signals: 33 | Signal0<>& onClose(); 34 | Signal1& onNameChange(); 35 | 36 | private: 37 | class Impl; 38 | ScopedPtr< Impl > _d; 39 | }; 40 | 41 | }//end namespace gui 42 | #endif //_OPENCAESAR3_WINDOW_PLAYERNAME_H_INCLUDE_ 43 | -------------------------------------------------------------------------------- /source/gui/popup_messagebox.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_POPUP_MESSAGEBOX_H_INCLUDED__ 17 | #define __OPENCAESAR3_POPUP_MESSAGEBOX_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class PopupMessageBox : public Widget 27 | { 28 | public: 29 | PopupMessageBox( Widget* parent, 30 | const std::string& title, 31 | const std::string& text, 32 | const std::string& time="", 33 | const std::string& receiver="", 34 | int id=-1 ); 35 | 36 | void draw( GfxEngine& painter ); 37 | 38 | private: 39 | class Impl; 40 | ScopedPtr< Impl > _d; 41 | }; 42 | 43 | }//end namespace gui 44 | 45 | #endif //__OPENCAESAR3_POPUP_MESSAGEBOX_H_INCLUDED__ 46 | -------------------------------------------------------------------------------- /source/gui/rightpanel.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | 17 | #ifndef __OPENCAESAR3_MENURIGTHPANEL_H_INCLUDE_ 18 | #define __OPENCAESAR3_MENURIGTHPANEL_H_INCLUDE_ 19 | 20 | #include "widget.hpp" 21 | #include "core/scopedptr.hpp" 22 | 23 | class Picture; 24 | 25 | namespace gui 26 | { 27 | 28 | class MenuRigthPanel : public Widget 29 | { 30 | public: 31 | static MenuRigthPanel* create( Widget* parent, const Rect& rectangle, const Picture& tilePic ); 32 | 33 | void draw( GfxEngine& engine ); 34 | private: 35 | class Impl; 36 | ScopedPtr< Impl > _d; 37 | 38 | MenuRigthPanel( Widget* parent ); 39 | }; 40 | 41 | }//end namespace gui 42 | #endif 43 | -------------------------------------------------------------------------------- /source/gui/save_dialog.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SAVE_DIALOG_H_INCLUDED__ 17 | #define __OPENCAESAR3_SAVE_DIALOG_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | #include "core/signals.hpp" 22 | #include "vfs/filepath.hpp" 23 | 24 | namespace gui 25 | { 26 | 27 | class SaveDialog : public Widget 28 | { 29 | public: 30 | SaveDialog( Widget* parent, const io::FilePath& dir, const std::string& fileExt, int id ); 31 | 32 | void draw( GfxEngine& painter ); 33 | 34 | oc3_signals public: 35 | Signal1& onFileSelected(); 36 | 37 | private: 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | }//end namespace gui 43 | #endif //__OPENCAESAR3_SAVE_DIALOG_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/gui/scrollbarprivate.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_SCROLLBAR_PRIVATE_H_INCLUDE_ 17 | #define _OPENCAESAR3_SCROLLBAR_PRIVATE_H_INCLUDE_ 18 | 19 | #include "gfx/picture.hpp" 20 | #include "core/signals.hpp" 21 | #include "core/rectangle.hpp" 22 | 23 | namespace gui 24 | { 25 | 26 | class PushButton; 27 | 28 | class ScrollBar::Impl 29 | { 30 | oc3_signals public: 31 | Signal1 onPositionChanged; 32 | 33 | public: 34 | Rect textureRect; 35 | Rect sliderTextureRect; 36 | Rect backgroundRect; 37 | Rect filledAreaRect; 38 | Rect sliderRect; 39 | PushButton* upButton; 40 | PushButton* downButton; 41 | bool needRecalculateParams; 42 | Point cursorPos; 43 | 44 | Picture texture; 45 | Picture sliderPictureUp, sliderPictureDown; 46 | Picture sliderTexture; 47 | }; 48 | 49 | }//end namespace gui 50 | #endif //_OPENCAESAR3_SCROLLBAR_PRIVATE_H_INCLUDE_ 51 | -------------------------------------------------------------------------------- /source/gui/senate_popup_info.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_SENATE_POPUP_INFO_H_INCLUDED__ 17 | #define __OPENCAESAR3_SENATE_POPUP_INFO_H_INCLUDED__ 18 | 19 | #include "widget.hpp" 20 | #include "core/scopedptr.hpp" 21 | 22 | class CityRenderer; 23 | 24 | namespace gui 25 | { 26 | 27 | class SenatePopupInfo : public Widget 28 | { 29 | public: 30 | SenatePopupInfo(Widget* parent, CityRenderer& mapRenderer ); 31 | 32 | void draw( GfxEngine& painter ); 33 | private: 34 | class Impl; 35 | ScopedPtr< Impl > _d; 36 | }; 37 | 38 | }//end namespace gui 39 | #endif 40 | -------------------------------------------------------------------------------- /source/gui/startmenu.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef __OPENCAESAR3_MENU_H_INCLUDE_ 20 | #define __OPENCAESAR3_MENU_H_INCLUDE_ 21 | 22 | #include "widget.hpp" 23 | 24 | #include "gfx/picture.hpp" 25 | #include "game/enums.hpp" 26 | 27 | namespace gui 28 | { 29 | 30 | class PushButton; 31 | 32 | // this is the menu with newGame/loadGame/quit choice 33 | class StartMenu : public Widget 34 | { 35 | public: 36 | StartMenu( Widget* parent ); 37 | virtual ~StartMenu(); 38 | 39 | //draw on screen 40 | //virtual void draw( GfxEngine& engine ); 41 | 42 | PushButton* addButton( const std::string& caption, int id ); 43 | }; 44 | 45 | }//end namespace gui 46 | #endif 47 | -------------------------------------------------------------------------------- /source/gui/warehouse_infobox.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_WAREHOUSE_INFOBOX_H_INCLUDE_ 17 | #define _OPENCAESAR3_WAREHOUSE_INFOBOX_H_INCLUDE_ 18 | 19 | #include "info_box.hpp" 20 | 21 | namespace gui 22 | { 23 | 24 | class InfoBoxWarehouse : public InfoBoxSimple 25 | { 26 | public: 27 | InfoBoxWarehouse( Widget* parent, const Tile& tile ); 28 | virtual ~InfoBoxWarehouse(); 29 | 30 | void drawGood( const Good::Type &goodType, int col, int paintY); 31 | void showSpecialOrdersWindow(); 32 | 33 | private: 34 | WarehousePtr _warehouse; 35 | }; 36 | 37 | }//end namespace gui 38 | #endif //_OPENCAESAR3_WAREHOUSE_INFOBOX_H_INCLUDE_ 39 | -------------------------------------------------------------------------------- /source/gui/widget_deleter.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "widget_deleter.hpp" 17 | #include "core/time.hpp" 18 | 19 | namespace gui 20 | { 21 | 22 | WidgetDeleter::~WidgetDeleter(void) 23 | { 24 | } 25 | 26 | WidgetDeleter::WidgetDeleter( Widget* parent, size_t time ) 27 | : WidgetAnimator( parent, 0 ) 28 | { 29 | _delay = time; 30 | _startTime = DateTime::getElapsedTime(); 31 | } 32 | 33 | void WidgetDeleter::draw( GfxEngine& painter ) 34 | { 35 | if( DateTime::getElapsedTime() - _startTime > _delay ) 36 | getParent()->deleteLater(); 37 | } 38 | 39 | }//end namespace gui 40 | -------------------------------------------------------------------------------- /source/gui/widget_deleter.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OC3_WIDGET_DELETER_INCLUDE_ 17 | #define _OC3_WIDGET_DELETER_INCLUDE_ 18 | 19 | #include "widgetanimator.hpp" 20 | 21 | namespace gui 22 | { 23 | 24 | class WidgetDeleter : public WidgetAnimator 25 | { 26 | public: 27 | WidgetDeleter( Widget* node, size_t time ); 28 | ~WidgetDeleter(void); 29 | 30 | virtual void draw( GfxEngine& painter ); 31 | 32 | private: 33 | unsigned int _delay; 34 | unsigned int _startTime; 35 | }; 36 | 37 | }//end namespace gui 38 | #endif 39 | -------------------------------------------------------------------------------- /source/gui/widget_factory.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_WIDGET_FACTORY_H_INCLUDE_ 17 | #define _OPENCAESAR3_WIDGET_FACTORY_H_INCLUDE_ 18 | 19 | #include "core/scopedptr.hpp" 20 | #include 21 | 22 | namespace gui 23 | { 24 | 25 | class Widget; 26 | 27 | class WidgetCreator 28 | { 29 | public: 30 | virtual Widget* create( Widget* parent ) = 0; 31 | }; 32 | 33 | class WidgetFactory 34 | { 35 | public: 36 | WidgetFactory(); 37 | ~WidgetFactory(); 38 | 39 | Widget* create(const std::string& type, Widget* parent ) const; 40 | 41 | bool canCreate( const std::string& type ) const; 42 | 43 | void addCreator( const std::string& type, WidgetCreator* ctor ); 44 | private: 45 | class Impl; 46 | ScopedPtr< Impl > _d; 47 | }; 48 | 49 | }//end namespace gui 50 | #endif //_OPENCAESAR3_WIDGET_FACTORY_H_INCLUDE_ 51 | -------------------------------------------------------------------------------- /source/gui/widgetanimator.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_WIDGETANIMATOR_H_INCLUDE_ 17 | #define __OPENCAESAR3_WIDGETANIMATOR_H_INCLUDE_ 18 | 19 | #include "gui/widget.hpp" 20 | #include "core/flagholder.hpp" 21 | 22 | #define ANIMATOR_UNUSE_VALUE -9999 23 | 24 | namespace gui 25 | { 26 | 27 | class WidgetAnimator : public Widget, public FlagHolder 28 | { 29 | public: 30 | enum { showParent=0x1, 31 | removeSelf=0x2, removeParent=0x4, 32 | debug=0x8, 33 | isActive=0x10 }; 34 | 35 | WidgetAnimator( Widget* parent, int flags ); 36 | 37 | //! Деструктор 38 | virtual ~WidgetAnimator(void); 39 | 40 | void beforeDraw( GfxEngine& painter ); 41 | 42 | protected: 43 | virtual void afterFinished_(); 44 | }; 45 | 46 | }//end namespace gui 47 | #endif 48 | -------------------------------------------------------------------------------- /source/gui/window_gamespeed_options.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_WINDOW_GAMESPEED_OPTIONS_H_INCLUDE_ 17 | #define _OPENCAESAR3_WINDOW_GAMESPEED_OPTIONS_H_INCLUDE_ 18 | 19 | #include "widget.hpp" 20 | #include "core/signals.hpp" 21 | 22 | namespace gui 23 | { 24 | 25 | class GameSpeedOptionsWindow : public Widget 26 | { 27 | public: 28 | GameSpeedOptionsWindow( Widget* parent, int gameSpeed, int scrollSpeed ); 29 | 30 | //! Деструктор 31 | virtual ~GameSpeedOptionsWindow(void); 32 | 33 | virtual bool onEvent(const NEvent &event); 34 | 35 | public oc3_signals: 36 | Signal1& onGameSpeedChange(); 37 | Signal1& onScrollSpeedChange(); 38 | 39 | private: 40 | void _update(); 41 | 42 | class Impl; 43 | ScopedPtr< Impl > _d; 44 | }; 45 | 46 | }//end namespace gui 47 | #endif //_OPENCAESAR3_WINDOW_VIDEO_OPTIONS_H_INCLUDE_ 48 | -------------------------------------------------------------------------------- /source/main.cpp: -------------------------------------------------------------------------------- 1 | #include "game/game.hpp" 2 | #include "game/settings.hpp" 3 | #include "core/exception.hpp" 4 | #include "core/stringhelper.hpp" 5 | #include "core/logger.hpp" 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | for (int i = 0; i < (argc - 1); i++) 10 | { 11 | if( !strcmp( argv[i], "-R" ) ) 12 | { 13 | std::string path = argv[i+1]; 14 | GameSettings::set( GameSettings::resourcePath, Variant( path ) ); 15 | GameSettings::set( GameSettings::localePath, Variant( path + "/locale" ) ); 16 | i++; 17 | } 18 | 19 | if( !strcmp( argv[i], "-Lc" ) ) 20 | { 21 | GameSettings::set( GameSettings::localeName, Variant( std::string( argv[i+1] ) ) ); 22 | i++; 23 | } 24 | } 25 | 26 | try 27 | { 28 | Game game; 29 | 30 | game.initialize(); 31 | game.exec(); 32 | } 33 | catch( Exception e ) 34 | { 35 | Logger::warning( "FATAL ERROR: %s", e.getDescription().c_str() ); 36 | } 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /source/sound/oc3_sound_engine.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | // 16 | // Copyright 2012-2013 Gregoire Athanase, gathanase@gmail.com 17 | 18 | 19 | #ifndef SOUND_ENGINE_HPP 20 | #define SOUND_ENGINE_HPP 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | void callback_music_end(); 28 | 29 | class SoundEngine 30 | { 31 | public: 32 | static SoundEngine& instance(); 33 | 34 | SoundEngine(); 35 | ~SoundEngine(); 36 | void init(); 37 | void exit(); 38 | void play_music(const std::string &filename); 39 | void free_music(); 40 | 41 | private: 42 | static SoundEngine* _instance; 43 | Mix_Music *_currentMusic; // currently playing music 44 | }; 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /source/version.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PROJECT_VERSION_INCLUDE_H_ 17 | #define __OPENCAESAR3_PROJECT_VERSION_INCLUDE_H_ 18 | 19 | #include "core/platform.hpp" 20 | 21 | #define OC3_VERSION_MAJOR 0 22 | #define OC3_VERSION_MINOR 2 23 | #define OC3_VERSION_REVSN 881 24 | 25 | #define OC3_STR_EXT(__A) #__A 26 | #define OC3_STR_A(__A) OC3_STR_EXT(__A) 27 | #define OC3_VERSION OC3_STR_A(OC3_VERSION_MAJOR)"."OC3_STR_A(OC3_VERSION_MINOR)"."OC3_STR_A(OC3_VERSION_REVSN)"["OC3_PLATFORM_NAME":"OC3_COMPILER_NAME"]" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /source/vfs/entity.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCAESAR3_FSENTITY_H_INCLUDED__ 2 | #define __OPENCAESAR3_FSENTITY_H_INCLUDED__ 3 | 4 | #include "core/referencecounted.hpp" 5 | #include "core/bytearray.hpp" 6 | #include "core/smartptr.hpp" 7 | 8 | namespace io 9 | { 10 | 11 | class FilePath; 12 | 13 | class FSEntity : public ReferenceCounted 14 | { 15 | public: 16 | typedef enum { fmRead=0x0, fmWrite=0x1, fmAppend=0x2 } Mode; 17 | 18 | virtual ~FSEntity() {} 19 | 20 | //! returns how much was read 21 | virtual int read(void* buffer, unsigned int sizeToRead) = 0; 22 | 23 | virtual ByteArray readLine() = 0; 24 | 25 | virtual ByteArray read( unsigned int sizeToRead ) = 0; 26 | 27 | virtual int write( const void* buffer, unsigned int sizeToWrite) = 0; 28 | 29 | virtual int write( const ByteArray& bArray ) = 0; 30 | 31 | //! changes position in file, returns true if successful 32 | virtual bool seek(long finalPos, bool relativeMovement = false) = 0; 33 | 34 | //! returns size of file 35 | virtual long getSize() const = 0; 36 | 37 | //! returns if file is open 38 | virtual bool isOpen() const = 0; 39 | 40 | //! returns where in the file we are. 41 | virtual long getPos() const = 0; 42 | 43 | //! returns name of file 44 | virtual const FilePath& getFileName() const = 0; 45 | 46 | virtual bool isEof() const = 0; 47 | 48 | virtual void flush() = 0; 49 | }; 50 | 51 | typedef SmartPtr< FSEntity > FSEntityPtr; 52 | 53 | } //end namespace io 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /source/walker/ability.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "ability.hpp" 17 | 18 | Illness::Illness(int strong, int delay) 19 | { 20 | _strong = strong; 21 | _time = 0; 22 | _delay = delay; 23 | } 24 | 25 | AbilityPtr Illness::create(double strong, unsigned int delay) 26 | { 27 | AbilityPtr ret( new Illness( strong, delay ) ); 28 | ret->drop(); 29 | 30 | return ret; 31 | } 32 | 33 | void Illness::run(WalkerPtr parent, unsigned int time) 34 | { 35 | if( _time >= _delay ) 36 | { 37 | _time = 0; 38 | parent->updateHealth( -_strong ); 39 | } 40 | 41 | _time++; 42 | } 43 | -------------------------------------------------------------------------------- /source/walker/ability.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_WALKER_ABILITY_H_INCLUDED__ 17 | #define __OPENCAESAR3_WALKER_ABILITY_H_INCLUDED__ 18 | 19 | #include "core/referencecounted.hpp" 20 | #include "walker.hpp" 21 | 22 | class Ability : public ReferenceCounted 23 | { 24 | public: 25 | virtual void run( WalkerPtr parent, unsigned int time=4 ) = 0; 26 | }; 27 | 28 | class Illness : public Ability 29 | { 30 | public: 31 | static AbilityPtr create( double strong, unsigned int delay ); 32 | 33 | virtual void run(WalkerPtr parent, unsigned int time); 34 | 35 | private: 36 | Illness( int strong, int delay ); 37 | 38 | double _strong; 39 | unsigned int _time; 40 | unsigned int _delay; 41 | }; 42 | 43 | #endif //__OPENCAESAR3_WALKER_ABILITY_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/walker/action.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_WALKER_ACTION_H_INCLUDED__ 17 | #define __OPENCAESAR3_WALKER_ACTION_H_INCLUDED__ 18 | 19 | #include "core/direction.hpp" 20 | 21 | struct DirectedAction 22 | { 23 | int action; 24 | constants::Direction direction; 25 | 26 | inline bool operator<( const DirectedAction &a ) const 27 | { 28 | return ( action != a.action 29 | ? action < a.action 30 | : direction < a.direction ); 31 | } 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /source/walker/fishing_boat.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR_FISHING_BOAT_INCLUDE_H_ 17 | #define _OPENCAESAR_FISHING_BOAT_INCLUDE_H_ 18 | 19 | #include "ship.hpp" 20 | 21 | class FishingBoat : public Ship 22 | { 23 | public: 24 | static FishingBoatPtr create( CityPtr city ); 25 | 26 | void send2City( WharfPtr base, const TilePos& start); 27 | 28 | virtual void onDestination(); 29 | virtual void onNewTile(); 30 | 31 | virtual void save(VariantMap &stream) const; 32 | virtual void load(const VariantMap &stream); 33 | 34 | virtual void timeStep(const unsigned long time); 35 | void startCatch(); 36 | 37 | bool isBusy() const; 38 | 39 | virtual void die(); 40 | 41 | private: 42 | FishingBoat( CityPtr city ); 43 | 44 | class Impl; 45 | ScopedPtr< Impl > _d; 46 | }; 47 | 48 | 49 | #endif //_OPENCAESAR_FISHING_BOAT_INCLUDE_H_ 50 | -------------------------------------------------------------------------------- /source/walker/market_kid.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_MARKET_KID_H_INCLUDED__ 17 | #define __OPENCAESAR3_MARKET_KID_H_INCLUDED__ 18 | 19 | #include "walker.hpp" 20 | 21 | class MarketKid : public Walker 22 | { 23 | public: 24 | static MarketKidPtr create( CityPtr city, MarketLadyPtr lady ); 25 | 26 | GoodStock& getBasket(); 27 | void setDelay( int delay ); 28 | 29 | void send2City( MarketPtr destination ); 30 | 31 | virtual void timeStep(const unsigned long time); 32 | virtual void onDestination(); 33 | virtual void die(); 34 | 35 | private: 36 | MarketKid( CityPtr city ); 37 | 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | #endif //__OPENCAESAR3_MARKET_KID_H_INCLUDED__ 43 | -------------------------------------------------------------------------------- /source/walker/merchant.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR3_WALKER_MERCHANT_INCLUDE_H_ 17 | #define _OPENCAESAR3_WALKER_MERCHANT_INCLUDE_H_ 18 | 19 | #include "walker.hpp" 20 | #include "game/empire_trading.hpp" 21 | 22 | /** This is the empire merchant which buy/sell goods at warehouses */ 23 | class Merchant : public Walker 24 | { 25 | public: 26 | static WalkerPtr create( CityPtr city, EmpireMerchantPtr merchant ); 27 | 28 | virtual ~Merchant(); 29 | 30 | void send2City(); 31 | virtual void onDestination(); 32 | 33 | void save( VariantMap& stream) const; 34 | void load( const VariantMap& stream); 35 | private: 36 | Merchant( CityPtr city ); 37 | 38 | class Impl; 39 | ScopedPtr< Impl > _d; 40 | }; 41 | 42 | #endif //_OPENCAESAR3_WALKER_MERCHANT_INCLUDE_H_ 43 | -------------------------------------------------------------------------------- /source/walker/patrician.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PATRICIAN_H_INCLUDED__ 17 | #define __OPENCAESAR3_PATRICIAN_H_INCLUDED__ 18 | 19 | #include "walker.hpp" 20 | #include "core/predefinitions.hpp" 21 | 22 | /** This is an immigrant coming with his stuff */ 23 | class Patrician : public Walker 24 | { 25 | public: 26 | Patrician( CityPtr city ); 27 | ~Patrician(); 28 | 29 | virtual void send2City(TilePos start ); 30 | 31 | virtual void save(VariantMap& stream) const; 32 | virtual void load(const VariantMap& stream); 33 | 34 | virtual void die(); 35 | 36 | protected: 37 | void _findNewWay(const TilePos& start); 38 | 39 | class Impl; 40 | ScopedPtr< Impl > _d; 41 | }; 42 | 43 | #endif //__OPENCAESAR3_PATRICIAN_H_INCLUDED__ 44 | -------------------------------------------------------------------------------- /source/walker/protestor.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_PROTESTOR_H_INCLUDE_ 17 | #define __OPENCAESAR3_PROTESTOR_H_INCLUDE_ 18 | 19 | #include "walker.hpp" 20 | 21 | class Protestor : public Walker 22 | { 23 | public: 24 | static ProtestorPtr create( CityPtr city ); 25 | virtual ~Protestor(); 26 | 27 | virtual void onNewTile(); 28 | virtual void onDestination(); 29 | virtual void timeStep(const unsigned long time); 30 | void send2City( HousePtr house ); 31 | 32 | virtual void die(); 33 | 34 | virtual void save(VariantMap &stream) const; 35 | virtual void load(const VariantMap &stream); 36 | 37 | private: 38 | Protestor( CityPtr city ); 39 | 40 | class Impl; 41 | ScopedPtr _d; 42 | }; 43 | 44 | #endif//__OPENCAESAR3_PROTESTOR_H_INCLUDE_ 45 | -------------------------------------------------------------------------------- /source/walker/servicewalker_helper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __OPENCAESAR3_SERVICEWALKERHELPER_H_INCLUDED__ 2 | #define __OPENCAESAR3_SERVICEWALKERHELPER_H_INCLUDED__ 3 | 4 | #include "serviceman.hpp" 5 | 6 | class ServiceWalkerHelper 7 | { 8 | public: 9 | ServiceWalkerHelper( ServiceWalker& walker ) 10 | : _walker( walker ) 11 | { 12 | 13 | } 14 | 15 | ServiceWalker::ReachedBuildings getReachedBuildings( const TilePos& pos, const TileOverlay::Type type ) 16 | { 17 | ServiceWalker::ReachedBuildings res = _walker.getReachedBuildings( pos ); 18 | 19 | ServiceWalker::ReachedBuildings::iterator it=res.begin(); 20 | while( it != res.end() ) 21 | { 22 | if( (*it)->getType() != type ) 23 | { 24 | res.erase( it++ ); 25 | } 26 | else 27 | { 28 | it++; 29 | } 30 | } 31 | 32 | return res; 33 | } 34 | 35 | template< class T > 36 | std::set< SmartPtr< T > > getReachedBuildings( const TilePos& pos ) 37 | { 38 | ServiceWalker::ReachedBuildings buildings = _walker.getReachedBuildings( pos ); 39 | 40 | std::set< SmartPtr< T > > ret; 41 | for( ServiceWalker::ReachedBuildings::iterator it=buildings.begin(); it != buildings.end(); it++ ) 42 | { 43 | SmartPtr< T > building = (*it).as(); 44 | if( building.isValid() ) 45 | { 46 | ret.insert( building ); 47 | } 48 | } 49 | 50 | return ret; 51 | } 52 | 53 | private: 54 | ServiceWalker& _walker; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /source/walker/ship.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #include "ship.hpp" 17 | #include "core/gettext.hpp" 18 | #include "game/city.hpp" 19 | #include "constants.hpp" 20 | #include "corpse.hpp" 21 | #include "game/resourcegroup.hpp" 22 | 23 | using namespace constants; 24 | 25 | Ship::Ship( CityPtr city ) 26 | : Walker( city ) 27 | { 28 | _setType( walker::unknown ); 29 | _setAnimation( gfx::unknown ); 30 | 31 | setName( _("##ship##") ); 32 | } 33 | 34 | void Ship::die() 35 | { 36 | Walker::die(); 37 | 38 | Corpse::create( _getCity(), getIJ(), ResourceGroup::carts, 265, 272, true ); 39 | } 40 | 41 | Ship::~Ship() 42 | { 43 | 44 | } 45 | -------------------------------------------------------------------------------- /source/walker/ship.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef _OPENCAESAR_SHIP_INCLUDE_H_ 17 | #define _OPENCAESAR_SHIP_INCLUDE_H_ 18 | 19 | #include "walker.hpp" 20 | #include "core/predefinitions.hpp" 21 | 22 | class Ship : public Walker 23 | { 24 | public: 25 | Ship( CityPtr city ); 26 | 27 | virtual void die(); 28 | virtual ~Ship(); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /source/walker/taxcollector.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_TAXCOLLECTOR_H_INCLUDED__ 17 | #define __OPENCAESAR3_TAXCOLLECTOR_H_INCLUDED__ 18 | 19 | #include "serviceman.hpp" 20 | 21 | class TaxCollector; 22 | typedef SmartPtr< TaxCollector > TaxCollectorPtr; 23 | 24 | class TaxCollector : public ServiceWalker 25 | { 26 | public: 27 | static TaxCollectorPtr create( CityPtr city ); 28 | virtual void onMidTile(); 29 | 30 | int getMoney() const; 31 | int getCitizensReachedCount() const; 32 | 33 | private: 34 | TaxCollector( CityPtr city ); 35 | 36 | class Impl; 37 | ScopedPtr< Impl > _d; 38 | }; 39 | 40 | #endif //__OPENCAESAR3_TAXCOLLECTOR_H_INCLUDED__ 41 | -------------------------------------------------------------------------------- /source/walker/workerhunter.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of openCaesar3. 2 | // 3 | // openCaesar3 is free software: you can redistribute it and/or modify 4 | // it under the terms of the GNU General Public License as published by 5 | // the Free Software Foundation, either version 3 of the License, or 6 | // (at your option) any later version. 7 | // 8 | // openCaesar3 is distributed in the hope that it will be useful, 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | // GNU General Public License for more details. 12 | // 13 | // You should have received a copy of the GNU General Public License 14 | // along with openCaesar3. If not, see . 15 | 16 | #ifndef __OPENCAESAR3_WORKERSHUNTER_H_INCLUDE_ 17 | #define __OPENCAESAR3_WORKERSHUNTER_H_INCLUDE_ 18 | 19 | #include "serviceman.hpp" 20 | 21 | class WorkersHunter; 22 | typedef SmartPtr WorkersHunterPtr; 23 | 24 | class WorkersHunter : public ServiceWalker 25 | { 26 | public: 27 | static WorkersHunterPtr create( CityPtr city ); 28 | 29 | int getWorkersNeeded() const; 30 | virtual void onNewTile(); 31 | void hireWorkers( const int workers ); 32 | 33 | void send2City( WorkingBuildingPtr building, const int workersNeeded ); 34 | 35 | virtual void die(); 36 | private: 37 | WorkersHunter( CityPtr city ); 38 | 39 | int _workersNeeded; 40 | }; 41 | 42 | #endif//__OPENCAESAR3_WORKERSHUNTER_H_INCLUDE_ 43 | -------------------------------------------------------------------------------- /utils/zlib/gzclose.c: -------------------------------------------------------------------------------- 1 | /* gzclose.c -- zlib gzclose() function 2 | * Copyright (C) 2004, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | #include "gzguts.h" 7 | 8 | /* gzclose() is in a separate file so that it is linked in only if it is used. 9 | That way the other gzclose functions can be used instead to avoid linking in 10 | unneeded compression or decompression routines. */ 11 | int ZEXPORT gzclose(file) 12 | gzFile file; 13 | { 14 | #ifndef NO_GZCOMPRESS 15 | gz_statep state; 16 | 17 | if (file == NULL) 18 | return Z_STREAM_ERROR; 19 | state = (gz_statep)file; 20 | 21 | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 22 | #else 23 | return gzclose_r(file); 24 | #endif 25 | } 26 | -------------------------------------------------------------------------------- /utils/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | --------------------------------------------------------------------------------