| summaryrefslogtreecommitdiff | 
diff options
| -rw-r--r-- | conf/yaws.conf | 2 | ||||
| -rw-r--r-- | src/battlemap_shim.erl | 6 | ||||
| -rw-r--r-- | src/database_shim.erl | 10 | ||||
| -rw-r--r-- | src/timed_cache.erl | 7 | ||||
| -rw-r--r-- | www/handler/battlemap/load_state.yaws | 4 | 
5 files changed, 18 insertions, 11 deletions
| diff --git a/conf/yaws.conf b/conf/yaws.conf index ecd5bfb..6b9603b 100644 --- a/conf/yaws.conf +++ b/conf/yaws.conf @@ -111,5 +111,5 @@ keepalive_timeout = 30000          docroot = /my/src/tacticians-server/www/          auth_log = true          appmods = <cgi-bin, yaws_appmod_cgi> -        start_mod = battlemap_node +        start_mod = handler  </server> diff --git a/src/battlemap_shim.erl b/src/battlemap_shim.erl index af76554..b805a9b 100644 --- a/src/battlemap_shim.erl +++ b/src/battlemap_shim.erl @@ -2,7 +2,7 @@  -export  (     [ -      generate/2 +      generate/0     ]  ). @@ -35,7 +35,9 @@ generate(Prev, Result, X, Y, BaseWidth) ->  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% EXPORTED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -generate (Width, Height) -> +generate () -> +   Width = (rand:uniform(54) + 10), +   Height = (rand:uniform(54) + 10),     #battlemap     {        id = <<"0">>, diff --git a/src/database_shim.erl b/src/database_shim.erl index 4110918..8b6cea4 100644 --- a/src/database_shim.erl +++ b/src/database_shim.erl @@ -23,10 +23,12 @@ create_db (_Heir) ->           {keypos, 1},           {read_concurrency, true}        ] -   ). +   ), +   io:format("~ndb_shim ets created.~n").  add_to_db (ID, Val) -> -   ets:store(db_shim, {ID, Val}). +   io:format("~nadd to db_shim: ~p.~n", [{ID, Val}]), +   ets:insert(db_shim, {ID, Val}).  generate_char_instances (Battlemap, Characters) ->     lists:map @@ -72,7 +74,7 @@ generate_db (Heir) ->     lists:map     (        fun (Char) -> -         add_to_db({character_sb, Char#character.id}, Char) +         add_to_db({character_db, Char#character.id}, Char)        end,        Characters     ), @@ -83,7 +85,7 @@ generate_db (Heir) ->     ).  fetch (DB, Object_ID) -> -   ets:first(db_shim), %% It appears the db does not exist... +   io:format("~ndb_shim lookup: ~p.~n", [{DB, Object_ID}]),     case ets:lookup(db_shim, {DB, Object_ID}) of        [{_Key, Value}] -> {ok, Value};        [] -> nothing diff --git a/src/timed_cache.erl b/src/timed_cache.erl index 70f9896..c86caab 100644 --- a/src/timed_cache.erl +++ b/src/timed_cache.erl @@ -2,7 +2,8 @@  -behavior(gen_server).  %%%% gen_server exports --export( +-export +(     [        init/1,        handle_cast/2, @@ -15,7 +16,8 @@  ).  %%%% actual interface --export( +-export +(     [        fetch/2,        invalidate/2 @@ -65,6 +67,7 @@ handle_info(_, {DB, ObjectID}) ->  %%%% interface  fetch (DB, ObjectID) -> +   io:format("~nfetch from cache: ~p.~n", [{DB, ObjectID}]),     case ets:lookup(DB, ObjectID) of        [] -> add_to_cache(DB, ObjectID); diff --git a/www/handler/battlemap/load_state.yaws b/www/handler/battlemap/load_state.yaws index 6e613c6..b5a7fc7 100644 --- a/www/handler/battlemap/load_state.yaws +++ b/www/handler/battlemap/load_state.yaws @@ -70,12 +70,12 @@ handle (Req) ->     BattlemapInstance =        timed_cache:fetch        ( -         battlemap_instances_db, +         battlemap_instance_db,           <<"0">>  %         {Input#input.battlemap_id, Input#input.battlemap_instance_id}        ),     Characters = -      list:map +      lists:map        (           fun ({CharID, CharInst}) ->              { | 


